AliPhysics  b752f14 (b752f14)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliV0ReaderV1.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Developers: Friederike Bock *
5  * Original Authors: Svein Lindal, Daniel Lohner *
6  * *
7  * Version 1.0 *
8  * *
9  * *
10  * based on: on older version (see aliroot up to v5-04-42-AN) *
11  * AliV0Reader.cxx *
12  * Authors: Kathrin Koch, Kenneth Aamodt, Ana Marin *
13  * *
14  * Permission to use, copy, modify and distribute this software and its *
15  * documentation strictly for non-commercial purposes is hereby granted *
16  * without fee, provided that the above copyright notice appears in all *
17  * copies and that both the copyright notice and this permission notic *
18  * appear in the supporting documentation. The authors make no claims *
19  * about the suitability of this software for any purpose. It is *
20  * provided "as is" without express or implied warranty. *
21  **************************************************************************/
22 
24 //---------------------------------------------
25 // Class reconstructing conversion photons from V0s
26 //---------------------------------------------
28 
29 // The AliAODConversionPhotons will return the Position (== ESDTrack->GetID())of the positive (negative) ESDTrack
30 // in the Array of ESDTracks stored in the ESDEvent via GetTrackLabelPositive() (GetTrackLabelNagative()).
31 // Since it is the Position in the Array it is always positive.
32 // After the conversion ESD --> AOD each AOD track will give you the former Position in the ESDArray via the
33 // Function AODTrack->GetID(). AODTracks are stored for different TrackParameter (e.g. HybridTracks, TPC only ...). No Standard
34 // AODTracks (not copies of AliExternalTrackParam) will be stored with negative values of AODTrack->GetID() (Formula: (ESDTrack->GetID()+1)*-1)
35 // This leads to the possibility of more than one AOD track with the same negative ID. For that reason all AOD tracks are additionally flaged.
36 // In this analysis we should therefore only use AODTracks with positive values of AODTrack->GetID().
37 
38 // If you want to find the AODTrack corresponding to the daugher track of a AliAODConversionPhoton you have to find the AODTrack with
39 // AODTrack->GetID() == GetTrackLabelPositive() (GetTrackLabelNagative()).
40 
41 #include <vector>
42 #include <TGeoGlobalMagField.h>
43 
44 #include "AliV0ReaderV1.h"
45 #include "AliKFParticle.h"
46 #include "AliAODv0.h"
47 #include "AliESDv0.h"
48 #include "AliAODEvent.h"
49 #include "AliESDEvent.h"
50 #include "AliPID.h"
51 #include "AliMCEvent.h"
52 #include "AliStack.h"
53 #include "AliMCEventHandler.h"
54 #include "AliESDpid.h"
55 #include "AliESDtrackCuts.h"
56 #include "TRandom3.h"
57 #include "AliGenCocktailEventHeader.h"
58 #include "TList.h"
59 #include "AliKFConversionPhoton.h"
60 #include "AliAODConversionPhoton.h"
62 #include "TVector.h"
63 #include "AliKFVertex.h"
64 #include "AliAODTrack.h"
65 #include "AliESDtrack.h"
66 #include "AliAnalysisManager.h"
67 #include "AliInputEventHandler.h"
68 #include "AliAODHandler.h"
69 #include "AliPIDResponse.h"
70 #include "TChain.h"
71 #include "TFile.h"
72 #include "TString.h"
73 #include "TObjArray.h"
74 
75 class iostream;
76 
77 using namespace std;
78 
80 
81 //________________________________________________________________________
82 AliV0ReaderV1::AliV0ReaderV1(const char *name) : AliAnalysisTaskSE(name),
83  fConversionCuts(NULL),
84  fEventCuts(NULL),
85  fConversionGammas(NULL),
86  fUseImprovedVertex(kTRUE),
87  fUseOwnXYZCalculation(kTRUE),
88  fUseConstructGamma(kFALSE),
89  kUseAODConversionPhoton(kTRUE),
90  kAddv0sInESDFilter(kFALSE),
91  fCreateAOD(kFALSE),
92  fDeltaAODBranchName("GammaConv"),
93  fDeltaAODFilename("AliAODGammaConversion.root"),
94  fRelabelAODs(kFALSE),
95  fPreviousV0ReaderPerformsAODRelabeling(0),
96  fEventIsSelected(kFALSE),
97  fNumberOfPrimaryTracks(0),
98  fNumberOfTPCoutTracks(0),
99  fPeriodName(""),
100  fPtHardBin(0),
101  fUseMassToZero(kTRUE),
102  fProduceV0findingEffi(kFALSE),
103  fProduceImpactParamHistograms(kFALSE),
104  fCurrentInvMassPair(0),
105  fImprovedPsiPair(3),
106  fHistograms(NULL),
107  fImpactParamHistograms(NULL),
108  fHistoMCGammaPtvsR(NULL),
109  fHistoMCGammaPtvsPhi(NULL),
110  fHistoMCGammaPtvsEta(NULL),
111  fHistoMCGammaRvsPhi(NULL),
112  fHistoMCGammaRvsEta(NULL),
113  fHistoMCGammaPhivsEta(NULL),
114  fHistoRecMCGammaPtvsR(NULL),
115  fHistoRecMCGammaPtvsPhi(NULL),
116  fHistoRecMCGammaPtvsEta(NULL),
117  fHistoRecMCGammaRvsPhi(NULL),
118  fHistoRecMCGammaRvsEta(NULL),
119  fHistoRecMCGammaPhivsEta(NULL),
120  fHistoRecMCGammaMultiPt(NULL),
121  fHistoRecMCGammaMultiPtvsEta(NULL),
122  fHistoRecMCGammaMultiR(NULL),
123  fHistoRecMCGammaMultiPhi(NULL),
124  fHistoPosTrackImpactParamZ(NULL),
125  fHistoPosTrackImpactParamY(NULL),
126  fHistoPosTrackImpactParamX(NULL),
127  fHistoPosTrackImpactParamZvsPt(NULL),
128  fHistoPosTrackImpactParamYvsPt(NULL),
129  fHistoPosTrackImpactParamXvsPt(NULL),
130  fHistoNegTrackImpactParamZ(NULL),
131  fHistoNegTrackImpactParamY(NULL),
132  fHistoNegTrackImpactParamX(NULL),
133  fHistoNegTrackImpactParamZvsPt(NULL),
134  fHistoNegTrackImpactParamYvsPt(NULL),
135  fHistoNegTrackImpactParamXvsPt(NULL),
136  fHistoImpactParamZvsR(NULL),
137  fHistoImpactParamZvsR2(NULL),
138  fHistoPt(NULL),
139  fHistoPt2(NULL),
140  fHistoDCAzPhoton(NULL),
141  fHistoDCAzPhoton2(NULL),
142  fHistoR(NULL),
143  fHistoRrecalc(NULL),
144  fHistoRviaAlpha(NULL),
145  fHistoRviaAlphaRecalc(NULL),
146  fHistoRdiff(NULL),
147  fHistoImpactParameterStudy(NULL),
148  fImpactParamTree(NULL),
149  fVectorFoundGammas(0),
150  fCurrentFileName(""),
151  fMCFileChecked(kFALSE),
152  fPCMv0BitField(NULL)
153 {
154  // Default constructor
155 
156  DefineInput(0, TChain::Class());
157  DefineOutput(1,TBits::Class());
158 }
159 
160 //________________________________________________________________________
162 {
163  // default deconstructor
164 
165  if(fConversionGammas){
166  fConversionGammas->Delete();// Clear Objects
167  delete fConversionGammas;
168  fConversionGammas=0x0;
169  }
170 }
171 
181  if(fConversionGammas && (index < fConversionGammas->GetEntriesFast())) {
182  TObject *tmp = fConversionGammas->At(index);
183  if(tmp->IsA() == AliAODConversionPhoton::Class()){
184  AliAODConversionPhoton *photon = static_cast<AliAODConversionPhoton *>(tmp);
185  return photon;
186  } else {
187  AliKFConversionPhoton *photon = static_cast<AliKFConversionPhoton *>(tmp);
188  return photon;
189  }
190  } else {
191  return nullptr;
192  }
193 }
194 
195 /*
196 //________________________________________________________________________
197 AliV0ReaderV1::AliV0ReaderV1(AliV0ReaderV1 &original) : AliAnalysisTaskSE(original),
198 fConversionCuts(NULL),
199 fConversionGammas(NULL),
200 fUseImprovedVertex(original.fUseImprovedVertex),
201 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
202 fUseConstructGamma(original.fUseConstructGamma),
203 kUseAODConversionPhoton(original.kUseAODConversionPhoton),
204 fCreateAOD(original.fCreateAOD),
205 fDeltaAODBranchName(original.fDeltaAODBranchName),
206 fDeltaAODFilename(original.fDeltaAODFilename),
207 fEventIsSelected(original.fEventIsSelected)
208 {
209 // Default constructor
210 
211 DefineInput(0, TChain::Class());
212 }
213 
214 //____________________________________________________________
215 AliV0ReaderV1 &AliV0ReaderV1::operator=(const AliV0ReaderV1 &ref){
216 //
217 // Assignment operator
218 // Only copies pointers, object is not the owner of the references
219 //
220 if(this != &ref){
221 AliAnalysisTaskSE::operator=(ref);
222 fUseImprovedVertex=ref.fUseImprovedVertex;
223 fUseOwnXYZCalculation=ref.fUseOwnXYZCalculation;
224 fUseConstructGamma=ref.fUseConstructGamma;
225 kUseAODConversionPhoton=ref.kUseAODConversionPhoton;
226 fCreateAOD=ref.fCreateAOD;
227 fDeltaAODBranchName=ref.fDeltaAODBranchName;
228 fDeltaAODFilename=ref.fDeltaAODFilename;
229 fEventIsSelected=ref.fEventIsSelected;
230 }
231 return *this;
232 }
233 */
234 
235 //________________________________________________________________________
237 {
238  // Initialize function to be called once before analysis
239  if(fConversionCuts==NULL){
240  if(fConversionCuts==NULL)AliError("No Conversion Cut Selection initialized");
241  }
242  if(fEventCuts==NULL){
243  if(fEventCuts==NULL)AliError("No Event Cut Selection initialized");
244  }
245 
246  if(fCreateAOD){kUseAODConversionPhoton=kTRUE;}
247 
248  if(fConversionGammas != NULL){
249  delete fConversionGammas;
250  fConversionGammas=NULL;
251  }
252 
253  if(fConversionGammas == NULL){
254  if(kUseAODConversionPhoton){
255  fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);}
256  else{
257  fConversionGammas = new TClonesArray("AliKFConversionPhoton",100);}
258  }
259  fConversionGammas->Delete();//Reset the TClonesArray
260 }
261 
262 //________________________________________________________________________
264 {
265  // Create AODs
266 
267  if(fCreateAOD){
268  fPCMv0BitField = new TBits();
269 
270  if (fEventCuts){
271  fDeltaAODBranchName.Append("_");
272  fDeltaAODBranchName.Append(fEventCuts->GetCutNumber());
273  }
274  if(fConversionCuts){
275  fDeltaAODBranchName.Append("_");
276  fDeltaAODBranchName.Append(fConversionCuts->GetCutNumber());
277  fDeltaAODBranchName.Append("_gamma");
278  }
279  fConversionGammas->SetName(fDeltaAODBranchName.Data());
280 
281  AddAODBranch("TClonesArray", &fConversionGammas, fDeltaAODFilename.Data());
282  AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFilename.Data());
283  }
284 
285  if(fProduceImpactParamHistograms){
286  if(fImpactParamHistograms != NULL){
287  delete fImpactParamHistograms;
288  fImpactParamHistograms = NULL;
289  }
290  if(fImpactParamHistograms==NULL){
291  fImpactParamHistograms = new TList();
292  fImpactParamHistograms->SetOwner(kTRUE);
293  fImpactParamHistograms->SetName(Form("ImpactParamHistograms_%s_%s",fEventCuts->GetCutNumber().Data(),fConversionCuts->GetCutNumber().Data()));
294  }
295  fHistoPosTrackImpactParamZ = new TH1F("fHistoPosTrackImpactParamZ","",480,-80,80);
296  fHistoPosTrackImpactParamZ->SetXTitle("Z (cm)");
297  fImpactParamHistograms->Add(fHistoPosTrackImpactParamZ);
298 
299  fHistoPosTrackImpactParamY = new TH1F("fHistoPosTrackImpactParamY","",720,-120,120);
300  fHistoPosTrackImpactParamY->SetXTitle("Y (cm)");
301  fImpactParamHistograms->Add(fHistoPosTrackImpactParamY);
302 
303  fHistoPosTrackImpactParamX = new TH1F("fHistoPosTrackImpactParamX","",30,-3,3);
304  fHistoPosTrackImpactParamX->SetXTitle("X (cm)");
305  fImpactParamHistograms->Add(fHistoPosTrackImpactParamX);
306 
307  fHistoNegTrackImpactParamZ = new TH1F("fHistoNegTrackImpactParamZ","",480,-80,80);
308  fHistoNegTrackImpactParamZ->SetXTitle("Z (cm)");
309  fImpactParamHistograms->Add(fHistoNegTrackImpactParamZ);
310 
311  fHistoNegTrackImpactParamY = new TH1F("fHistoNegTrackImpactParamY","",720,-120,120);
312  fHistoNegTrackImpactParamY->SetXTitle("Y (cm)");
313  fImpactParamHistograms->Add(fHistoNegTrackImpactParamY);
314 
315  fHistoNegTrackImpactParamX = new TH1F("fHistoNegTrackImpactParamX","",30,-3,3);
316  fHistoNegTrackImpactParamX->SetXTitle("X (cm)");
317  fImpactParamHistograms->Add(fHistoNegTrackImpactParamX);
318 
319  fHistoPosTrackImpactParamZvsPt = new TH2F("fHistoPosTrackImpactParamZvsPt","",100,0,10,480,-80,80);
320  fHistoPosTrackImpactParamZvsPt->SetYTitle("Z (cm)");
321  fHistoPosTrackImpactParamZvsPt->SetXTitle("Pt (GeV)");
322  fImpactParamHistograms->Add(fHistoPosTrackImpactParamZvsPt);
323 
324  fHistoPosTrackImpactParamYvsPt = new TH2F("fHistoPosTrackImpactParamYvsPt","",100,0,10,720,-120,120);
325  fHistoPosTrackImpactParamYvsPt->SetYTitle("Y (cm)");
326  fHistoPosTrackImpactParamYvsPt->SetXTitle("Pt (GeV)");
327  fImpactParamHistograms->Add(fHistoPosTrackImpactParamYvsPt);
328 
329  fHistoPosTrackImpactParamXvsPt = new TH2F("fHistoPosTrackImpactParamXvsPt","",100,0,10,30,-3,5);
330  fHistoPosTrackImpactParamXvsPt->SetYTitle("X (cm)");
331  fHistoPosTrackImpactParamXvsPt->SetXTitle("Pt (GeV)");
332  fImpactParamHistograms->Add(fHistoPosTrackImpactParamXvsPt);
333 
334  fHistoNegTrackImpactParamZvsPt = new TH2F("fHistoNegTrackImpactParamZvsPt","",100,0,10,480,-80,80);
335  fHistoNegTrackImpactParamZvsPt->SetYTitle("Z (cm)");
336  fHistoNegTrackImpactParamZvsPt->SetXTitle("Pt (GeV)");
337  fImpactParamHistograms->Add(fHistoNegTrackImpactParamZvsPt);
338 
339  fHistoNegTrackImpactParamYvsPt = new TH2F("fHistoNegTrackImpactParamYvsPt","",100,0,10,720,-120,120);
340  fHistoNegTrackImpactParamYvsPt->SetYTitle("Y (cm)");
341  fHistoNegTrackImpactParamYvsPt->SetXTitle("Pt (GeV)");
342  fImpactParamHistograms->Add(fHistoNegTrackImpactParamYvsPt);
343 
344  fHistoNegTrackImpactParamXvsPt = new TH2F("fHistoNegTrackImpactParamXvsPt","",100,0,10,30,-3,3);
345  fHistoNegTrackImpactParamXvsPt->SetYTitle("X (cm)");
346  fHistoNegTrackImpactParamXvsPt->SetXTitle("Pt (GeV)");
347  fImpactParamHistograms->Add(fHistoNegTrackImpactParamXvsPt);
348 
349  fHistoImpactParamZvsR = new TH2F("fHistoImpactParamZvsR","Before cuts",300,-150,150,200,0,200);
350  fHistoImpactParamZvsR->SetXTitle("Z (cm)");
351  fHistoImpactParamZvsR->SetYTitle("R (cm)");
352  fImpactParamHistograms->Add(fHistoImpactParamZvsR);
353 
354  fHistoImpactParamZvsR2 = new TH2F("fHistoImpactParamZvsR2","After cuts",300,-150,150,200,0,200);
355  fHistoImpactParamZvsR2->SetXTitle("Z (cm)");
356  fHistoImpactParamZvsR2->SetYTitle("R (cm)");
357  fImpactParamHistograms->Add(fHistoImpactParamZvsR2);
358 
359  fHistoPt = new TH1F("fHistoPt","Before all cuts",100,0,10);
360  fHistoPt->SetXTitle("Pt (GeV)");
361  fImpactParamHistograms->Add(fHistoPt);
362 
363  fHistoPt2 = new TH1F("fHistoPt2","After all cuts",100,0,10);
364  fHistoPt2->SetXTitle("Pt (GeV)");
365  fImpactParamHistograms->Add(fHistoPt2);
366 
367  fHistoDCAzPhoton = new TH1F("fHistoDCAzPhoton","Before cuts",20,-2,2);
368  fHistoDCAzPhoton->SetXTitle("DCAz photon (cm)");
369  fImpactParamHistograms->Add(fHistoDCAzPhoton);
370 
371  fHistoDCAzPhoton2 = new TH1F("fHistoDCAzPhoton2","After cuts",20,-2,2);
372  fHistoDCAzPhoton2->SetXTitle("DCAz photon (cm)");
373  fImpactParamHistograms->Add(fHistoDCAzPhoton2);
374 
375  fHistoR = new TH1F("fHistoR","",200,0,200);
376  fHistoR->SetXTitle("Conversion radius (cm)");
377  fImpactParamHistograms->Add(fHistoR);
378 
379  fHistoRrecalc = new TH1F("fHistoRrecalc","",200,0,200);
380  fHistoRrecalc->SetXTitle("conversion radius (cm)");
381  fImpactParamHistograms->Add(fHistoRrecalc);
382 
383  fHistoRviaAlpha = new TH1F("fHistoRviaAlpha","",200,0,200);
384  fHistoRviaAlpha->SetXTitle("Conversion radius (cm)");
385  fImpactParamHistograms->Add(fHistoRviaAlpha);
386 
387  fHistoRviaAlphaRecalc = new TH1F("fHistoRviaAlphaRecalc","",200,0,200);
388  fHistoRviaAlphaRecalc->SetXTitle("conversion radius (cm)");
389  fImpactParamHistograms->Add(fHistoRviaAlphaRecalc);
390 
391  fHistoRdiff = new TH1F("fHistoRdiff","",200,0,200);
392  fHistoRdiff->SetXTitle("R_conv - R_cluster conflict (cm)");
393  fImpactParamHistograms->Add(fHistoRdiff);
394 
395  fHistoImpactParameterStudy = new TH1F("fHistoImpactParameterStudy","",7,-0.5,6.5);
396  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(1,"# V0s");
397  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(2,"two TPC-only tracks");
398  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(3,"Z cut not passed");
399  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(4,"Y cut not passed");
400  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(5,"R>80cm");
401  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(6,"causality cut not p.");
402  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(7,"# removed V0s"); // of all V0s
403  fImpactParamHistograms->Add(fHistoImpactParameterStudy);
404 
405  fImpactParamTree = new TTree("fImpactParamTree","");
406  fImpactParamHistograms->Add(fImpactParamTree);
407  }
408 
409  if (fProduceV0findingEffi){
410  TH1::AddDirectory(kFALSE);
411  if(fHistograms != NULL){
412  delete fHistograms;
413  fHistograms = NULL;
414  }
415  if(fHistograms==NULL){
416  fHistograms = new TList();
417  fHistograms->SetOwner(kTRUE);
418  fHistograms->SetName(Form("V0FindingEfficiencyInput_%s_%s",fEventCuts->GetCutNumber().Data(),fConversionCuts->GetCutNumber().Data()));
419  }
420 
421  fHistoMCGammaPtvsR = new TH2F("MCconvGamma_Pt_R","MC converted gamma Pt vs R (|eta| < 0.9)",250,0.0,25,400,0,200);
422  fHistoMCGammaPtvsR->SetXTitle("p_{MC,T} (GeV/c)");
423  fHistoMCGammaPtvsR->SetYTitle("R_{MC,conv} (cm)");
424  fHistograms->Add(fHistoMCGammaPtvsR);
425 
426  fHistoMCGammaPtvsEta = new TH2F("MCconvGamma_Pt_Eta","MC converted gamma Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
427  fHistoMCGammaPtvsEta->SetXTitle("p_{MC,T} (GeV/c)");
428  fHistoMCGammaPtvsEta->SetYTitle("#eta_{MC}");
429  fHistograms->Add(fHistoMCGammaPtvsEta);
430 
431  fHistoMCGammaPtvsPhi = new TH2F("MCconvGamma_Pt_Phi","MC converted gamma Pt vs Phi (|eta| < 0.9) ",250,0.0,25,400,0,2*TMath::Pi());
432  fHistoMCGammaPtvsPhi->SetXTitle("p_{MC,T} (GeV/c)");
433  fHistoMCGammaPtvsPhi->SetYTitle("#varphi_{MC} (rad)");
434  fHistograms->Add(fHistoMCGammaPtvsPhi);
435 
436  fHistoMCGammaRvsPhi = new TH2F("MCconvGamma_R_Phi","MC converted gamma R vs Phi (|eta| < 0.9) ",400,0,200,400,0,2*TMath::Pi());
437  fHistoMCGammaRvsPhi->SetXTitle("R_{MC,conv} (cm)");
438  fHistoMCGammaRvsPhi->SetYTitle("#varphi_{MC} (rad)");
439  fHistograms->Add(fHistoMCGammaRvsPhi);
440 
441  fHistoMCGammaRvsEta = new TH2F("MCconvGamma_R_Eta","MC converted gamma R vs Eta ",400,0,200,280,-1.4,1.4);
442  fHistoMCGammaRvsEta->SetXTitle("R_{MC,conv} (cm)");
443  fHistoMCGammaRvsEta->SetYTitle("#eta_{MC}");
444  fHistograms->Add(fHistoMCGammaRvsEta);
445 
446  fHistoMCGammaPhivsEta = new TH2F("MCconvGamma_Phi_Eta","MC converted gamma Phi vs Eta ",400,0,2*TMath::Pi(),280,-1.4,1.4);
447  fHistoMCGammaPhivsEta->SetXTitle("#phi_{MC} (rad)");
448  fHistoMCGammaPhivsEta->SetYTitle("#eta_{MC}");
449  fHistograms->Add(fHistoMCGammaPhivsEta);
450 
451  fHistoRecMCGammaPtvsR = new TH2F("RecMCconvGamma_Pt_R","rec MC converted gamma Pt vs R (|eta| < 0.9)",250,0.0,25,400,0,200);
452  fHistoRecMCGammaPtvsR->SetXTitle("p_{MC,T} (GeV/c)");
453  fHistoRecMCGammaPtvsR->SetYTitle("R_{MC,conv} (cm)");
454  fHistograms->Add(fHistoRecMCGammaPtvsR);
455 
456  fHistoRecMCGammaPtvsEta = new TH2F("RecMCconvGamma_Pt_Eta","rec MC converted gamma Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
457  fHistoRecMCGammaPtvsEta->SetXTitle("p_{MC,T} (GeV/c)");
458  fHistoRecMCGammaPtvsEta->SetYTitle("#eta_{MC}");
459  fHistograms->Add(fHistoRecMCGammaPtvsEta);
460 
461  fHistoRecMCGammaPtvsPhi = new TH2F("RecMCconvGamma_Pt_Phi","rec MC converted gamma Pt vs Phi (|eta| < 0.9) ",250,0.0,25,400,0,2*TMath::Pi());
462  fHistoRecMCGammaPtvsPhi->SetXTitle("p_{MC,T} (GeV/c)");
463  fHistoRecMCGammaPtvsPhi->SetYTitle("#varphi_{MC} (rad)");
464  fHistograms->Add(fHistoRecMCGammaPtvsPhi);
465 
466  fHistoRecMCGammaRvsPhi = new TH2F("RecMCconvGamma_R_Phi","rec MC converted gamma R vs Phi (|eta| < 0.9) ",400,0,200,400,0,2*TMath::Pi());
467  fHistoRecMCGammaRvsPhi->SetXTitle("R_{MC,conv} (cm)");
468  fHistoRecMCGammaRvsPhi->SetYTitle("#varphi_{MC} (rad)");
469  fHistograms->Add(fHistoRecMCGammaRvsPhi);
470 
471  fHistoRecMCGammaRvsEta = new TH2F("RecMCconvGamma_R_Eta","rec MC converted gamma R vs Eta ",400,0,200,280,-1.4,1.4);
472  fHistoRecMCGammaRvsEta->SetXTitle("R_{MC,conv} (cm)");
473  fHistoRecMCGammaRvsEta->SetYTitle("#eta_{MC}");
474  fHistograms->Add(fHistoRecMCGammaRvsEta);
475 
476  fHistoRecMCGammaPhivsEta = new TH2F("RecMCconvGamma_Phi_Eta","rec MC converted gamma Phi vs Eta ",400,0,2*TMath::Pi(),280,-1.4,1.4);
477  fHistoRecMCGammaPhivsEta->SetXTitle("#phi_{MC} (rad)");
478  fHistoRecMCGammaPhivsEta->SetYTitle("#eta_{MC}");
479  fHistograms->Add(fHistoRecMCGammaPhivsEta);
480 
481  fHistoRecMCGammaMultiPtvsEta = new TH2F("RecMCconvGammaMulti_Pt_Eta","rec MC converted gamma (at least double counted) Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
482  fHistoRecMCGammaMultiPtvsEta->SetXTitle("p_{MC,T} (GeV/c)");
483  fHistoRecMCGammaMultiPtvsEta->SetYTitle("#eta_{MC}");
484  fHistograms->Add(fHistoRecMCGammaMultiPtvsEta);
485 
486  fHistoRecMCGammaMultiPt = new TH1F("RecMCconvGammaMulti_Pt","rec MC converted gamma (at least double counted) Pt (|eta| < 0.9)",250,0.0,25);
487  fHistoRecMCGammaMultiPt->SetXTitle("p_{MC,T} (GeV/c)");
488  fHistograms->Add(fHistoRecMCGammaMultiPt);
489 
490  fHistoRecMCGammaMultiR = new TH1F("RecMCconvGammaMulti_R","rec MC converted gamma (at least double counted) R (|eta| < 0.9)",400,0,200);
491  fHistoRecMCGammaMultiR->SetXTitle("R_{MC,conv} (cm)");
492  fHistograms->Add(fHistoRecMCGammaMultiR);
493 
494  fHistoRecMCGammaMultiPhi = new TH1F("RecMCconvGammaMulti_Phi","rec MC converted gamma (at least double counted) Phi (|eta| < 0.9)",400,0,2*TMath::Pi());
495  fHistoRecMCGammaMultiPhi->SetXTitle("#phi_{MC} (rad)");
496  fHistograms->Add(fHistoRecMCGammaMultiPhi);
497 
498  fVectorFoundGammas.clear();
499  }
500 
501 }
502 //________________________________________________________________________
504 
505  // set file name to empty & reset check flag
506  fCurrentFileName = "";
507  fMCFileChecked = kFALSE;
508 
509  // obtain file name from analysis manager
510  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
511  if(man) {
512  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
513  if (inputHandler){
514  TTree* tree = (TTree*) inputHandler->GetTree();
515  TFile* file = (TFile*) tree->GetCurrentFile();
516  fCurrentFileName = file->GetName();
517  }
518  }
519 
520  // try to extract period name from file name if not given
521  if (fPeriodName.CompareTo("") == 0){
522  TObjArray *arr = fCurrentFileName.Tokenize("/");
523  fPtHardBin = -1;
524  for (Int_t i = 0; i < arr->GetEntriesFast();i++ ){
525  TObjString* testObjString = (TObjString*)arr->At(i);
526  if (testObjString->GetString().BeginsWith("LHC")){
527  fPeriodName = testObjString->GetString();
528  i = arr->GetEntriesFast();
529  }
530  }
531  if (fPeriodName.CompareTo("")==0){
532  TObjArray *arr2 = fCurrentFileName.Tokenize("__");
533  for (Int_t i = 0; i < arr->GetEntriesFast();i++ ){
534  TObjString* testObjString = (TObjString*)arr2->At(i);
535  if (testObjString->GetString().BeginsWith("LHC")){
536  fPeriodName = testObjString->GetString();
537  i = arr2->GetEntriesFast();
538  }
539  }
540  }
541  if (fPeriodName.CompareTo("") != 0 && fEventCuts->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
542  fEventCuts->SetPeriodEnum (fPeriodName);
543  }
544  } else {
545  if(fEventCuts->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
546  fEventCuts->SetPeriodEnum (fPeriodName);
547  }
548  }
549  // set pt hard bin from file name
550  if ( fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15a3a || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15a3a_plus ||
551  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15a3b ||
552  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15g1a || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15g1b ||
553  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c2 || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c2_plus ||
554  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c3a || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c3b ||
555  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c3c){
556  TObjArray *arr = fCurrentFileName.Tokenize("/");
557  fPtHardBin = -1;
558  for (Int_t i = 0; i < arr->GetEntriesFast();i++ ){
559  TObjString* testObjString = (TObjString*)arr->At(i);
560  if (testObjString->GetString().BeginsWith("LHC")){
561  TObjString* testObjString2 = (TObjString*)arr->At(i+1);
562  fPtHardBin = testObjString2->GetString().Atoi();
563  i = arr->GetEntriesFast();
564  }
565  }
566  }
567 
568  if(!fEventCuts->GetDoEtaShift()) return kTRUE; // No Eta Shift requested, continue
569  if(fEventCuts->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
570  fEventCuts->GetCorrectEtaShiftFromPeriod();
571  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
572  return kTRUE;
573  } else {
574  printf(" Gamma Conversion Reader %s_%s :: Eta Shift Manually Set to %f \n\n",
575  (fEventCuts->GetCutNumber()).Data(),(fConversionCuts->GetCutNumber()).Data(),fEventCuts->GetEtaShift());
576  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
577  }
578 
579  return kTRUE;
580 }
581 //________________________________________________________________________
583 
584  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
585  if(esdEvent) {
586  if (!TGeoGlobalMagField::Instance()->GetField()) esdEvent->InitMagneticField();
587  }
588 
589  // Check if correctly initialized
590  if(!fConversionGammas)Init();
591 
592  // User Exec
593  fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
594 
595  // AOD Output
596  FillAODOutput();
597 
598 }
599 
600 //________________________________________________________________________
601 Bool_t AliV0ReaderV1::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
602 {
603 
604  //Reset the TClonesArray
605  fConversionGammas->Delete();
606 
607  //Clear TBits object with accepted v0s from previous event
608  if (kAddv0sInESDFilter){fPCMv0BitField->Clear();}
609 
610  fInputEvent = inputEvent;
611  fMCEvent = mcEvent;
612 
613  if(!fInputEvent){
614  AliError("No Input event");
615  return kFALSE;
616  }
617  if(!fEventCuts){AliError("No EventCuts");return kFALSE;}
618  if(!fConversionCuts){AliError("No ConversionCuts");return kFALSE;}
619 
620 
621  // Count Primary Tracks Event
622  CountTracks();
623 
624  //Count Tracks with TPCout flag
625  CountTPCoutTracks();
626 
627 
628  // Event Cuts
629  if(!fEventCuts->EventIsSelected(fInputEvent,fMCEvent)){
630  if (fEventCuts->GetEventQuality() == 2 && !fMCFileChecked ){
631  cout << "ERROR with MC reading for: "<< fCurrentFileName.Data() << endl;
632  fMCFileChecked = kTRUE;
633  }
634  return kFALSE;
635  }
636  // Set Magnetic Field
637  AliKFParticle::SetField(fInputEvent->GetMagneticField());
638 
639  if(fInputEvent->IsA()==AliAODEvent::Class() && fProduceV0findingEffi){
640  fProduceV0findingEffi = kFALSE;
641  AliWarning("V0finding effi cannot be run on AODs ");
642  }
643 
644  if(fProduceV0findingEffi){
645  CreatePureMCHistosForV0FinderEffiESD();
646  fVectorFoundGammas.clear();
647  }
648 
649  if(fInputEvent->IsA()==AliESDEvent::Class()){
650  ProcessESDV0s();
651  }
652  if(fInputEvent->IsA()==AliAODEvent::Class()){
653  GetAODConversionGammas();
654  }
655 
656  return kTRUE;
657 }
660 {
661  // Fill AOD Output with reconstructed Photons
662 
663  if(fInputEvent->IsA()==AliESDEvent::Class()){
665  if(fCreateAOD) {
666  PostData(1, fPCMv0BitField);
667  AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
668  if (aodhandler && aodhandler->GetFillAOD()) {
669  AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
670  //PostData(0, fConversionGammas);
671 
672  }
673  }
674  }
675 }
676 
678 const AliExternalTrackParam *AliV0ReaderV1::GetExternalTrackParam(AliESDv0 *fCurrentV0,Int_t &tracklabel,Int_t charge){
679 
680  // Get External Track Parameter with given charge
681 
682  if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;}
683 
684  if(fConversionCuts->GetV0FinderSameSign()==1){
685  if(fCurrentV0){
686  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()!=(fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge())return 0x0;
687  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==(fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()){
688  if(charge==1){
689  tracklabel=fCurrentV0->GetPindex();
690  return fCurrentV0->GetParamP();
691  }else{
692  tracklabel=fCurrentV0->GetNindex();
693  return fCurrentV0->GetParamN();
694  }
695  }
696  }
697  }else if(fConversionCuts->GetV0FinderSameSign()==2){
698  if(fCurrentV0){
699  if(charge==1){
700  tracklabel=fCurrentV0->GetPindex();
701  return fCurrentV0->GetParamP();
702  }else{
703  tracklabel=fCurrentV0->GetNindex();
704  return fCurrentV0->GetParamN();
705  }
706  }
707  }else{
708  // Check for sign flip
709  if(fCurrentV0){
710  if(!fCurrentV0->GetParamN()||!fCurrentV0->GetParamP())return 0x0;
711  if(!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex())||!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))return 0x0;
712  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==charge){
713  tracklabel=fCurrentV0->GetPindex();
714  return fCurrentV0->GetParamP();}
715  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()==charge){
716  tracklabel=fCurrentV0->GetNindex();
717  return fCurrentV0->GetParamN();}
718  }
719  }
720  return 0x0;
721 }
722 
725 {
726 
727  // Process ESD V0s for conversion photon reconstruction
728  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
729 
730  AliKFConversionPhoton *fCurrentMotherKFCandidate=NULL;
731 
732  if(fESDEvent){
733  for(Int_t currentV0Index=0;currentV0Index<fESDEvent->GetNumberOfV0s();currentV0Index++){
734  AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index));
735  if(!fCurrentV0){
736  printf("Requested V0 does not exist");
737  continue;
738  }
739 
740  fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index);
741 
742  if(fCurrentMotherKFCandidate){
743  // Add Gamma to the TClonesArray
744 
745  if(kUseAODConversionPhoton){
746  new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(fCurrentMotherKFCandidate);
747  AliAODConversionPhoton * currentConversionPhoton = (AliAODConversionPhoton*)(fConversionGammas->At(fConversionGammas->GetEntriesFast()-1));
748  currentConversionPhoton->SetMass(fCurrentMotherKFCandidate->M());
749  if (fUseMassToZero) currentConversionPhoton->SetMassToZero();
750  currentConversionPhoton->SetInvMassPair(fCurrentInvMassPair);
751  if(kAddv0sInESDFilter){fPCMv0BitField->SetBitNumber(currentV0Index, kTRUE);}
752  } else {
753  new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliKFConversionPhoton(*fCurrentMotherKFCandidate);
754  }
755 
756  delete fCurrentMotherKFCandidate;
757  fCurrentMotherKFCandidate=NULL;
758  }
759  }
760  if(kAddv0sInESDFilter){fPCMv0BitField->Compact();}
761  }
762  return kTRUE;
763 }
764 
766 AliKFConversionPhoton *AliV0ReaderV1::ReconstructV0(AliESDv0 *fCurrentV0,Int_t currentV0Index)
767 {
768  // cout << currentV0Index << endl;
769  // Reconstruct conversion photon from ESD v0
770  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonIn);
771 
772  //checks if on the fly mode is set
773  if(!fConversionCuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
774  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kOnFly);
775  return 0x0;
776  }
777 
778  if (fMCEvent && fProduceV0findingEffi ) FillRecMCHistosForV0FinderEffiESD(fCurrentV0);
779 
780  // TrackLabels
781  Int_t currentTrackLabels[2]={-1,-1};
782 
783  // Get Daughter KF Particles
784 
785  const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0,currentTrackLabels[0]);
786  // cout << fCurrentExternalTrackParamPositive << "\t" << currentTrackLabels[0] << endl;
787  const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0,currentTrackLabels[1]);
788  // cout << fCurrentExternalTrackParamNegative << "\t" << currentTrackLabels[1] << endl;
789  if(!fCurrentExternalTrackParamPositive||!fCurrentExternalTrackParamNegative)return 0x0;
790 
791  // Apply some Cuts before Reconstruction
792 
793  AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[0]);
794  AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[1]);
795  if(!negTrack || !posTrack) {
796  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kNoTracks);
797  return 0x0;
798  }
799  // Track Cuts
800  if(!fConversionCuts->TracksAreSelected(negTrack, posTrack)){
801  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kTrackCuts);
802  return 0x0;
803  }
804 
805  fConversionCuts->FillV0EtaBeforedEdxCuts(fCurrentV0->Eta());
806  if (!fConversionCuts->dEdxCuts(posTrack)) {
807  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
808  return 0x0;
809  }
810  // PID Cuts
811  if(!fConversionCuts->dEdxCuts(negTrack)) {
812  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
813  return 0x0;
814  }
815  fConversionCuts->FillV0EtaAfterdEdxCuts(fCurrentV0->Eta());
816  // Reconstruct Photon
817  AliKFConversionPhoton *fCurrentMotherKF=NULL;
818  // fUseConstructGamma = kFALSE;
819  // cout << "construct gamma " << endl;
820  AliKFParticle fCurrentNegativeKFParticle(*(fCurrentExternalTrackParamNegative),11);
821  // cout << fCurrentExternalTrackParamNegative << "\t" << endl;
822  AliKFParticle fCurrentPositiveKFParticle(*(fCurrentExternalTrackParamPositive),-11);
823  // cout << fCurrentExternalTrackParamPositive << "\t" << endl;
824  // cout << currentTrackLabels[0] << "\t" << currentTrackLabels[1] << endl;
825  // cout << "construct gamma " <<fUseConstructGamma << endl;
826 
827  // Reconstruct Gamma
828  if(fUseConstructGamma){
829  fCurrentMotherKF = new AliKFConversionPhoton();
830  fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
831  }else{
832  fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
833  fCurrentMotherKF->SetMassConstraint(0,0.0001);
834  }
835 
836  // Set Track Labels
837 
838  fCurrentMotherKF->SetTrackLabels(currentTrackLabels[0],currentTrackLabels[1]);
839 
840  // Set V0 index
841 
842  fCurrentMotherKF->SetV0Index(currentV0Index);
843 
844  //Set MC Label
845  if(fMCEvent){
846 
847  AliStack *fMCStack= fMCEvent->Stack();
848 
849  Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelPositive())->GetLabel());
850  Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelNegative())->GetLabel());
851 
852 // cout << "rec: " << currentTrackLabels[0] << "\t" << currentTrackLabels[1] << endl;
853 // cout << "recProp: " << fCurrentMotherKF->GetTrackLabelPositive() << "\t" << fCurrentMotherKF->GetTrackLabelNegative() << endl;
854 // cout << "MC: " << labeln << "\t" << labelp << endl;
855 
856  TParticle *fNegativeMCParticle = 0x0;
857  if(labeln>-1) fNegativeMCParticle = fMCStack->Particle(labeln);
858  TParticle *fPositiveMCParticle = 0x0;
859  if(labelp>-1) fPositiveMCParticle = fMCStack->Particle(labelp);
860 
861  if(fPositiveMCParticle&&fNegativeMCParticle){
862  fCurrentMotherKF->SetMCLabelPositive(labelp);
863  fCurrentMotherKF->SetMCLabelNegative(labeln);
864  }
865  }
866 
867  // Update Vertex (moved for same eta compared to old)
868  // cout << currentV0Index <<" \t before: \t" << fCurrentMotherKF->GetPx() << "\t" << fCurrentMotherKF->GetPy() << "\t" << fCurrentMotherKF->GetPz() << endl;
869  if(fUseImprovedVertex == kTRUE){
870  AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
871  // cout << "Prim Vtx: " << primaryVertexImproved.GetX() << "\t" << primaryVertexImproved.GetY() << "\t" << primaryVertexImproved.GetZ() << endl;
872  primaryVertexImproved+=*fCurrentMotherKF;
873  fCurrentMotherKF->SetProductionVertex(primaryVertexImproved);
874  }
875  // SetPsiPair
876  Double_t convpos[3]={0,0,0};
877  if (fImprovedPsiPair == 0){
878  Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative, convpos);
879  fCurrentMotherKF->SetPsiPair(PsiPair);
880  }
881 
882  // Recalculate ConversionPoint
883  Double_t dca[2]={0,0};
884  if(fUseOwnXYZCalculation){
885  // Double_t convpos[3]={0,0,0};
886  if(!GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos,dca)){
887  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kConvPointFail);
888  delete fCurrentMotherKF;
889  fCurrentMotherKF=NULL;
890  return 0x0;
891  }
892 
893  fCurrentMotherKF->SetConversionPoint(convpos);
894  }
895 
896 
897  // SetPsiPair
898  if (fImprovedPsiPair >= 1){
899  // the propagation can be more precise after the precise conversion point calculation
900  Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos);
901  fCurrentMotherKF->SetPsiPair(PsiPair);
902  //cout<<" GetPsiPair::"<<fCurrentMotherKF->GetPsiPair() <<endl;
903  }
904 
905  if(fCurrentMotherKF->GetNDF() > 0.)
906  fCurrentMotherKF->SetChi2perNDF(fCurrentMotherKF->GetChi2()/fCurrentMotherKF->GetNDF()); //->Photon is created before all chi2 relevant changes are performed, set it "by hand"
907 
908 
909  // Set Dilepton Mass (moved down for same eta compared to old)
910  fCurrentMotherKF->SetMass(fCurrentMotherKF->M());
911 
912  // Calculating invariant mass
913  Double_t mass=-99.0, mass_width=-99.0, Pt=-99.0, Pt_width=-99.0;
914  AliKFParticle fCurrentMotherKFForMass(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
915  fCurrentMotherKFForMass.GetMass(mass,mass_width);
916  fCurrentMotherKFForMass.GetPt(Pt,Pt_width);
917  fCurrentInvMassPair=mass;
918 
919  // apply possible Kappa cut
920  if (!fConversionCuts->KappaCuts(fCurrentMotherKF,fInputEvent)){
921  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
922  delete fCurrentMotherKF;
923  fCurrentMotherKF=NULL;
924  return 0x0;
925  }
926 
927  // Apply Photon Cuts
928  if(!fConversionCuts->PhotonCuts(fCurrentMotherKF,fInputEvent)){
929  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonCuts);
930  delete fCurrentMotherKF;
931  fCurrentMotherKF=NULL;
932  return 0x0;
933  }
934 
935  // cout << currentV0Index <<" \t after: \t" <<fCurrentMotherKF->GetPx() << "\t" << fCurrentMotherKF->GetPy() << "\t" << fCurrentMotherKF->GetPz() << endl;
936 
937  if(fProduceImpactParamHistograms) FillImpactParamHistograms(posTrack, negTrack, fCurrentV0, fCurrentMotherKF);
938 
939  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonOut);
940  return fCurrentMotherKF;
941 }
942 
944 Double_t AliV0ReaderV1::GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam,const AliExternalTrackParam *negativeparam,const Double_t convpos[3]) const {
945  //
946  // Angle between daughter momentum plane and plane
947  //
948 
949  AliExternalTrackParam nt(*negativeparam);
950  AliExternalTrackParam pt(*positiveparam);
951 
952  Float_t magField = fInputEvent->GetMagneticField();
953 
954  Double_t xyz[3] = {0.,0.,0.};
955  if (fImprovedPsiPair==0 ) {
956  v0->GetXYZ(xyz[0],xyz[1],xyz[2]);
957  } else if (fImprovedPsiPair>=1 ) {
958  xyz[0]= convpos[0];
959  xyz[1]= convpos[1];
960  xyz[2]= convpos[2];
961  }
962 
963 
964  // Double_t pPlus[3] = {pt.Px(),pt.Py(),pt.Pz()};
965  // Double_t pMinus[3] = {nt.Px(),nt.Py(),nt.Pz()};
966 
967  // Double_t u[3] = {pPlus[0]+pMinus[0],pPlus[1]+pMinus[1],pPlus[2]+pMinus[2]};
968  // Double_t normu = sqrt( (u[0]*u[0]) + (u[1]*u[1]) + (u[2]*u[2]) );
969 
970  // u[0] = u[0] / normu;
971  // u[1] = u[1] / normu;
972  // u[2] = u[2] / normu;
973 
974  // Double_t normpPlus = sqrt( (pPlus[0]*pPlus[0]) + (pPlus[1]*pPlus[1]) + (pPlus[2]*pPlus[2]) );
975  // Double_t normpMinus = sqrt( (pMinus[0]*pMinus[0]) + (pMinus[1]*pMinus[1]) + (pMinus[2]*pMinus[2]) );
976 
977  // pPlus[0] = pPlus[0] / normpPlus;
978  // pPlus[1] = pPlus[1] / normpPlus;
979  // pPlus[2] = pPlus[2] / normpPlus;
980 
981  // pMinus[0] = pMinus[0] / normpMinus;
982  // pMinus[1] = pMinus[1] / normpMinus;
983  // pMinus[2] = pMinus[2] / normpMinus;
984 
985  // Double_t v[3] = {0,0,0}; // pPlus X pMinus
986  // v[0] = (pPlus[1]*pMinus[2]) - (pPlus[2]*pMinus[1]);
987  // v[1] = (pPlus[2]*pMinus[0]) - (pPlus[0]*pMinus[2]);
988  // v[2] = (pPlus[0]*pMinus[1]) - (pPlus[1]*pMinus[0]);
989 
990  // Double_t w[3] = {0,0,0}; // u X v
991  // w[0] = (u[1]*v[2]) - (u[2]*v[1]);
992  // w[1] = (u[2]*v[0]) - (u[0]*v[2]);
993  // w[2] = (u[0]*v[1]) - (u[1]*v[0]);
994 
995  // Double_t z[3] = {0,0,1};
996  // Double_t wc[3] = {0,0,0}; // u X v
997  // wc[0] = (u[1]*z[2]) - (u[2]*z[1]);
998  // wc[1] = (u[2]*z[0]) - (u[0]*z[2]);
999  // wc[2] = (u[0]*z[1]) - (u[1]*z[0]);
1000 
1001  // Double_t PhiV = TMath::ACos((w[0]*wc[0]) + (w[1]*wc[1]) + (w[2]*wc[2]));
1002  //return TMath::Abs(PhiV);
1003 
1004 
1005  // TVector3 pPlus(pt.Px(),pt.Py(),pt.Pz());
1006  // TVector3 pMinus(nt.Px(),nt.Py(),nt.Pz());
1007 
1008  // TVector3 u = pMinus + pPlus;
1009  // u = u*(1/u.Mag());
1010 
1011  // TVector3 pHPlus = pPlus*(1/pPlus.Mag());
1012  // TVector3 pHMinus = pMinus*(1/pMinus.Mag());
1013 
1014  // TVector3 v = pHPlus.Cross(pHMinus);
1015  // TVector3 w = u.Cross(v);
1016  // TVector3 z(0,0,1);
1017  // TVector3 wc = u.Cross(z);
1018 
1019  // Double_t PhiV = w * wc;
1020 
1021  Double_t mn[3] = {0,0,0};
1022  Double_t mp[3] = {0,0,0};
1023 
1024  v0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
1025  v0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
1026 
1027  Double_t deltat = 1.;
1028  deltat = TMath::ATan(mp[2]/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1])+1.e-13)) - TMath::ATan(mn[2]/(TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1])+1.e-13));//difference of angles of the two daughter tracks with z-axis
1029  Double_t radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 50;//radius to which tracks shall be propagated
1030 
1031  Double_t momPosProp[3] = {0,0,0};
1032  Double_t momNegProp[3] = {0,0,0};
1033 
1034  Double_t psiPair = 4.;
1035  // cout<< "Momentum before propagation at radius ::"<< TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1])<< endl;
1036  // cout<< mn[0]<< " " <<mn[1]<<" "<< mn[2]<<" "<<TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1] +mn[2]*mn[2])<< endl;
1037  // cout<< mp[0]<< " " <<mp[1]<<" "<< mp[2]<<" "<<TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1] +mp[2]*mp[2])<< endl;
1038  Double_t pEle,pPos;
1039 
1040  if (fImprovedPsiPair==1 || fImprovedPsiPair==0 ){
1041  if(nt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
1042  if(pt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
1043 
1044  pt.GetPxPyPz(momPosProp);//Get momentum vectors of tracks after propagation
1045  nt.GetPxPyPz(momNegProp);
1046  } else if (fImprovedPsiPair>=2) {
1047  momPosProp[0] = pt.GetParameterAtRadius(radiussum,magField,3);
1048  momPosProp[1] = pt.GetParameterAtRadius(radiussum,magField,4);
1049  momPosProp[2] = pt.GetParameterAtRadius(radiussum,magField,5);
1050 
1051  momNegProp[0] = nt.GetParameterAtRadius(radiussum,magField,3);
1052  momNegProp[1] = nt.GetParameterAtRadius(radiussum,magField,4);
1053  momNegProp[2] = nt.GetParameterAtRadius(radiussum,magField,5);
1054  pEle = TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
1055 
1056  pPos = TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
1057 
1058  if ( (pEle==0 || pPos==0) && fImprovedPsiPair==3) {
1059  radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 30;
1060  momPosProp[0] = pt.GetParameterAtRadius(radiussum,magField,3);
1061  momPosProp[1] = pt.GetParameterAtRadius(radiussum,magField,4);
1062  momPosProp[2] = pt.GetParameterAtRadius(radiussum,magField,5);
1063 
1064  momNegProp[0] = nt.GetParameterAtRadius(radiussum,magField,3);
1065  momNegProp[1] = nt.GetParameterAtRadius(radiussum,magField,4);
1066  momNegProp[2] = nt.GetParameterAtRadius(radiussum,magField,5);
1067 
1068  }
1069  }
1070 
1071  pEle = TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
1072  pPos = TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
1073 
1074  Double_t scalarproduct =
1075  momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
1076 
1077  if (pEle==0 || pPos==0) return psiPair;
1078 
1079 
1080  Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks
1081 
1082  // psiPair = TMath::Abs(TMath::ASin(deltat/chipair));
1083  psiPair = TMath::ASin(deltat/chipair);
1084  return psiPair;
1085 }
1086 
1088 Bool_t AliV0ReaderV1::GetHelixCenter(const AliExternalTrackParam *track,Double_t center[2]){
1089 
1090  // Get Center of the helix track parametrization
1091 
1092  Int_t charge=track->Charge();
1093  Double_t b=fInputEvent->GetMagneticField();
1094 
1095  Double_t helix[6];
1096  track->GetHelixParameters(helix,b);
1097 
1098  Double_t xpos = helix[5];
1099  Double_t ypos = helix[0];
1100  Double_t radius = TMath::Abs(1./helix[4]);
1101  Double_t phi = helix[2];
1102 
1103  if(phi < 0){
1104  phi = phi + 2*TMath::Pi();
1105  }
1106 
1107  phi -= TMath::Pi()/2.;
1108  Double_t xpoint = radius * TMath::Cos(phi);
1109  Double_t ypoint = radius * TMath::Sin(phi);
1110 
1111  if(b<0){
1112  if(charge > 0){
1113  xpoint = - xpoint;
1114  ypoint = - ypoint;
1115  }
1116  }
1117  if(b>0){
1118  if(charge < 0){
1119  xpoint = - xpoint;
1120  ypoint = - ypoint;
1121  }
1122  }
1123  center[0] = xpos + xpoint;
1124  center[1] = ypos + ypoint;
1125 
1126  return 1;
1127 }
1129 Bool_t AliV0ReaderV1::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3],Double_t dca[2]){
1130 
1131  // Recalculate Conversion Point
1132 
1133  if(!pparam||!nparam)return kFALSE;
1134 
1135  Double_t helixcenterpos[2];
1136  GetHelixCenter(pparam,helixcenterpos);
1137 
1138  Double_t helixcenterneg[2];
1139  GetHelixCenter(nparam,helixcenterneg);
1140 
1141  Double_t helixpos[6];
1142  pparam->GetHelixParameters(helixpos,fInputEvent->GetMagneticField());
1143  Double_t posradius = TMath::Abs(1./helixpos[4]);
1144 
1145  Double_t helixneg[6];
1146  nparam->GetHelixParameters(helixneg,fInputEvent->GetMagneticField());
1147  Double_t negradius = TMath::Abs(1./helixneg[4]);
1148 
1149  // Calculate xy-position
1150 
1151  Double_t xpos = helixcenterpos[0];
1152  Double_t ypos = helixcenterpos[1];
1153  Double_t xneg = helixcenterneg[0];
1154  Double_t yneg = helixcenterneg[1];
1155 
1156  convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1157  convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1158 
1159 
1160  // Calculate Track XY vertex position
1161 
1162  Double_t deltaXPos = convpos[0] - xpos;
1163  Double_t deltaYPos = convpos[1] - ypos;
1164 
1165  Double_t deltaXNeg = convpos[0] - xneg;
1166  Double_t deltaYNeg = convpos[1] - yneg;
1167 
1168  Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
1169  Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
1170 
1171  Double_t vertexXNeg = xneg + TMath::Abs(negradius)*TMath::Cos(alphaNeg);
1172  Double_t vertexYNeg = yneg + TMath::Abs(negradius)*TMath::Sin(alphaNeg);
1173 
1174  Double_t vertexXPos = xpos + TMath::Abs(posradius)*TMath::Cos(alphaPos);
1175  Double_t vertexYPos = ypos + TMath::Abs(posradius)*TMath::Sin(alphaPos);
1176 
1177  AliExternalTrackParam p(*pparam);
1178  AliExternalTrackParam n(*nparam);
1179 
1180  TVector2 vertexPos(vertexXPos,vertexYPos);
1181  TVector2 vertexNeg(vertexXNeg,vertexYNeg);
1182 
1183  // Convert to local coordinate system
1184  TVector2 vertexPosRot=vertexPos.Rotate(-p.GetAlpha());
1185  TVector2 vertexNegRot=vertexNeg.Rotate(-n.GetAlpha());
1186 
1187  // Propagate Track Params to Vertex
1188 
1189  if(!p.PropagateTo(vertexPosRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
1190  if(!n.PropagateTo(vertexNegRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
1191 
1192  // Check whether propagation was sucessful
1193 
1194  if(TMath::Abs(vertexPos.Mod()-TMath::Sqrt(p.GetX()*p.GetX()+p.GetY()*p.GetY()))>0.01)return kFALSE;
1195  if(TMath::Abs(vertexNeg.Mod()-TMath::Sqrt(n.GetX()*n.GetX()+n.GetY()*n.GetY()))>0.01)return kFALSE;
1196 
1197  // Calculate z position
1198 
1199  convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
1200 
1201  // Calculate DCA
1202  TVector2 vdca=vertexPos-vertexNeg;
1203  dca[0]=vdca.Mod();
1204  dca[1]=TMath::Abs(n.GetZ()-p.GetZ());
1205 
1206  return kTRUE;
1207 }
1208 
1209 //________________________________________________________________________
1211 
1212  // Get reconstructed conversion photons from satellite AOD file
1213 
1214  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent);
1215 
1216  if(fAODEvent){
1217 
1218  if(fConversionGammas == NULL){
1219  fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);
1220  }
1221  fConversionGammas->Delete();//Reset the TClonesArray
1222 
1223  //Get Gammas from satellite AOD gamma branch
1224 
1225  AliAODConversionPhoton *gamma=0x0;
1226 
1227  TClonesArray *fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));
1228 
1229  if(!fInputGammas){
1230  FindDeltaAODBranchName();
1231  fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));}
1232  if(!fInputGammas){AliError("No Gamma Satellites found");return kFALSE;}
1233  // Apply Selection Cuts to Gammas and create local working copy
1234  if(fInputGammas){
1235  for(Int_t i=0;i<fInputGammas->GetEntriesFast();i++){
1236  gamma=dynamic_cast<AliAODConversionPhoton*>(fInputGammas->At(i));
1237  if(gamma){
1238  if(fRelabelAODs)RelabelAODPhotonCandidates(gamma);
1239  if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
1240  new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(*gamma);}
1241  }
1242  }
1243  }
1244  }
1245 
1246  if(fConversionGammas->GetEntries()){return kTRUE;}
1247 
1248  return kFALSE;
1249 }
1250 
1251 //________________________________________________________________________
1253 
1254  // Find delta AOD branchname containing reconstructed photons
1255 
1256  TList *list=fInputEvent->GetList();
1257  for(Int_t ii=0;ii<list->GetEntries();ii++){
1258  TString name((list->At(ii))->GetName());
1259  if(name.BeginsWith(fDeltaAODBranchName)&&name.EndsWith("gamma")){
1260  fDeltaAODBranchName=name;
1261  AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
1262  return;
1263  }
1264  }
1265 }
1266 
1267 //________________________________________________________________________
1269 
1270  if(fPreviousV0ReaderPerformsAODRelabeling == 2) return;
1271  else if(fPreviousV0ReaderPerformsAODRelabeling == 0){
1272  printf("Running AODs! Determine if V0Reader '%s' should perform relabeling\n",this->GetName());
1273  TObjArray* obj = (TObjArray*)AliAnalysisManager::GetAnalysisManager()->GetTasks();
1274  Int_t iPosition = obj->IndexOf(this);
1275  Bool_t prevV0ReaderRunningButNotRelabeling = kFALSE;
1276  for(Int_t i=iPosition-1; i>=0; i--){
1277  if( (obj->At(i))->IsA() == AliV0ReaderV1::Class()){
1278  AliV0ReaderV1* tempReader = (AliV0ReaderV1*) obj->At(i);
1279  if( tempReader->AreAODsRelabeled() && tempReader->IsReaderPerformingRelabeling() == 1){
1280  fPreviousV0ReaderPerformsAODRelabeling = 2;
1281  prevV0ReaderRunningButNotRelabeling = kFALSE;
1282  printf("V0Reader '%s' is running before this V0Reader '%s': do _NOT_ relabel AODs by current reader!\n",tempReader->GetName(),this->GetName());
1283  break;
1284  }else prevV0ReaderRunningButNotRelabeling = kTRUE;
1285  }
1286  }
1287  if(prevV0ReaderRunningButNotRelabeling) AliFatal(Form("There are V0Readers before '%s', but none of them is relabeling!",this->GetName()));
1288 
1289  if(fPreviousV0ReaderPerformsAODRelabeling == 2) return;
1290  else{
1291  printf("This V0Reader '%s' is first to be processed: do relabel AODs by current reader!\n",this->GetName());
1292  fPreviousV0ReaderPerformsAODRelabeling = 1;
1293  }
1294  }
1295 
1296  if(fPreviousV0ReaderPerformsAODRelabeling != 1) AliFatal(Form("In %s: fPreviousV0ReaderPerformsAODRelabeling = '%i' - while it should be impossible it is something different than '1'!",this->GetName(),fPreviousV0ReaderPerformsAODRelabeling));
1297 
1298  // Relabeling For AOD Event
1299  // ESDiD -> AODiD
1300  // MCLabel -> AODMCLabel
1301  Bool_t AODLabelPos = kFALSE;
1302  Bool_t AODLabelNeg = kFALSE;
1303 
1304  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
1305  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
1306  if(!AODLabelPos){
1307  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
1308  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
1309  PhotonCandidate->SetLabelPositive(i);
1310  AODLabelPos = kTRUE;
1311  }
1312  }
1313  if(!AODLabelNeg){
1314  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
1315  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
1316  PhotonCandidate->SetLabelNegative(i);
1317  AODLabelNeg = kTRUE;
1318  }
1319  }
1320  if(AODLabelNeg && AODLabelPos){
1321  return;
1322  }
1323  }
1324  if(!AODLabelPos || !AODLabelNeg){
1325  AliError(Form("NO AOD Daughters Found Pos: %i %i Neg: %i %i, setting all labels to -999999",AODLabelPos,PhotonCandidate->GetTrackLabelPositive(),AODLabelNeg,PhotonCandidate->GetTrackLabelNegative()));
1326  if(!AODLabelNeg){
1327  PhotonCandidate->SetMCLabelNegative(-999999);
1328  PhotonCandidate->SetLabelNegative(-999999);
1329  }
1330  if(!AODLabelPos){
1331  PhotonCandidate->SetMCLabelPositive(-999999);
1332  PhotonCandidate->SetLabelPositive(-999999);
1333  }
1334  }
1335 
1336 }
1337 
1338 //************************************************************************
1339 // This function counts the number of primary tracks in the event, the
1340 // implementation for ESD and AOD had to be different due to the different
1341 // filters which are already applied on AOD level the so-called filter
1342 // bits, we tried to replicate the conditions in both but an exact match
1343 // could not be reached. The cuts are similar to the ones used by the
1344 // jet-group
1345 //************************************************************************
1346 //________________________________________________________________________
1348 
1349  // In Case of MC count only MB tracks
1350  // if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
1351  // fEventCuts->GetNotRejectedParticles(1,NULL,fMCEvent);
1352  // }
1353  // if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
1354  // fEventCuts->GetNotRejectedParticles(1,NULL,fInputEvent);
1355  // }
1356 
1357  if(fInputEvent->IsA()==AliESDEvent::Class()){
1358  static AliESDtrackCuts *EsdTrackCuts = 0x0;
1359  static int prevRun = -1;
1360  // Using standard function for setting Cuts
1361  Int_t runNumber = fInputEvent->GetRunNumber();
1362 
1363  if (prevRun!=runNumber) {
1364  delete EsdTrackCuts;
1365  EsdTrackCuts = 0;
1366  prevRun = runNumber;
1367  }
1368  if (!EsdTrackCuts) {
1369  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
1370  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1371  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1372  // else if run2 data use 2015 PbPb cuts
1373  }else if (runNumber>=209122){
1374  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
1375  // else use 2011 version of track cuts
1376  }else{
1377  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1378  }
1379  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1380  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
1381  EsdTrackCuts->SetPtRange(0.15);
1382  }
1383  fNumberOfPrimaryTracks = 0;
1384  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1385  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1386  if(!curTrack) continue;
1387  if(!EsdTrackCuts->AcceptTrack(curTrack)) continue;
1388  //if(fMCEvent && !(fEventCuts->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()),fMCEvent->Stack(),fInputEvent))) continue;
1389  fNumberOfPrimaryTracks++;
1390  }
1391  }
1392  else if(fInputEvent->IsA()==AliAODEvent::Class()){
1393  fNumberOfPrimaryTracks = 0;
1394  for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
1395  AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
1396  if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
1397  if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
1398  if(TMath::Abs(curTrack->Eta())>0.8) continue;
1399  if(curTrack->Pt()<0.15) continue;
1400  //if(fMCEvent && !(fEventCuts->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()),NULL,fInputEvent))) continue;
1401  //if(TMath::Abs(curTrack->ZAtDCA())>2) continue; // Only Set For TPCOnly tracks
1402  fNumberOfPrimaryTracks++;
1403  }
1404  }
1405 
1406  return;
1407 }
1408 
1411  fNumberOfTPCoutTracks = 0;
1412 
1413  for (Int_t itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); itrk++) {
1414  AliVTrack *trk = dynamic_cast<AliVTrack*>(fInputEvent->GetTrack(itrk));
1415 
1416  if (trk != NULL) {
1417  /* the initial method of counting TPC out tracks */
1418  if (!(trk->Pt() < 0.15) && (TMath::Abs(trk->Eta()) < 0.8)) {
1419  if ((trk->GetStatus() & AliVTrack::kTPCout) == AliVTrack::kTPCout) {
1420  fNumberOfTPCoutTracks++;
1421  }
1422  }
1423  }
1424  }
1425 
1426 
1427  return;
1428 }
1429 
1431 Bool_t AliV0ReaderV1::ParticleIsConvertedPhoton(AliStack *MCStack, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax){
1432  // MonteCarlo Photon Selection
1433  if(!MCStack)return kFALSE;
1434 
1435  if (particle->GetPdgCode() == 22){
1436  // check whether particle is within eta range
1437  if( TMath::Abs(particle->Eta()) > etaMax ) return kFALSE;
1438  // check if particle doesn't have a photon as mother
1439  if(particle->GetMother(0) >-1 && MCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
1440  return kFALSE; // no photon as mothers!
1441  }
1442  // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
1443  TParticle* ePos = NULL;
1444  TParticle* eNeg = NULL;
1445  if(particle->GetNDaughters() >= 2){
1446  for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1447  if(daughterIndex<0) continue;
1448  TParticle *tmpDaughter = MCStack->Particle(daughterIndex);
1449  if(tmpDaughter->GetUniqueID() == 5){
1450  if(tmpDaughter->GetPdgCode() == 11){
1451  eNeg = tmpDaughter;
1452  } else if(tmpDaughter->GetPdgCode() == -11){
1453  ePos = tmpDaughter;
1454  }
1455  }
1456  }
1457  }
1458  if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
1459  return kFALSE;
1460  }
1461  // check if electrons are in correct eta window
1462  if( TMath::Abs(ePos->Eta()) > etaMax ||
1463  TMath::Abs(eNeg->Eta()) > etaMax )
1464  return kFALSE;
1465 
1466  // check if photons have converted in reconstructable range
1467  if(ePos->R() > rMax){
1468  return kFALSE; // cuts on distance from collision point
1469  }
1470  if(TMath::Abs(ePos->Vz()) > zMax){
1471  return kFALSE; // outside material
1472  }
1473  if(TMath::Abs(eNeg->Vz()) > zMax){
1474  return kFALSE; // outside material
1475  }
1476 
1477 
1478  Double_t lineCutZRSlope = tan(2*atan(exp(-etaMax)));
1479  Double_t lineCutZValue = 7.;
1480  if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * lineCutZRSlope) - lineCutZValue)){
1481  return kFALSE; // line cut to exclude regions where we do not reconstruct
1482  }
1483  if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * lineCutZRSlope) - lineCutZValue)){
1484  return kFALSE; // line cut to exclude regions where we do not reconstruct
1485  }
1486  if (ePos->Pt() < 0.05 || eNeg->Pt() < 0.05){
1487  return kFALSE;
1488  }
1489 
1490  return kTRUE;
1491  }
1492  return kFALSE;
1493 }
1494 
1497  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1498  Double_t mcProdVtxX = primVtxMC->GetX();
1499  Double_t mcProdVtxY = primVtxMC->GetY();
1500  Double_t mcProdVtxZ = primVtxMC->GetZ();
1501  //cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
1502 
1503  AliStack *fMCStack= fMCEvent->Stack();
1504  // Loop over all primary MC particle
1505  for(Long_t i = 0; i < fMCStack->GetNtrack(); i++) {
1506  if (fEventCuts->IsConversionPrimaryESD( fMCStack, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
1507  // fill primary histogram
1508  TParticle* particle = (TParticle *)fMCStack->Particle(i);
1509  if (!particle) continue;
1510  if (ParticleIsConvertedPhoton(fMCStack, particle, 0.9, 180.,250. )){
1511  if(particle->GetFirstDaughter()<0) continue;
1512  TParticle *tmpDaughter = fMCStack->Particle(particle->GetFirstDaughter());
1513  if (!tmpDaughter) continue;
1514  fHistoMCGammaPtvsR->Fill(particle->Pt(),tmpDaughter->R());
1515  fHistoMCGammaPtvsPhi->Fill(particle->Pt(),particle->Phi());
1516  fHistoMCGammaRvsPhi->Fill(tmpDaughter->R(),particle->Phi());
1517  }
1518  if (ParticleIsConvertedPhoton(fMCStack, particle, 1.4, 180.,250. )){
1519  if(particle->GetFirstDaughter()<0) continue;
1520  TParticle *tmpDaughter = fMCStack->Particle(particle->GetFirstDaughter());
1521  if (!tmpDaughter) continue;
1522  fHistoMCGammaPtvsEta->Fill(particle->Pt(),particle->Eta());
1523  fHistoMCGammaRvsEta->Fill(tmpDaughter->R(),particle->Eta());
1524  fHistoMCGammaPhivsEta->Fill(particle->Phi(),particle->Eta());
1525  }
1526  }
1527  }
1528 }
1529 
1532 
1533  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1534  Double_t mcProdVtxX = primVtxMC->GetX();
1535  Double_t mcProdVtxY = primVtxMC->GetY();
1536  Double_t mcProdVtxZ = primVtxMC->GetZ();
1537 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
1538 
1539  Int_t tracklabelPos=currentV0->GetPindex();
1540  Int_t tracklabelNeg=currentV0->GetNindex();
1541 
1542  AliStack *fMCStack= fMCEvent->Stack();
1543 
1544  Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,tracklabelPos)->GetLabel());
1545  Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,tracklabelNeg)->GetLabel());
1546 
1547  TParticle* negPart = 0x0;
1548  if(labeln>-1) negPart = (TParticle *)fMCStack->Particle(labeln);
1549  TParticle* posPart = 0x0;
1550  if(labelp>-1) posPart = (TParticle *)fMCStack->Particle(labelp);
1551 
1552  if ( negPart == NULL || posPart == NULL ) return;
1553 // if (!(negPart->GetPdgCode() == 11)) return;
1554 // if (!(posPart->GetPdgCode() == -11)) return;
1555  Long_t motherlabelNeg = negPart->GetFirstMother();
1556  Long_t motherlabelPos = posPart->GetFirstMother();
1557 
1558 // cout << "mother neg " << motherlabelNeg << " mother pos " << motherlabelPos << endl;
1559  if (motherlabelNeg>-1 && motherlabelNeg == motherlabelPos && negPart->GetFirstMother() != -1){
1560  if (fEventCuts->IsConversionPrimaryESD( fMCStack, negPart->GetFirstMother(), mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
1561 
1562  TParticle* mother = (TParticle *)fMCStack->Particle(motherlabelNeg);
1563  if (mother->GetPdgCode() == 22 ){
1564  if (!CheckVectorForDoubleCount(fVectorFoundGammas,motherlabelNeg ) ){
1565  if (ParticleIsConvertedPhoton(fMCStack, mother, 0.9, 180.,250. )){
1566  fHistoRecMCGammaPtvsR->Fill(mother->Pt(),negPart->R());
1567  fHistoRecMCGammaPtvsPhi->Fill(mother->Pt(),mother->Phi());
1568  fHistoRecMCGammaRvsPhi->Fill(negPart->R(),mother->Phi());
1569  }
1570  if (ParticleIsConvertedPhoton(fMCStack, mother, 1.4, 180.,250. )){
1571  fHistoRecMCGammaPtvsEta->Fill(mother->Pt(),mother->Eta());
1572  fHistoRecMCGammaRvsEta->Fill(negPart->R(),mother->Eta());
1573  fHistoRecMCGammaPhivsEta->Fill(mother->Phi(),mother->Eta());
1574  }
1575 // cout << "new gamma found" << endl;
1576  } else {
1577  if (ParticleIsConvertedPhoton(fMCStack, mother, 0.9, 180.,250. )){
1578  fHistoRecMCGammaMultiPt->Fill(mother->Pt());
1579  fHistoRecMCGammaMultiPhi->Fill(mother->Phi());
1580  fHistoRecMCGammaMultiR->Fill(negPart->R());
1581  }
1582  if (ParticleIsConvertedPhoton(fMCStack, mother, 1.4, 180.,250. )){
1583  fHistoRecMCGammaMultiPtvsEta->Fill(mother->Pt(),mother->Eta());
1584  }
1585 // cout << "this one I had already: " << motherlabelNeg << endl << "-----------------------" << endl;
1586  }
1587 // cout << "event gammas: " << endl;
1588 // for(Int_t iGamma=0; iGamma<fVectorFoundGammas.size(); iGamma++){cout << fVectorFoundGammas.at(iGamma) << ", ";}
1589  }
1590  }
1591  }
1592 }
1593 
1594 //_________________________________________________________________________________
1595 void AliV0ReaderV1::FillImpactParamHistograms( AliVTrack* pTrack, AliVTrack* nTrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF){
1596 
1597  // values of cuts to be introduced in 2016 to reduce ESD size
1598  Float_t fZmax = 25; //cm
1599  Float_t fYmax = 25; //cm
1600  Double_t kTPCMargin = 1.0; //cm
1601  Int_t kMaxTPCV0Conflicts = 1; //# conflicting clusters tolerated
1602 
1603  //conversion point
1604  Double_t convX, convY, convZ;
1605  fCurrentV0->GetXYZ(convX,convY,convZ);
1606  Double_t convR = TMath::Sqrt(convX*convX+convY*convY);
1607  //recalculated conversion point
1608  Double_t convXrecalc=fCurrentMotherKF->GetConversionX();
1609  Double_t convYrecalc=fCurrentMotherKF->GetConversionY();
1610  Double_t convZrecalc=fCurrentMotherKF->GetConversionZ();
1611  Double_t convRrecalc = fCurrentMotherKF->GetConversionRadius();
1612 
1613  //count V0s
1614  fHistoImpactParameterStudy->Fill(0);
1615 
1616  //count V0s with two TPC-only tracks
1617  AliESDtrack* positiveTrack = (AliESDtrack*) pTrack;
1618  AliESDtrack* negativeTrack = (AliESDtrack*) nTrack;
1619  Bool_t TPConly = kFALSE;
1620  if (!positiveTrack->IsOn(AliESDtrack::kITSin) && !negativeTrack->IsOn(AliESDtrack::kITSin)){
1621  fHistoImpactParameterStudy->Fill(1);
1622  TPConly = kTRUE;
1623  }
1624 
1625  Bool_t RemovedByZcut = kFALSE;
1626  Bool_t RemovedByYcut = kFALSE;
1627 
1628  //count V0s which have...
1629  if(TPConly){
1630  //not passed z cut: pos.tr. or neg.tr.
1631  if(((TMath::Abs(positiveTrack->GetZ()))>fZmax) || ((TMath::Abs(negativeTrack->GetZ()))>fZmax)){
1632  fHistoImpactParameterStudy->Fill(2);
1633  RemovedByZcut=kTRUE;
1634  }
1635 
1636  //not passed y cut: pos.tr. or neg.tr.
1637  if(((TMath::Abs(positiveTrack->GetY()))>fYmax) || ((TMath::Abs(negativeTrack->GetY()))>fYmax)){
1638  fHistoImpactParameterStudy->Fill(3);
1639  RemovedByYcut=kTRUE;
1640  }
1641  }
1642 
1643  //causality cut
1644  Bool_t RemovedByCausality=kFALSE;
1645  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
1646  const Float_t rTPC[159]={
1647  85.225, 85.975, 86.725, 87.475, 88.225, 88.975, 89.725, 90.475, 91.225, 91.975, 92.725, 93.475, 94.225, 94.975, 95.725,
1648  96.475, 97.225, 97.975, 98.725, 99.475,100.225,100.975,101.725,102.475,103.225,103.975,104.725,105.475,106.225,106.975,
1649  107.725,108.475,109.225,109.975,110.725,111.475,112.225,112.975,113.725,114.475,115.225,115.975,116.725,117.475,118.225,
1650  118.975,119.725,120.475,121.225,121.975,122.725,123.475,124.225,124.975,125.725,126.475,127.225,127.975,128.725,129.475,
1651  130.225,130.975,131.725,135.100,136.100,137.100,138.100,139.100,140.100,141.100,142.100,143.100,144.100,145.100,146.100,
1652  147.100,148.100,149.100,150.100,151.100,152.100,153.100,154.100,155.100,156.100,157.100,158.100,159.100,160.100,161.100,
1653  162.100,163.100,164.100,165.100,166.100,167.100,168.100,169.100,170.100,171.100,172.100,173.100,174.100,175.100,176.100,
1654  177.100,178.100,179.100,180.100,181.100,182.100,183.100,184.100,185.100,186.100,187.100,188.100,189.100,190.100,191.100,
1655  192.100,193.100,194.100,195.100,196.100,197.100,198.100,199.350,200.850,202.350,203.850,205.350,206.850,208.350,209.850,
1656  211.350,212.850,214.350,215.850,217.350,218.850,220.350,221.850,223.350,224.850,226.350,227.850,229.350,230.850,232.350,
1657  233.850,235.350,236.850,238.350,239.850,241.350,242.850,244.350,245.850};
1658 
1659  // fill conversion radius histograms
1660  fHistoR->Fill(convR);
1661  fHistoRrecalc->Fill(convRrecalc);
1662  Double_t alpha = TMath::ATan2(convY,convX);
1663  if (alpha<0) alpha += TMath::Pi()*2;
1664  Int_t sec = alpha/(TMath::Pi()/9);
1665  alpha = (10.+sec*20.)*TMath::DegToRad();
1666  Double_t cs = TMath::Cos(alpha);
1667  Double_t sn = TMath::Sin(alpha);
1668  Double_t xsV0 = convX*cs - convY*sn;
1669  fHistoRviaAlpha->Fill(xsV0);
1670  Double_t alpha_r = TMath::ATan2(convYrecalc,convXrecalc);
1671  if (alpha_r<0) alpha_r += TMath::Pi()*2;
1672  Int_t sec_r = alpha_r/(TMath::Pi()/9);
1673  alpha_r = (10.+sec_r*20.)*TMath::DegToRad();
1674  Double_t cs_r = TMath::Cos(alpha_r);
1675  Double_t sn_r = TMath::Sin(alpha_r);
1676  Double_t xsV0_r = convXrecalc*cs_r - convYrecalc*sn_r;
1677  fHistoRviaAlphaRecalc->Fill(xsV0_r);
1678 
1679  if (convR > 80) { // conversion within TPC <-> TPC-only tracks
1680  fHistoImpactParameterStudy->Fill(4);
1681 
1682  for (Int_t it=2;it--;) {
1683  Int_t trId = fCurrentV0->GetIndex(it);
1684  AliESDtrack* tr = fESDEvent->GetTrack(trId);
1685  const TBits& bits = tr->GetTPCClusterMap();
1686  Int_t nConflict = 0;
1687  for (Int_t ic=0;ic<159;ic++) {
1688  if (rTPC[ic]>(xsV0-kTPCMargin)) break;
1689  if (bits.TestBitNumber(ic)){
1690  nConflict++;
1691  fHistoRdiff->Fill(xsV0-rTPC[ic]);
1692  }
1693  if (nConflict>kMaxTPCV0Conflicts) {
1694  fHistoImpactParameterStudy->Fill(5);
1695  RemovedByCausality=kTRUE;
1696  break;
1697  }
1698  }
1699  }
1700  }
1701 
1702  //not passed y or z o causality cut:
1703  Bool_t RemovedByAnyCut=kFALSE;
1704  if(RemovedByZcut||RemovedByYcut||RemovedByCausality){
1705  fHistoImpactParameterStudy->Fill(6);
1706  RemovedByAnyCut=kTRUE;
1707  }
1708 
1709  //Fill tree for further analysis
1710  Float_t posZ;
1711  Float_t posY;
1712  Float_t posX;
1713  Float_t posPt;
1714  Float_t negZ;
1715  Float_t negY;
1716  Float_t negX;
1717  Float_t negPt;
1718  Float_t R;
1719  TBranch *Branch_Pt = fImpactParamTree->Branch("posPt",&posPt,"posPt/F");
1720  TBranch *Branch_Y = fImpactParamTree->Branch("posY",&posY,"posY/F");
1721  TBranch *Branch_R = fImpactParamTree->Branch("R",&R,"R/F");
1722  posZ = positiveTrack->GetZ();
1723  posY = positiveTrack->GetY();
1724  posX = positiveTrack->GetX();
1725  posPt = positiveTrack->Pt();
1726  negZ = negativeTrack->GetZ();
1727  negY = negativeTrack->GetY();
1728  negX = negativeTrack->GetX();
1729  negPt = negativeTrack->Pt();
1730  R=convRrecalc;
1731  fImpactParamTree->Fill();
1732 
1733  // fill impact parameter histograms
1734  fHistoPosTrackImpactParamZ->Fill(posZ);
1735  fHistoPosTrackImpactParamY->Fill(posY);
1736  fHistoPosTrackImpactParamX->Fill(posX);
1737  fHistoPosTrackImpactParamZvsPt->Fill(posPt, posZ);
1738  fHistoPosTrackImpactParamYvsPt->Fill(posPt, posY);
1739  fHistoPosTrackImpactParamXvsPt->Fill(posPt, posX);
1740  fHistoNegTrackImpactParamZ->Fill(negZ);
1741  fHistoNegTrackImpactParamY->Fill(negY);
1742  fHistoNegTrackImpactParamX->Fill(negX);
1743  fHistoNegTrackImpactParamZvsPt->Fill(negPt, negZ);
1744  fHistoNegTrackImpactParamYvsPt->Fill(negPt, negY);
1745  fHistoNegTrackImpactParamXvsPt->Fill(negPt, negX);
1746 
1747  // fill comparison histos before / after new cuts
1748  fHistoPt->Fill(positiveTrack->Pt());
1749  fHistoImpactParamZvsR->Fill(convZrecalc,convRrecalc);
1750  //Float_t *DCAzPhoton;
1751  Float_t DCAzPhoton;
1752  //const AliVVertex *PrimVertex = fInputEvent->GetPrimaryVertex();
1753  AliAODConversionPhoton* fCurrentMother=(AliAODConversionPhoton*)fCurrentMotherKF;
1754  //AliAODConversionPhoton *fCurrentMother=dynamic_cast<AliAODConversionPhoton*>(fCurrentMotherKF);
1755  //fCurrentMotherKF->GetDistanceOfClossetApproachToPrimVtx(PrimVertex, DCAzPhoton);
1756  DCAzPhoton = fCurrentMother->GetDCAzToPrimVtx();
1757  fHistoDCAzPhoton->Fill(DCAzPhoton);
1758  if(!RemovedByAnyCut) {
1759  fHistoPt2->Fill(positiveTrack->Pt());
1760  fHistoImpactParamZvsR2->Fill(convZrecalc,convRrecalc);
1761  fHistoDCAzPhoton2->Fill(DCAzPhoton);
1762  }
1763 
1764  return;
1765 }
1766 
1767 //_________________________________________________________________________________
1768 Bool_t AliV0ReaderV1::CheckVectorOnly(vector<Int_t> &vec, Int_t tobechecked)
1769 {
1770  if(tobechecked > -1)
1771  {
1772  vector<Int_t>::iterator it;
1773  it = find (vec.begin(), vec.end(), tobechecked);
1774  if (it != vec.end()) return true;
1775  else return false;
1776  }
1777  return false;
1778 }
1779 
1780 //_________________________________________________________________________________
1782 {
1783  if(tobechecked > -1)
1784  {
1785  vector<Int_t>::iterator it;
1786  it = find (vec.begin(), vec.end(), tobechecked);
1787  if (it != vec.end()) return true;
1788  else{
1789  vec.push_back(tobechecked);
1790  return false;
1791  }
1792  }
1793  return false;
1794 }
1795 
1796 //________________________________________________________________________
1798 {
1799 
1800 }
1801 
1803  std::iterator<std::bidirectional_iterator_tag, AliConversionPhotonBase>(),
1804  fkData(reader),
1805  fCurrentIndex(position),
1806  fDirection(dir)
1807 {
1808 }
1809 
1811  std::iterator<std::bidirectional_iterator_tag, AliConversionPhotonBase>(other),
1812  fkData(other.fkData),
1813  fCurrentIndex(other.fCurrentIndex),
1814  fDirection(other.fDirection)
1815 {
1816 }
1817 
1819  if(this != &other){
1820  fkData = other.fkData;
1821  fCurrentIndex = other.fCurrentIndex;
1822  fDirection = other.fDirection;
1823  }
1824  return *this;
1825 }
1826 
1828  if(fkData != other.fkData) return true;
1829  return fCurrentIndex != other.fCurrentIndex;
1830 }
1831 
1833  iterator tmp(*this);
1834  operator++();
1835  return tmp;
1836 }
1837 
1840  fCurrentIndex++;
1841  } else {
1842  fCurrentIndex--;
1843  }
1844  return *this;
1845 }
1846 
1848  iterator tmp(*this);
1849  operator--();
1850  return tmp;
1851 }
1852 
1855  fCurrentIndex++;
1856  } else {
1857  fCurrentIndex--;
1858  }
1859  return *this;
1860 }
1861 
1863  return (*fkData)[fCurrentIndex];
1864 }
Int_t IsReaderPerformingRelabeling()
Int_t charge
Direction_t fDirection
Iterator in forward direction.
Definition: AliV0ReaderV1.h:60
void FillAODOutput()
double Double_t
Definition: External.C:58
anchored LHC13[d-e] pass 2 - JJ
Definition: External.C:236
void FindDeltaAODBranchName()
void SetConversionPoint(Double_t convpoint[3])
Bool_t CheckVectorForDoubleCount(vector< Int_t > &vec, Int_t tobechecked)
void SetMCLabelNegative(Int_t label)
Bool_t AreAODsRelabeled()
const AliV0ReaderV1 * fkData
V0 reader used to iterate over.
Definition: AliV0ReaderV1.h:58
void CreatePureMCHistosForV0FinderEffiESD()
Double_t mass
TList * list
TDirectory file where lists per trigger are stored in train ouput.
AliConversionPhotonBase * operator*()
Float_t GetDCAzToPrimVtx() const
virtual void Init()
Bool_t ParticleIsConvertedPhoton(AliStack *MCStack, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax)
Double_t GetPsiPair(const AliESDv0 *v0, const AliExternalTrackParam *positiveparam, const AliExternalTrackParam *negativeparam, const Double_t convpos[3]) const
void FillRecMCHistosForV0FinderEffiESD(AliESDv0 *currentV0)
Bool_t CheckVectorOnly(vector< Int_t > &vec, Int_t tobechecked)
anchored LHC13g pass 1 - JJ
anchored LHC13g pass 1 - JJ
ClassImp(AliV0ReaderV1) AliV0ReaderV1
int fCurrentIndex
Index of the current element.
Definition: AliV0ReaderV1.h:59
int Int_t
Definition: External.C:63
virtual ~AliV0ReaderV1()
Bool_t ProcessEvent(AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL)
float Float_t
Definition: External.C:68
void SetMCLabelPositive(Int_t label)
void ConstructGamma(const AliKFParticle &fCurrentNegativeKFParticle, const AliKFParticle &fCurrentPositiveKFParticle)
void SetInvMassPair(Float_t mass)
iterator(const AliV0ReaderV1 *reader, Direction_t dir, int position)
Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t center[2])
void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate)
anchored LHC12[a-h] pass 2 - JJ
void SetChi2perNDF(Float_t chi2)
void CountTPCoutTracks()
anchored LHC13[d-e] pass 2 - GJ
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
virtual Bool_t Notify()
iterator & operator=(const iterator &other)
anchored LHC13[d-e] pass 2 - JJ
void SetTrackLabels(Int_t label1, Int_t label2)
anchored LHC11a pass 4 - JJ
virtual void Terminate(Option_t *)
const AliExternalTrackParam * GetExternalTrackParam(AliESDv0 *fCurrentV0, Int_t &tracklabel, Int_t charge)
anchored LHC13g pass 1 - JJ
AliKFConversionPhoton * ReconstructV0(AliESDv0 *fCurrentV0, Int_t currentV0Index)
void SetLabelPositive(Int_t label)
Track labels.
void SetLabelNegative(Int_t label)
bool operator!=(iterator &other) const
TFile * file
TList with histograms for a given trigger.
anchored LHC12[a-h] pass 2 - JJ - additional stat
void SetPsiPair(Float_t PsiPair)
void FillImpactParamHistograms(AliVTrack *ptrack, AliVTrack *ntrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF)
AliConversionPhotonBase * operator[](int index) const
Array index operator.
const char Option_t
Definition: External.C:48
anchored LHC11a pass 4 - JJ
Bool_t ProcessESDV0s()
bool Bool_t
Definition: External.C:53
Bool_t GetConversionPoint(const AliExternalTrackParam *pparam, const AliExternalTrackParam *nparam, Double_t convpos[3], Double_t dca[2])
Bool_t GetAODConversionGammas()
void UserCreateOutputObjects()
virtual void UserExec(Option_t *option)
Double_t GetConversionRadius() const
TDirectoryFile * dir