AliPhysics  a3be53f (a3be53f)
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 "AliMCEventHandler.h"
53 #include "AliESDpid.h"
54 #include "AliESDtrackCuts.h"
55 #include "TRandom3.h"
56 #include "AliGenCocktailEventHeader.h"
57 #include "TList.h"
58 #include "AliKFConversionPhoton.h"
59 #include "AliAODConversionPhoton.h"
61 #include "TVector.h"
62 #include "AliKFVertex.h"
63 #include "AliAODTrack.h"
64 #include "AliESDtrack.h"
65 #include "AliAnalysisManager.h"
66 #include "AliInputEventHandler.h"
67 #include "AliAODHandler.h"
68 #include "AliAODMCParticle.h"
69 #include "AliPIDResponse.h"
70 #include "TChain.h"
71 #include "TFile.h"
72 #include "TString.h"
73 #include "TMatrixD.h"
74 #include "TMatrixDEigen.h"
75 #include "TObjArray.h"
76 
77 class iostream;
78 
79 using namespace std;
80 
81 ClassImp(AliV0ReaderV1)
82 
83 //________________________________________________________________________
84 AliV0ReaderV1::AliV0ReaderV1(const char *name) : AliAnalysisTaskSE(name),
85  kAddv0sInESDFilter(kFALSE),
86  fPCMv0BitField(NULL),
87  fConversionCuts(NULL),
88  fEventCuts(NULL),
89  fConversionGammas(NULL),
90  fUseImprovedVertex(kTRUE),
91  fUseOwnXYZCalculation(kTRUE),
92  fUseConstructGamma(kFALSE),
93  kUseAODConversionPhoton(kTRUE),
94  fCreateAOD(kFALSE),
95  fDeltaAODBranchName("GammaConv"),
96  fDeltaAODFilename("AliAODGammaConversion.root"),
97  fRelabelAODs(kFALSE),
98  fPreviousV0ReaderPerformsAODRelabeling(0),
99  fEventIsSelected(kFALSE),
100  fNumberOfPrimaryTracks(0),
101  fNumberOfTPCoutTracks(0),
102  fSphericity(0),
103  fSphericityAxisMainPhi(0),
104  fSphericityAxisSecondaryPhi(0),
105  fInEMCalAcceptance(kFALSE),
106  fNumberOfRecTracks(0),
107  fSphericityTrue(0),
108  fNumberOfTruePrimaryTracks(0),
109  fPtMaxSector(0),
110  fCalcSphericity(kFALSE),
111  fCalcSector(kFALSE),
112  fPeriodName(""),
113  fPtHardBin(0),
114  fUseMassToZero(kTRUE),
115  fProduceV0findingEffi(kFALSE),
116  fProduceImpactParamHistograms(kFALSE),
117  fCurrentInvMassPair(0),
118  fImprovedPsiPair(3),
119  fHistograms(NULL),
120  fImpactParamHistograms(NULL),
121  fHistoMCGammaPtvsR(NULL),
122  fHistoMCGammaPtvsPhi(NULL),
123  fHistoMCGammaPtvsEta(NULL),
124  fHistoMCGammaRvsPhi(NULL),
125  fHistoMCGammaRvsEta(NULL),
126  fHistoMCGammaPhivsEta(NULL),
127  fHistoRecMCGammaPtvsR(NULL),
128  fHistoRecMCGammaPtvsPhi(NULL),
129  fHistoRecMCGammaPtvsEta(NULL),
130  fHistoRecMCGammaRvsPhi(NULL),
131  fHistoRecMCGammaRvsEta(NULL),
132  fHistoRecMCGammaPhivsEta(NULL),
133  fHistoRecMCGammaMultiPt(NULL),
134  fHistoRecMCGammaMultiPtvsEta(NULL),
135  fHistoRecMCGammaMultiR(NULL),
136  fHistoRecMCGammaMultiPhi(NULL),
137  fHistoPosTrackImpactParamZ(NULL),
138  fHistoPosTrackImpactParamY(NULL),
139  fHistoPosTrackImpactParamX(NULL),
140  fHistoPosTrackImpactParamZvsPt(NULL),
141  fHistoPosTrackImpactParamYvsPt(NULL),
142  fHistoPosTrackImpactParamXvsPt(NULL),
143  fHistoNegTrackImpactParamZ(NULL),
144  fHistoNegTrackImpactParamY(NULL),
145  fHistoNegTrackImpactParamX(NULL),
146  fHistoNegTrackImpactParamZvsPt(NULL),
147  fHistoNegTrackImpactParamYvsPt(NULL),
148  fHistoNegTrackImpactParamXvsPt(NULL),
149  fHistoImpactParamZvsR(NULL),
150  fHistoImpactParamZvsR2(NULL),
151  fHistoPt(NULL),
152  fHistoPt2(NULL),
153  fHistoDCAzPhoton(NULL),
154  fHistoDCAzPhoton2(NULL),
155  fHistoR(NULL),
156  fHistoRrecalc(NULL),
157  fHistoRviaAlpha(NULL),
158  fHistoRviaAlphaRecalc(NULL),
159  fHistoRdiff(NULL),
160  fHistoImpactParameterStudy(NULL),
161  fImpactParamTree(NULL),
162  fVectorFoundGammas(0),
163  fCurrentFileName(""),
164  fMCFileChecked(kFALSE)
165 {
166  // Default constructor
167 
168  DefineInput(0, TChain::Class());
169  DefineOutput(1,TBits::Class());
170 }
171 
172 //________________________________________________________________________
174 {
175  // default deconstructor
176 
177  if(fConversionGammas){
178  fConversionGammas->Delete();// Clear Objects
179  delete fConversionGammas;
180  fConversionGammas=0x0;
181  }
182 }
183 
193  if(fConversionGammas && (index < fConversionGammas->GetEntriesFast())) {
194  TObject *tmp = fConversionGammas->At(index);
195  if(tmp->IsA() == AliAODConversionPhoton::Class()){
196  AliAODConversionPhoton *photon = static_cast<AliAODConversionPhoton *>(tmp);
197  return photon;
198  } else {
199  AliKFConversionPhoton *photon = static_cast<AliKFConversionPhoton *>(tmp);
200  return photon;
201  }
202  } else {
203  return nullptr;
204  }
205 }
206 
207 /*
208 //________________________________________________________________________
209 AliV0ReaderV1::AliV0ReaderV1(AliV0ReaderV1 &original) : AliAnalysisTaskSE(original),
210 fConversionCuts(NULL),
211 fConversionGammas(NULL),
212 fUseImprovedVertex(original.fUseImprovedVertex),
213 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
214 fUseConstructGamma(original.fUseConstructGamma),
215 kUseAODConversionPhoton(original.kUseAODConversionPhoton),
216 fCreateAOD(original.fCreateAOD),
217 fDeltaAODBranchName(original.fDeltaAODBranchName),
218 fDeltaAODFilename(original.fDeltaAODFilename),
219 fEventIsSelected(original.fEventIsSelected)
220 {
221 // Default constructor
222 
223 DefineInput(0, TChain::Class());
224 }
225 
226 //____________________________________________________________
227 AliV0ReaderV1 &AliV0ReaderV1::operator=(const AliV0ReaderV1 &ref){
228 //
229 // Assignment operator
230 // Only copies pointers, object is not the owner of the references
231 //
232 if(this != &ref){
233 AliAnalysisTaskSE::operator=(ref);
234 fUseImprovedVertex=ref.fUseImprovedVertex;
235 fUseOwnXYZCalculation=ref.fUseOwnXYZCalculation;
236 fUseConstructGamma=ref.fUseConstructGamma;
237 kUseAODConversionPhoton=ref.kUseAODConversionPhoton;
238 fCreateAOD=ref.fCreateAOD;
239 fDeltaAODBranchName=ref.fDeltaAODBranchName;
240 fDeltaAODFilename=ref.fDeltaAODFilename;
241 fEventIsSelected=ref.fEventIsSelected;
242 }
243 return *this;
244 }
245 */
246 
247 //________________________________________________________________________
249 {
250  // Initialize function to be called once before analysis
251  if(fConversionCuts==NULL){
252  if(fConversionCuts==NULL)AliError("No Conversion Cut Selection initialized");
253  }
254  if(fEventCuts==NULL){
255  if(fEventCuts==NULL)AliError("No Event Cut Selection initialized");
256  }
257 
258  if(fCreateAOD){kUseAODConversionPhoton=kTRUE;}
259 
260  if(fConversionGammas != NULL){
261  delete fConversionGammas;
262  fConversionGammas=NULL;
263  }
264 
265  if(fConversionGammas == NULL){
266  if(kUseAODConversionPhoton){
267  fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);}
268  else{
269  fConversionGammas = new TClonesArray("AliKFConversionPhoton",100);}
270  }
271  fConversionGammas->Delete();//Reset the TClonesArray
272 }
273 
274 //________________________________________________________________________
276 {
277  // Create AODs
278 
279  if(fCreateAOD){
280  fPCMv0BitField = new TBits();
281 
282  if (fEventCuts){
283  fDeltaAODBranchName.Append("_");
284  fDeltaAODBranchName.Append(fEventCuts->GetCutNumber());
285  }
286  if(fConversionCuts){
287  fDeltaAODBranchName.Append("_");
288  fDeltaAODBranchName.Append(fConversionCuts->GetCutNumber());
289  fDeltaAODBranchName.Append("_gamma");
290  }
291  fConversionGammas->SetName(fDeltaAODBranchName.Data());
292 
293  AddAODBranch("TClonesArray", &fConversionGammas, fDeltaAODFilename.Data());
294  AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFilename.Data());
295  }
296 
297  if(fProduceImpactParamHistograms){
298  if(fImpactParamHistograms != NULL){
299  delete fImpactParamHistograms;
300  fImpactParamHistograms = NULL;
301  }
302  if(fImpactParamHistograms==NULL){
303  fImpactParamHistograms = new TList();
304  fImpactParamHistograms->SetOwner(kTRUE);
305  fImpactParamHistograms->SetName(Form("ImpactParamHistograms_%s_%s",fEventCuts->GetCutNumber().Data(),fConversionCuts->GetCutNumber().Data()));
306  }
307  fHistoPosTrackImpactParamZ = new TH1F("fHistoPosTrackImpactParamZ","",480,-80,80);
308  fHistoPosTrackImpactParamZ->SetXTitle("Z (cm)");
309  fImpactParamHistograms->Add(fHistoPosTrackImpactParamZ);
310 
311  fHistoPosTrackImpactParamY = new TH1F("fHistoPosTrackImpactParamY","",720,-120,120);
312  fHistoPosTrackImpactParamY->SetXTitle("Y (cm)");
313  fImpactParamHistograms->Add(fHistoPosTrackImpactParamY);
314 
315  fHistoPosTrackImpactParamX = new TH1F("fHistoPosTrackImpactParamX","",30,-3,3);
316  fHistoPosTrackImpactParamX->SetXTitle("X (cm)");
317  fImpactParamHistograms->Add(fHistoPosTrackImpactParamX);
318 
319  fHistoNegTrackImpactParamZ = new TH1F("fHistoNegTrackImpactParamZ","",480,-80,80);
320  fHistoNegTrackImpactParamZ->SetXTitle("Z (cm)");
321  fImpactParamHistograms->Add(fHistoNegTrackImpactParamZ);
322 
323  fHistoNegTrackImpactParamY = new TH1F("fHistoNegTrackImpactParamY","",720,-120,120);
324  fHistoNegTrackImpactParamY->SetXTitle("Y (cm)");
325  fImpactParamHistograms->Add(fHistoNegTrackImpactParamY);
326 
327  fHistoNegTrackImpactParamX = new TH1F("fHistoNegTrackImpactParamX","",30,-3,3);
328  fHistoNegTrackImpactParamX->SetXTitle("X (cm)");
329  fImpactParamHistograms->Add(fHistoNegTrackImpactParamX);
330 
331  fHistoPosTrackImpactParamZvsPt = new TH2F("fHistoPosTrackImpactParamZvsPt","",100,0,10,480,-80,80);
332  fHistoPosTrackImpactParamZvsPt->SetYTitle("Z (cm)");
333  fHistoPosTrackImpactParamZvsPt->SetXTitle("Pt (GeV)");
334  fImpactParamHistograms->Add(fHistoPosTrackImpactParamZvsPt);
335 
336  fHistoPosTrackImpactParamYvsPt = new TH2F("fHistoPosTrackImpactParamYvsPt","",100,0,10,720,-120,120);
337  fHistoPosTrackImpactParamYvsPt->SetYTitle("Y (cm)");
338  fHistoPosTrackImpactParamYvsPt->SetXTitle("Pt (GeV)");
339  fImpactParamHistograms->Add(fHistoPosTrackImpactParamYvsPt);
340 
341  fHistoPosTrackImpactParamXvsPt = new TH2F("fHistoPosTrackImpactParamXvsPt","",100,0,10,30,-3,5);
342  fHistoPosTrackImpactParamXvsPt->SetYTitle("X (cm)");
343  fHistoPosTrackImpactParamXvsPt->SetXTitle("Pt (GeV)");
344  fImpactParamHistograms->Add(fHistoPosTrackImpactParamXvsPt);
345 
346  fHistoNegTrackImpactParamZvsPt = new TH2F("fHistoNegTrackImpactParamZvsPt","",100,0,10,480,-80,80);
347  fHistoNegTrackImpactParamZvsPt->SetYTitle("Z (cm)");
348  fHistoNegTrackImpactParamZvsPt->SetXTitle("Pt (GeV)");
349  fImpactParamHistograms->Add(fHistoNegTrackImpactParamZvsPt);
350 
351  fHistoNegTrackImpactParamYvsPt = new TH2F("fHistoNegTrackImpactParamYvsPt","",100,0,10,720,-120,120);
352  fHistoNegTrackImpactParamYvsPt->SetYTitle("Y (cm)");
353  fHistoNegTrackImpactParamYvsPt->SetXTitle("Pt (GeV)");
354  fImpactParamHistograms->Add(fHistoNegTrackImpactParamYvsPt);
355 
356  fHistoNegTrackImpactParamXvsPt = new TH2F("fHistoNegTrackImpactParamXvsPt","",100,0,10,30,-3,3);
357  fHistoNegTrackImpactParamXvsPt->SetYTitle("X (cm)");
358  fHistoNegTrackImpactParamXvsPt->SetXTitle("Pt (GeV)");
359  fImpactParamHistograms->Add(fHistoNegTrackImpactParamXvsPt);
360 
361  fHistoImpactParamZvsR = new TH2F("fHistoImpactParamZvsR","Before cuts",300,-150,150,200,0,200);
362  fHistoImpactParamZvsR->SetXTitle("Z (cm)");
363  fHistoImpactParamZvsR->SetYTitle("R (cm)");
364  fImpactParamHistograms->Add(fHistoImpactParamZvsR);
365 
366  fHistoImpactParamZvsR2 = new TH2F("fHistoImpactParamZvsR2","After cuts",300,-150,150,200,0,200);
367  fHistoImpactParamZvsR2->SetXTitle("Z (cm)");
368  fHistoImpactParamZvsR2->SetYTitle("R (cm)");
369  fImpactParamHistograms->Add(fHistoImpactParamZvsR2);
370 
371  fHistoPt = new TH1F("fHistoPt","Before all cuts",100,0,10);
372  fHistoPt->SetXTitle("Pt (GeV)");
373  fImpactParamHistograms->Add(fHistoPt);
374 
375  fHistoPt2 = new TH1F("fHistoPt2","After all cuts",100,0,10);
376  fHistoPt2->SetXTitle("Pt (GeV)");
377  fImpactParamHistograms->Add(fHistoPt2);
378 
379  fHistoDCAzPhoton = new TH1F("fHistoDCAzPhoton","Before cuts",20,-2,2);
380  fHistoDCAzPhoton->SetXTitle("DCAz photon (cm)");
381  fImpactParamHistograms->Add(fHistoDCAzPhoton);
382 
383  fHistoDCAzPhoton2 = new TH1F("fHistoDCAzPhoton2","After cuts",20,-2,2);
384  fHistoDCAzPhoton2->SetXTitle("DCAz photon (cm)");
385  fImpactParamHistograms->Add(fHistoDCAzPhoton2);
386 
387  fHistoR = new TH1F("fHistoR","",200,0,200);
388  fHistoR->SetXTitle("Conversion radius (cm)");
389  fImpactParamHistograms->Add(fHistoR);
390 
391  fHistoRrecalc = new TH1F("fHistoRrecalc","",200,0,200);
392  fHistoRrecalc->SetXTitle("conversion radius (cm)");
393  fImpactParamHistograms->Add(fHistoRrecalc);
394 
395  fHistoRviaAlpha = new TH1F("fHistoRviaAlpha","",200,0,200);
396  fHistoRviaAlpha->SetXTitle("Conversion radius (cm)");
397  fImpactParamHistograms->Add(fHistoRviaAlpha);
398 
399  fHistoRviaAlphaRecalc = new TH1F("fHistoRviaAlphaRecalc","",200,0,200);
400  fHistoRviaAlphaRecalc->SetXTitle("conversion radius (cm)");
401  fImpactParamHistograms->Add(fHistoRviaAlphaRecalc);
402 
403  fHistoRdiff = new TH1F("fHistoRdiff","",200,0,200);
404  fHistoRdiff->SetXTitle("R_conv - R_cluster conflict (cm)");
405  fImpactParamHistograms->Add(fHistoRdiff);
406 
407  fHistoImpactParameterStudy = new TH1F("fHistoImpactParameterStudy","",7,-0.5,6.5);
408  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(1,"# V0s");
409  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(2,"two TPC-only tracks");
410  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(3,"Z cut not passed");
411  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(4,"Y cut not passed");
412  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(5,"R>80cm");
413  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(6,"causality cut not p.");
414  fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(7,"# removed V0s"); // of all V0s
415  fImpactParamHistograms->Add(fHistoImpactParameterStudy);
416 
417  fImpactParamTree = new TTree("fImpactParamTree","");
418  fImpactParamHistograms->Add(fImpactParamTree);
419  }
420 
421  if (fProduceV0findingEffi){
422  TH1::AddDirectory(kFALSE);
423  if(fHistograms != NULL){
424  delete fHistograms;
425  fHistograms = NULL;
426  }
427  if(fHistograms==NULL){
428  fHistograms = new TList();
429  fHistograms->SetOwner(kTRUE);
430  fHistograms->SetName(Form("V0FindingEfficiencyInput_%s_%s",fEventCuts->GetCutNumber().Data(),fConversionCuts->GetCutNumber().Data()));
431  }
432 
433  fHistoMCGammaPtvsR = new TH2F("MCconvGamma_Pt_R","MC converted gamma Pt vs R (|eta| < 0.9)",250,0.0,25,400,0,200);
434  fHistoMCGammaPtvsR->SetXTitle("p_{MC,T} (GeV/c)");
435  fHistoMCGammaPtvsR->SetYTitle("R_{MC,conv} (cm)");
436  fHistograms->Add(fHistoMCGammaPtvsR);
437 
438  fHistoMCGammaPtvsEta = new TH2F("MCconvGamma_Pt_Eta","MC converted gamma Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
439  fHistoMCGammaPtvsEta->SetXTitle("p_{MC,T} (GeV/c)");
440  fHistoMCGammaPtvsEta->SetYTitle("#eta_{MC}");
441  fHistograms->Add(fHistoMCGammaPtvsEta);
442 
443  fHistoMCGammaPtvsPhi = new TH2F("MCconvGamma_Pt_Phi","MC converted gamma Pt vs Phi (|eta| < 0.9) ",250,0.0,25,400,0,2*TMath::Pi());
444  fHistoMCGammaPtvsPhi->SetXTitle("p_{MC,T} (GeV/c)");
445  fHistoMCGammaPtvsPhi->SetYTitle("#varphi_{MC} (rad)");
446  fHistograms->Add(fHistoMCGammaPtvsPhi);
447 
448  fHistoMCGammaRvsPhi = new TH2F("MCconvGamma_R_Phi","MC converted gamma R vs Phi (|eta| < 0.9) ",400,0,200,400,0,2*TMath::Pi());
449  fHistoMCGammaRvsPhi->SetXTitle("R_{MC,conv} (cm)");
450  fHistoMCGammaRvsPhi->SetYTitle("#varphi_{MC} (rad)");
451  fHistograms->Add(fHistoMCGammaRvsPhi);
452 
453  fHistoMCGammaRvsEta = new TH2F("MCconvGamma_R_Eta","MC converted gamma R vs Eta ",400,0,200,280,-1.4,1.4);
454  fHistoMCGammaRvsEta->SetXTitle("R_{MC,conv} (cm)");
455  fHistoMCGammaRvsEta->SetYTitle("#eta_{MC}");
456  fHistograms->Add(fHistoMCGammaRvsEta);
457 
458  fHistoMCGammaPhivsEta = new TH2F("MCconvGamma_Phi_Eta","MC converted gamma Phi vs Eta ",400,0,2*TMath::Pi(),280,-1.4,1.4);
459  fHistoMCGammaPhivsEta->SetXTitle("#phi_{MC} (rad)");
460  fHistoMCGammaPhivsEta->SetYTitle("#eta_{MC}");
461  fHistograms->Add(fHistoMCGammaPhivsEta);
462 
463  fHistoRecMCGammaPtvsR = new TH2F("RecMCconvGamma_Pt_R","rec MC converted gamma Pt vs R (|eta| < 0.9)",250,0.0,25,400,0,200);
464  fHistoRecMCGammaPtvsR->SetXTitle("p_{MC,T} (GeV/c)");
465  fHistoRecMCGammaPtvsR->SetYTitle("R_{MC,conv} (cm)");
466  fHistograms->Add(fHistoRecMCGammaPtvsR);
467 
468  fHistoRecMCGammaPtvsEta = new TH2F("RecMCconvGamma_Pt_Eta","rec MC converted gamma Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
469  fHistoRecMCGammaPtvsEta->SetXTitle("p_{MC,T} (GeV/c)");
470  fHistoRecMCGammaPtvsEta->SetYTitle("#eta_{MC}");
471  fHistograms->Add(fHistoRecMCGammaPtvsEta);
472 
473  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());
474  fHistoRecMCGammaPtvsPhi->SetXTitle("p_{MC,T} (GeV/c)");
475  fHistoRecMCGammaPtvsPhi->SetYTitle("#varphi_{MC} (rad)");
476  fHistograms->Add(fHistoRecMCGammaPtvsPhi);
477 
478  fHistoRecMCGammaRvsPhi = new TH2F("RecMCconvGamma_R_Phi","rec MC converted gamma R vs Phi (|eta| < 0.9) ",400,0,200,400,0,2*TMath::Pi());
479  fHistoRecMCGammaRvsPhi->SetXTitle("R_{MC,conv} (cm)");
480  fHistoRecMCGammaRvsPhi->SetYTitle("#varphi_{MC} (rad)");
481  fHistograms->Add(fHistoRecMCGammaRvsPhi);
482 
483  fHistoRecMCGammaRvsEta = new TH2F("RecMCconvGamma_R_Eta","rec MC converted gamma R vs Eta ",400,0,200,280,-1.4,1.4);
484  fHistoRecMCGammaRvsEta->SetXTitle("R_{MC,conv} (cm)");
485  fHistoRecMCGammaRvsEta->SetYTitle("#eta_{MC}");
486  fHistograms->Add(fHistoRecMCGammaRvsEta);
487 
488  fHistoRecMCGammaPhivsEta = new TH2F("RecMCconvGamma_Phi_Eta","rec MC converted gamma Phi vs Eta ",400,0,2*TMath::Pi(),280,-1.4,1.4);
489  fHistoRecMCGammaPhivsEta->SetXTitle("#phi_{MC} (rad)");
490  fHistoRecMCGammaPhivsEta->SetYTitle("#eta_{MC}");
491  fHistograms->Add(fHistoRecMCGammaPhivsEta);
492 
493  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);
494  fHistoRecMCGammaMultiPtvsEta->SetXTitle("p_{MC,T} (GeV/c)");
495  fHistoRecMCGammaMultiPtvsEta->SetYTitle("#eta_{MC}");
496  fHistograms->Add(fHistoRecMCGammaMultiPtvsEta);
497 
498  fHistoRecMCGammaMultiPt = new TH1F("RecMCconvGammaMulti_Pt","rec MC converted gamma (at least double counted) Pt (|eta| < 0.9)",250,0.0,25);
499  fHistoRecMCGammaMultiPt->SetXTitle("p_{MC,T} (GeV/c)");
500  fHistograms->Add(fHistoRecMCGammaMultiPt);
501 
502  fHistoRecMCGammaMultiR = new TH1F("RecMCconvGammaMulti_R","rec MC converted gamma (at least double counted) R (|eta| < 0.9)",400,0,200);
503  fHistoRecMCGammaMultiR->SetXTitle("R_{MC,conv} (cm)");
504  fHistograms->Add(fHistoRecMCGammaMultiR);
505 
506  fHistoRecMCGammaMultiPhi = new TH1F("RecMCconvGammaMulti_Phi","rec MC converted gamma (at least double counted) Phi (|eta| < 0.9)",400,0,2*TMath::Pi());
507  fHistoRecMCGammaMultiPhi->SetXTitle("#phi_{MC} (rad)");
508  fHistograms->Add(fHistoRecMCGammaMultiPhi);
509 
510  fVectorFoundGammas.clear();
511  }
512 
513 }
514 //________________________________________________________________________
516 
517  // set file name to empty & reset check flag
518  fCurrentFileName = "";
519  fMCFileChecked = kFALSE;
520 
521  // obtain file name from analysis manager
522  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
523  if(man) {
524  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
525  if (inputHandler){
526  TTree* tree = (TTree*) inputHandler->GetTree();
527  TFile* file = (TFile*) tree->GetCurrentFile();
528  fCurrentFileName = file->GetName();
529  }
530  }
531 
532  // try to extract period name from file name if not given
533  if (fPeriodName.CompareTo("") == 0){
534  TObjArray *arr = fCurrentFileName.Tokenize("/");
535  fPtHardBin = -1;
536  for (Int_t i = 0; i < arr->GetEntriesFast();i++ ){
537  TObjString* testObjString = (TObjString*)arr->At(i);
538  if (testObjString->GetString().BeginsWith("LHC")){
539  fPeriodName = testObjString->GetString();
540  i = arr->GetEntriesFast();
541  }
542  }
543  if (fPeriodName.CompareTo("")==0){
544  TObjArray *arr2 = fCurrentFileName.Tokenize("__");
545  for (Int_t i = 0; i < arr->GetEntriesFast();i++ ){
546  TObjString* testObjString = (TObjString*)arr2->At(i);
547  if (testObjString->GetString().BeginsWith("LHC")){
548  fPeriodName = testObjString->GetString();
549  i = arr2->GetEntriesFast();
550  }
551  }
552  }
553  if (fPeriodName.CompareTo("") != 0 && fEventCuts->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
554  fEventCuts->SetPeriodEnum (fPeriodName);
555  }
556  } else {
557  if(fEventCuts->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
558  fEventCuts->SetPeriodEnum (fPeriodName);
559  }
560  }
561  // set pt hard bin from file name
562  if ( fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15a3a || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15a3a_plus ||
563  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15a3b ||
564  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15g1a || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC15g1b ||
565  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC12P2JJ ||
566  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c3a || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c3b ||
567  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16c3c ||
568  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16rP1JJ || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16sP1JJ ||
569  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16P1JJ || fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC16P1JJLowB ||
570  fEventCuts->GetPeriodEnum() == AliConvEventCuts::kLHC18b8
571  ){
572  TObjArray *arr = fCurrentFileName.Tokenize("/");
573  fPtHardBin = -1;
574  for (Int_t i = 0; i < arr->GetEntriesFast();i++ ){
575  TObjString* testObjString = (TObjString*)arr->At(i);
576  if (testObjString->GetString().BeginsWith("LHC")){
577  TObjString* testObjString2 = (TObjString*)arr->At(i+1);
578  fPtHardBin = testObjString2->GetString().Atoi();
579  i = arr->GetEntriesFast();
580  }
581  }
582  }
583 
584  if(!fEventCuts->GetDoEtaShift()) return kTRUE; // No Eta Shift requested, continue
585  if(fEventCuts->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
586  fEventCuts->GetCorrectEtaShiftFromPeriod();
587  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
588  return kTRUE;
589  } else {
590  printf(" Gamma Conversion Reader %s_%s :: Eta Shift Manually Set to %f \n\n",
591  (fEventCuts->GetCutNumber()).Data(),(fConversionCuts->GetCutNumber()).Data(),fEventCuts->GetEtaShift());
592  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
593  }
594 
595  return kTRUE;
596 }
597 //________________________________________________________________________
599  if (!fConversionCuts->GetPIDResponse()) fConversionCuts->InitPIDResponse();
600 
601  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
602  if(esdEvent) {
603  if (!TGeoGlobalMagField::Instance()->GetField()) esdEvent->InitMagneticField();
604  }
605 
606  // Check if correctly initialized
607  if(!fConversionGammas)Init();
608 
609  // User Exec
610  fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
611 
612  // AOD Output
613  FillAODOutput();
614 
615 }
616 
617 //________________________________________________________________________
618 Bool_t AliV0ReaderV1::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
619 {
620  if (!fConversionCuts->GetPIDResponse()) fConversionCuts->InitPIDResponse();
621  //Reset the TClonesArray
622  fConversionGammas->Delete();
623 
624  //Clear TBits object with accepted v0s from previous event
625  if (kAddv0sInESDFilter){fPCMv0BitField->Clear();}
626 
627  fInputEvent = inputEvent;
628  fMCEvent = mcEvent;
629 
630  if(!fInputEvent){
631  AliError("No Input event");
632  return kFALSE;
633  }
634  if(!fEventCuts){AliError("No EventCuts");return kFALSE;}
635  if(!fConversionCuts){AliError("No ConversionCuts");return kFALSE;}
636 
637 
638  // Count Primary Tracks Event
639  CountTracks();
640 
641  //Count Tracks with TPCout flag
642  CountTPCoutTracks();
643 
644  // Calculate the Sphericity and true sphericity
645  if(fCalcSphericity) CalculateSphericity();
646  if(fCalcSphericity && fMCEvent) CalculateSphericityMCTrue(fInputEvent);
647  if(fCalcSector) CalculatePtMaxSector();
648 
649  // Event Cuts
650  if(!fEventCuts->EventIsSelected(fInputEvent,fMCEvent)){
651  if (fEventCuts->GetEventQuality() == 2 && !fMCFileChecked ){
652  cout << "ERROR with MC reading for: "<< fCurrentFileName.Data() << endl;
653  fMCFileChecked = kTRUE;
654  }
655  return kFALSE;
656  }
657  // Set Magnetic Field
658  AliKFParticle::SetField(fInputEvent->GetMagneticField());
659 
660  if(fInputEvent->IsA()==AliAODEvent::Class() && fProduceV0findingEffi){
661  fProduceV0findingEffi = kFALSE;
662  AliWarning("V0finding effi cannot be run on AODs ");
663  }
664 
665  if(fProduceV0findingEffi){
666  CreatePureMCHistosForV0FinderEffiESD();
667  fVectorFoundGammas.clear();
668  }
669 
670  if(fInputEvent->IsA()==AliESDEvent::Class()){
671  ProcessESDV0s();
672  }
673  if(fInputEvent->IsA()==AliAODEvent::Class()){
674  GetAODConversionGammas();
675  }
676 
677  return kTRUE;
678 }
681 {
682  // Fill AOD Output with reconstructed Photons
683 
684  if(fInputEvent->IsA()==AliESDEvent::Class()){
686  if(fCreateAOD) {
687  PostData(1, fPCMv0BitField);
688  AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
689  if (aodhandler && aodhandler->GetFillAOD()) {
690  AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
691  //PostData(0, fConversionGammas);
692 
693  }
694  }
695  }
696 }
697 
699 const AliExternalTrackParam *AliV0ReaderV1::GetExternalTrackParam(AliESDv0 *fCurrentV0,Int_t &tracklabel,Int_t charge){
700 
701  // Get External Track Parameter with given charge
702 
703  if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;}
704 
705  if(fConversionCuts->GetV0FinderSameSign()==1){
706  if(fCurrentV0){
707  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()!=(fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge())return 0x0;
708  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==(fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()){
709  if(charge==1){
710  tracklabel=fCurrentV0->GetPindex();
711  return fCurrentV0->GetParamP();
712  }else{
713  tracklabel=fCurrentV0->GetNindex();
714  return fCurrentV0->GetParamN();
715  }
716  }
717  }
718  }else if(fConversionCuts->GetV0FinderSameSign()==2){
719  if(fCurrentV0){
720  if(charge==1){
721  tracklabel=fCurrentV0->GetPindex();
722  return fCurrentV0->GetParamP();
723  }else{
724  tracklabel=fCurrentV0->GetNindex();
725  return fCurrentV0->GetParamN();
726  }
727  }
728  }else{
729  // Check for sign flip
730  if(fCurrentV0){
731  if(!fCurrentV0->GetParamN()||!fCurrentV0->GetParamP())return 0x0;
732  if(!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex())||!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))return 0x0;
733  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==charge){
734  tracklabel=fCurrentV0->GetPindex();
735  return fCurrentV0->GetParamP();}
736  if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()==charge){
737  tracklabel=fCurrentV0->GetNindex();
738  return fCurrentV0->GetParamN();}
739  }
740  }
741  return 0x0;
742 }
743 
746 {
747 
748  // Process ESD V0s for conversion photon reconstruction
749  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
750 
751  AliKFConversionPhoton *fCurrentMotherKFCandidate=NULL;
752 
753  if(fESDEvent){
754  for(Int_t currentV0Index=0;currentV0Index<fESDEvent->GetNumberOfV0s();currentV0Index++){
755  AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index));
756  if(!fCurrentV0){
757  printf("Requested V0 does not exist");
758  continue;
759  }
760 
761  fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index);
762 
763  if(fCurrentMotherKFCandidate){
764  // Add Gamma to the TClonesArray
765 
766  if(kUseAODConversionPhoton){
767  new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(fCurrentMotherKFCandidate);
768  AliAODConversionPhoton * currentConversionPhoton = (AliAODConversionPhoton*)(fConversionGammas->At(fConversionGammas->GetEntriesFast()-1));
769  currentConversionPhoton->SetMass(fCurrentMotherKFCandidate->M());
770  if (fUseMassToZero) currentConversionPhoton->SetMassToZero();
771  currentConversionPhoton->SetInvMassPair(fCurrentInvMassPair);
772  if(kAddv0sInESDFilter){fPCMv0BitField->SetBitNumber(currentV0Index, kTRUE);}
773  } else {
774  new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliKFConversionPhoton(*fCurrentMotherKFCandidate);
775  }
776 
777  delete fCurrentMotherKFCandidate;
778  fCurrentMotherKFCandidate=NULL;
779  }
780  }
781  if(kAddv0sInESDFilter){fPCMv0BitField->Compact();}
782  }
783  return kTRUE;
784 }
785 
787 AliKFConversionPhoton *AliV0ReaderV1::ReconstructV0(AliESDv0 *fCurrentV0,Int_t currentV0Index)
788 {
789  // cout << currentV0Index << endl;
790  // Reconstruct conversion photon from ESD v0
791  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonIn);
792 
793  //checks if on the fly mode is set
794  if(!fConversionCuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
795  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kOnFly);
796  return 0x0;
797  }
798 
799  if (fMCEvent && fProduceV0findingEffi ) FillRecMCHistosForV0FinderEffiESD(fCurrentV0);
800 
801  // TrackLabels
802  Int_t currentTrackLabels[2]={-1,-1};
803 
804  // Get Daughter KF Particles
805 
806  const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0,currentTrackLabels[0]);
807  // cout << fCurrentExternalTrackParamPositive << "\t" << currentTrackLabels[0] << endl;
808  const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0,currentTrackLabels[1]);
809  // cout << fCurrentExternalTrackParamNegative << "\t" << currentTrackLabels[1] << endl;
810  if(!fCurrentExternalTrackParamPositive||!fCurrentExternalTrackParamNegative)return 0x0;
811 
812  // Apply some Cuts before Reconstruction
813 
814  AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[0]);
815  AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[1]);
816  if(!negTrack || !posTrack) {
817  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kNoTracks);
818  return 0x0;
819  }
820  // Track Cuts
821  if(!fConversionCuts->TracksAreSelected(negTrack, posTrack)){
822  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kTrackCuts);
823  return 0x0;
824  }
825 
826  fConversionCuts->FillV0EtaBeforedEdxCuts(fCurrentV0->Eta());
827 
828  // Reconstruct Photon
829  AliKFConversionPhoton *fCurrentMotherKF=NULL;
830  // fUseConstructGamma = kFALSE;
831  // cout << "construct gamma " << endl;
832  AliKFParticle fCurrentNegativeKFParticle(*(fCurrentExternalTrackParamNegative),11);
833  // cout << fCurrentExternalTrackParamNegative << "\t" << endl;
834  AliKFParticle fCurrentPositiveKFParticle(*(fCurrentExternalTrackParamPositive),-11);
835  // cout << fCurrentExternalTrackParamPositive << "\t" << endl;
836  // cout << currentTrackLabels[0] << "\t" << currentTrackLabels[1] << endl;
837  // cout << "construct gamma " <<fUseConstructGamma << endl;
838 
839  // Reconstruct Gamma
840  if(fUseConstructGamma){
841  fCurrentMotherKF = new AliKFConversionPhoton();
842  fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
843  }else{
844  fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
845  fCurrentMotherKF->SetMassConstraint(0,0.0001);
846  }
847 
848  // PID Cuts- positive track
849  if (!fConversionCuts->dEdxCuts(posTrack,fCurrentMotherKF)) {
850  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
851  return 0x0;
852  }
853  // PID Cuts - negative track
854  if(!fConversionCuts->dEdxCuts(negTrack,fCurrentMotherKF)) {
855  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
856  return 0x0;
857  }
858  fConversionCuts->FillV0EtaAfterdEdxCuts(fCurrentV0->Eta());
859 
860 
861  // Set Track Labels
862 
863  fCurrentMotherKF->SetTrackLabels(currentTrackLabels[0],currentTrackLabels[1]);
864 
865  // Set V0 index
866 
867  fCurrentMotherKF->SetV0Index(currentV0Index);
868 
869  //Set MC Label
870  if(fMCEvent){
871 
872  Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelPositive())->GetLabel());
873  Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelNegative())->GetLabel());
874 
875 // cout << "rec: " << currentTrackLabels[0] << "\t" << currentTrackLabels[1] << endl;
876 // cout << "recProp: " << fCurrentMotherKF->GetTrackLabelPositive() << "\t" << fCurrentMotherKF->GetTrackLabelNegative() << endl;
877 // cout << "MC: " << labeln << "\t" << labelp << endl;
878 
879  TParticle *fNegativeMCParticle = 0x0;
880  if(labeln>-1) fNegativeMCParticle = fMCEvent->Particle(labeln);
881  TParticle *fPositiveMCParticle = 0x0;
882  if(labelp>-1) fPositiveMCParticle = fMCEvent->Particle(labelp);
883 
884  if(fPositiveMCParticle&&fNegativeMCParticle){
885  fCurrentMotherKF->SetMCLabelPositive(labelp);
886  fCurrentMotherKF->SetMCLabelNegative(labeln);
887  }
888  }
889 
890  // Update Vertex (moved for same eta compared to old)
891  // cout << currentV0Index <<" \t before: \t" << fCurrentMotherKF->GetPx() << "\t" << fCurrentMotherKF->GetPy() << "\t" << fCurrentMotherKF->GetPz() << endl;
892  if(fUseImprovedVertex == kTRUE){
893  AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
894  // cout << "Prim Vtx: " << primaryVertexImproved.GetX() << "\t" << primaryVertexImproved.GetY() << "\t" << primaryVertexImproved.GetZ() << endl;
895  primaryVertexImproved+=*fCurrentMotherKF;
896  fCurrentMotherKF->SetProductionVertex(primaryVertexImproved);
897  }
898  // SetPsiPair
899  Double_t convpos[3]={0,0,0};
900  if (fImprovedPsiPair == 0){
901  Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative, convpos);
902  fCurrentMotherKF->SetPsiPair(PsiPair);
903  }
904 
905  // Recalculate ConversionPoint
906  Double_t dca[2]={0,0};
907  if(fUseOwnXYZCalculation){
908  // Double_t convpos[3]={0,0,0};
909  if(!GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos,dca)){
910  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kConvPointFail);
911  delete fCurrentMotherKF;
912  fCurrentMotherKF=NULL;
913  return 0x0;
914  }
915 
916  fCurrentMotherKF->SetConversionPoint(convpos);
917  }
918 
919 
920  // SetPsiPair
921  if (fImprovedPsiPair >= 1){
922  // the propagation can be more precise after the precise conversion point calculation
923  Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos);
924  fCurrentMotherKF->SetPsiPair(PsiPair);
925  //cout<<" GetPsiPair::"<<fCurrentMotherKF->GetPsiPair() <<endl;
926  }
927 
928  if(fCurrentMotherKF->GetNDF() > 0.)
929  fCurrentMotherKF->SetChi2perNDF(fCurrentMotherKF->GetChi2()/fCurrentMotherKF->GetNDF()); //->Photon is created before all chi2 relevant changes are performed, set it "by hand"
930 
931 
932  // Set Dilepton Mass (moved down for same eta compared to old)
933  fCurrentMotherKF->SetMass(fCurrentMotherKF->M());
934 
935  // Calculating invariant mass
936  Double_t mass=-99.0, mass_width=-99.0, Pt=-99.0, Pt_width=-99.0;
937  AliKFParticle fCurrentMotherKFForMass(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
938  fCurrentMotherKFForMass.GetMass(mass,mass_width);
939  fCurrentMotherKFForMass.GetPt(Pt,Pt_width);
940  fCurrentInvMassPair=mass;
941 
942  // apply possible Kappa cut
943  if (!fConversionCuts->KappaCuts(fCurrentMotherKF,fInputEvent)){
944  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
945  delete fCurrentMotherKF;
946  fCurrentMotherKF=NULL;
947  return 0x0;
948  }
949 
950  // Apply Photon Cuts
951  if(!fConversionCuts->PhotonCuts(fCurrentMotherKF,fInputEvent)){
952  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonCuts);
953  delete fCurrentMotherKF;
954  fCurrentMotherKF=NULL;
955  return 0x0;
956  }
957 
958  // cout << currentV0Index <<" \t after: \t" <<fCurrentMotherKF->GetPx() << "\t" << fCurrentMotherKF->GetPy() << "\t" << fCurrentMotherKF->GetPz() << endl;
959 
960  if(fProduceImpactParamHistograms) FillImpactParamHistograms(posTrack, negTrack, fCurrentV0, fCurrentMotherKF);
961 
962  fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonOut);
963  return fCurrentMotherKF;
964 }
965 
967 Double_t AliV0ReaderV1::GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam,const AliExternalTrackParam *negativeparam,const Double_t convpos[3]) const {
968  //
969  // Angle between daughter momentum plane and plane
970  //
971 
972  AliExternalTrackParam nt(*negativeparam);
973  AliExternalTrackParam pt(*positiveparam);
974 
975  Float_t magField = fInputEvent->GetMagneticField();
976 
977  Double_t xyz[3] = {0.,0.,0.};
978  if (fImprovedPsiPair==0 ) {
979  v0->GetXYZ(xyz[0],xyz[1],xyz[2]);
980  } else if (fImprovedPsiPair>=1 ) {
981  xyz[0]= convpos[0];
982  xyz[1]= convpos[1];
983  xyz[2]= convpos[2];
984  }
985 
986 
987  // Double_t pPlus[3] = {pt.Px(),pt.Py(),pt.Pz()};
988  // Double_t pMinus[3] = {nt.Px(),nt.Py(),nt.Pz()};
989 
990  // Double_t u[3] = {pPlus[0]+pMinus[0],pPlus[1]+pMinus[1],pPlus[2]+pMinus[2]};
991  // Double_t normu = sqrt( (u[0]*u[0]) + (u[1]*u[1]) + (u[2]*u[2]) );
992 
993  // u[0] = u[0] / normu;
994  // u[1] = u[1] / normu;
995  // u[2] = u[2] / normu;
996 
997  // Double_t normpPlus = sqrt( (pPlus[0]*pPlus[0]) + (pPlus[1]*pPlus[1]) + (pPlus[2]*pPlus[2]) );
998  // Double_t normpMinus = sqrt( (pMinus[0]*pMinus[0]) + (pMinus[1]*pMinus[1]) + (pMinus[2]*pMinus[2]) );
999 
1000  // pPlus[0] = pPlus[0] / normpPlus;
1001  // pPlus[1] = pPlus[1] / normpPlus;
1002  // pPlus[2] = pPlus[2] / normpPlus;
1003 
1004  // pMinus[0] = pMinus[0] / normpMinus;
1005  // pMinus[1] = pMinus[1] / normpMinus;
1006  // pMinus[2] = pMinus[2] / normpMinus;
1007 
1008  // Double_t v[3] = {0,0,0}; // pPlus X pMinus
1009  // v[0] = (pPlus[1]*pMinus[2]) - (pPlus[2]*pMinus[1]);
1010  // v[1] = (pPlus[2]*pMinus[0]) - (pPlus[0]*pMinus[2]);
1011  // v[2] = (pPlus[0]*pMinus[1]) - (pPlus[1]*pMinus[0]);
1012 
1013  // Double_t w[3] = {0,0,0}; // u X v
1014  // w[0] = (u[1]*v[2]) - (u[2]*v[1]);
1015  // w[1] = (u[2]*v[0]) - (u[0]*v[2]);
1016  // w[2] = (u[0]*v[1]) - (u[1]*v[0]);
1017 
1018  // Double_t z[3] = {0,0,1};
1019  // Double_t wc[3] = {0,0,0}; // u X v
1020  // wc[0] = (u[1]*z[2]) - (u[2]*z[1]);
1021  // wc[1] = (u[2]*z[0]) - (u[0]*z[2]);
1022  // wc[2] = (u[0]*z[1]) - (u[1]*z[0]);
1023 
1024  // Double_t PhiV = TMath::ACos((w[0]*wc[0]) + (w[1]*wc[1]) + (w[2]*wc[2]));
1025  //return TMath::Abs(PhiV);
1026 
1027 
1028  // TVector3 pPlus(pt.Px(),pt.Py(),pt.Pz());
1029  // TVector3 pMinus(nt.Px(),nt.Py(),nt.Pz());
1030 
1031  // TVector3 u = pMinus + pPlus;
1032  // u = u*(1/u.Mag());
1033 
1034  // TVector3 pHPlus = pPlus*(1/pPlus.Mag());
1035  // TVector3 pHMinus = pMinus*(1/pMinus.Mag());
1036 
1037  // TVector3 v = pHPlus.Cross(pHMinus);
1038  // TVector3 w = u.Cross(v);
1039  // TVector3 z(0,0,1);
1040  // TVector3 wc = u.Cross(z);
1041 
1042  // Double_t PhiV = w * wc;
1043 
1044  Double_t mn[3] = {0,0,0};
1045  Double_t mp[3] = {0,0,0};
1046 
1047  v0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
1048  v0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
1049 
1050  Double_t deltat = 1.;
1051  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
1052  Double_t radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 50;//radius to which tracks shall be propagated
1053 
1054  Double_t momPosProp[3] = {0,0,0};
1055  Double_t momNegProp[3] = {0,0,0};
1056 
1057  Double_t psiPair = 4.;
1058  // cout<< "Momentum before propagation at radius ::"<< TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1])<< endl;
1059  // cout<< mn[0]<< " " <<mn[1]<<" "<< mn[2]<<" "<<TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1] +mn[2]*mn[2])<< endl;
1060  // cout<< mp[0]<< " " <<mp[1]<<" "<< mp[2]<<" "<<TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1] +mp[2]*mp[2])<< endl;
1061  Double_t pEle,pPos;
1062 
1063  if (fImprovedPsiPair==1 || fImprovedPsiPair==0 ){
1064  if(nt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
1065  if(pt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
1066 
1067  pt.GetPxPyPz(momPosProp);//Get momentum vectors of tracks after propagation
1068  nt.GetPxPyPz(momNegProp);
1069  } else if (fImprovedPsiPair>=2) {
1070  momPosProp[0] = pt.GetParameterAtRadius(radiussum,magField,3);
1071  momPosProp[1] = pt.GetParameterAtRadius(radiussum,magField,4);
1072  momPosProp[2] = pt.GetParameterAtRadius(radiussum,magField,5);
1073 
1074  momNegProp[0] = nt.GetParameterAtRadius(radiussum,magField,3);
1075  momNegProp[1] = nt.GetParameterAtRadius(radiussum,magField,4);
1076  momNegProp[2] = nt.GetParameterAtRadius(radiussum,magField,5);
1077  pEle = TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
1078 
1079  pPos = TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
1080 
1081  if ( (pEle==0 || pPos==0) && fImprovedPsiPair==3) {
1082  radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 30;
1083  momPosProp[0] = pt.GetParameterAtRadius(radiussum,magField,3);
1084  momPosProp[1] = pt.GetParameterAtRadius(radiussum,magField,4);
1085  momPosProp[2] = pt.GetParameterAtRadius(radiussum,magField,5);
1086 
1087  momNegProp[0] = nt.GetParameterAtRadius(radiussum,magField,3);
1088  momNegProp[1] = nt.GetParameterAtRadius(radiussum,magField,4);
1089  momNegProp[2] = nt.GetParameterAtRadius(radiussum,magField,5);
1090 
1091  }
1092  }
1093 
1094  pEle = TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
1095  pPos = TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
1096 
1097  Double_t scalarproduct =
1098  momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
1099 
1100  if (pEle==0 || pPos==0) return psiPair;
1101 
1102 
1103  Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks
1104 
1105  // psiPair = TMath::Abs(TMath::ASin(deltat/chipair));
1106  psiPair = TMath::ASin(deltat/chipair);
1107  return psiPair;
1108 }
1109 
1111 Bool_t AliV0ReaderV1::GetHelixCenter(const AliExternalTrackParam *track,Double_t center[2]){
1112 
1113  // Get Center of the helix track parametrization
1114 
1115  Int_t charge=track->Charge();
1116  Double_t b=fInputEvent->GetMagneticField();
1117 
1118  Double_t helix[6];
1119  track->GetHelixParameters(helix,b);
1120 
1121  Double_t xpos = helix[5];
1122  Double_t ypos = helix[0];
1123  Double_t radius = TMath::Abs(1./helix[4]);
1124  Double_t phi = helix[2];
1125 
1126  if(phi < 0){
1127  phi = phi + 2*TMath::Pi();
1128  }
1129 
1130  phi -= TMath::Pi()/2.;
1131  Double_t xpoint = radius * TMath::Cos(phi);
1132  Double_t ypoint = radius * TMath::Sin(phi);
1133 
1134  if(b<0){
1135  if(charge > 0){
1136  xpoint = - xpoint;
1137  ypoint = - ypoint;
1138  }
1139  }
1140  if(b>0){
1141  if(charge < 0){
1142  xpoint = - xpoint;
1143  ypoint = - ypoint;
1144  }
1145  }
1146  center[0] = xpos + xpoint;
1147  center[1] = ypos + ypoint;
1148 
1149  return 1;
1150 }
1152 Bool_t AliV0ReaderV1::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3],Double_t dca[2]){
1153 
1154  // Recalculate Conversion Point
1155 
1156  if(!pparam||!nparam)return kFALSE;
1157 
1158  Double_t helixcenterpos[2];
1159  GetHelixCenter(pparam,helixcenterpos);
1160 
1161  Double_t helixcenterneg[2];
1162  GetHelixCenter(nparam,helixcenterneg);
1163 
1164  Double_t helixpos[6];
1165  pparam->GetHelixParameters(helixpos,fInputEvent->GetMagneticField());
1166  Double_t posradius = TMath::Abs(1./helixpos[4]);
1167 
1168  Double_t helixneg[6];
1169  nparam->GetHelixParameters(helixneg,fInputEvent->GetMagneticField());
1170  Double_t negradius = TMath::Abs(1./helixneg[4]);
1171 
1172  // Calculate xy-position
1173 
1174  Double_t xpos = helixcenterpos[0];
1175  Double_t ypos = helixcenterpos[1];
1176  Double_t xneg = helixcenterneg[0];
1177  Double_t yneg = helixcenterneg[1];
1178 
1179  convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1180  convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1181 
1182 
1183  // Calculate Track XY vertex position
1184 
1185  Double_t deltaXPos = convpos[0] - xpos;
1186  Double_t deltaYPos = convpos[1] - ypos;
1187 
1188  Double_t deltaXNeg = convpos[0] - xneg;
1189  Double_t deltaYNeg = convpos[1] - yneg;
1190 
1191  Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
1192  Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
1193 
1194  Double_t vertexXNeg = xneg + TMath::Abs(negradius)*TMath::Cos(alphaNeg);
1195  Double_t vertexYNeg = yneg + TMath::Abs(negradius)*TMath::Sin(alphaNeg);
1196 
1197  Double_t vertexXPos = xpos + TMath::Abs(posradius)*TMath::Cos(alphaPos);
1198  Double_t vertexYPos = ypos + TMath::Abs(posradius)*TMath::Sin(alphaPos);
1199 
1200  AliExternalTrackParam p(*pparam);
1201  AliExternalTrackParam n(*nparam);
1202 
1203  TVector2 vertexPos(vertexXPos,vertexYPos);
1204  TVector2 vertexNeg(vertexXNeg,vertexYNeg);
1205 
1206  // Convert to local coordinate system
1207  TVector2 vertexPosRot=vertexPos.Rotate(-p.GetAlpha());
1208  TVector2 vertexNegRot=vertexNeg.Rotate(-n.GetAlpha());
1209 
1210  // Propagate Track Params to Vertex
1211 
1212  if(!p.PropagateTo(vertexPosRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
1213  if(!n.PropagateTo(vertexNegRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
1214 
1215  // Check whether propagation was sucessful
1216 
1217  if(TMath::Abs(vertexPos.Mod()-TMath::Sqrt(p.GetX()*p.GetX()+p.GetY()*p.GetY()))>0.01)return kFALSE;
1218  if(TMath::Abs(vertexNeg.Mod()-TMath::Sqrt(n.GetX()*n.GetX()+n.GetY()*n.GetY()))>0.01)return kFALSE;
1219 
1220  // Calculate z position
1221 
1222  convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
1223 
1224  // Calculate DCA
1225  TVector2 vdca=vertexPos-vertexNeg;
1226  dca[0]=vdca.Mod();
1227  dca[1]=TMath::Abs(n.GetZ()-p.GetZ());
1228 
1229  return kTRUE;
1230 }
1231 
1232 //________________________________________________________________________
1234 
1235  // Get reconstructed conversion photons from satellite AOD file
1236 
1237  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent);
1238 
1239  if(fAODEvent){
1240 
1241  if(fConversionGammas == NULL){
1242  fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);
1243  }
1244  fConversionGammas->Delete();//Reset the TClonesArray
1245 
1246  //Get Gammas from satellite AOD gamma branch
1247 
1248  AliAODConversionPhoton *gamma=0x0;
1249 
1250  TClonesArray *fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));
1251 
1252  if(!fInputGammas){
1253  FindDeltaAODBranchName();
1254  fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));}
1255  if(!fInputGammas){AliError("No Gamma Satellites found");return kFALSE;}
1256  // Apply Selection Cuts to Gammas and create local working copy
1257  if(fInputGammas){
1258  for(Int_t i=0;i<fInputGammas->GetEntriesFast();i++){
1259  gamma=dynamic_cast<AliAODConversionPhoton*>(fInputGammas->At(i));
1260  if(gamma){
1261  if(fRelabelAODs)RelabelAODPhotonCandidates(gamma);
1262  if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
1263  new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(*gamma);}
1264  }
1265  }
1266  }
1267  }
1268 
1269  if(fConversionGammas->GetEntries()){return kTRUE;}
1270 
1271  return kFALSE;
1272 }
1273 
1274 //________________________________________________________________________
1276 
1277  // Find delta AOD branchname containing reconstructed photons
1278 
1279  TList *list=fInputEvent->GetList();
1280  for(Int_t ii=0;ii<list->GetEntries();ii++){
1281  TString name((list->At(ii))->GetName());
1282  if(name.BeginsWith(fDeltaAODBranchName)&&name.EndsWith("gamma")){
1283  fDeltaAODBranchName=name;
1284  AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
1285  return;
1286  }
1287  }
1288 }
1289 
1290 //________________________________________________________________________
1292 
1293  if(fPreviousV0ReaderPerformsAODRelabeling == 2) return;
1294  else if(fPreviousV0ReaderPerformsAODRelabeling == 0){
1295  printf("Running AODs! Determine if V0Reader '%s' should perform relabeling\n",this->GetName());
1296  TObjArray* obj = (TObjArray*)AliAnalysisManager::GetAnalysisManager()->GetTasks();
1297  Int_t iPosition = obj->IndexOf(this);
1298  Bool_t prevV0ReaderRunningButNotRelabeling = kFALSE;
1299  for(Int_t i=iPosition-1; i>=0; i--){
1300  if( (obj->At(i))->IsA() == AliV0ReaderV1::Class()){
1301  AliV0ReaderV1* tempReader = (AliV0ReaderV1*) obj->At(i);
1302  if( tempReader->AreAODsRelabeled() && tempReader->IsReaderPerformingRelabeling() == 1){
1303  fPreviousV0ReaderPerformsAODRelabeling = 2;
1304  prevV0ReaderRunningButNotRelabeling = kFALSE;
1305  printf("V0Reader '%s' is running before this V0Reader '%s': do _NOT_ relabel AODs by current reader!\n",tempReader->GetName(),this->GetName());
1306  break;
1307  }else prevV0ReaderRunningButNotRelabeling = kTRUE;
1308  }
1309  }
1310  if(prevV0ReaderRunningButNotRelabeling) AliFatal(Form("There are V0Readers before '%s', but none of them is relabeling!",this->GetName()));
1311 
1312  if(fPreviousV0ReaderPerformsAODRelabeling == 2) return;
1313  else{
1314  printf("This V0Reader '%s' is first to be processed: do relabel AODs by current reader!\n",this->GetName());
1315  fPreviousV0ReaderPerformsAODRelabeling = 1;
1316  }
1317  }
1318 
1319  if(fPreviousV0ReaderPerformsAODRelabeling != 1) AliFatal(Form("In %s: fPreviousV0ReaderPerformsAODRelabeling = '%i' - while it should be impossible it is something different than '1'!",this->GetName(),fPreviousV0ReaderPerformsAODRelabeling));
1320 
1321  // Relabeling For AOD Event
1322  // ESDiD -> AODiD
1323  // MCLabel -> AODMCLabel
1324  Bool_t AODLabelPos = kFALSE;
1325  Bool_t AODLabelNeg = kFALSE;
1326 
1327  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
1328  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
1329  if(!AODLabelPos){
1330  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
1331  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
1332  PhotonCandidate->SetLabelPositive(i);
1333  AODLabelPos = kTRUE;
1334  }
1335  }
1336  if(!AODLabelNeg){
1337  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
1338  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
1339  PhotonCandidate->SetLabelNegative(i);
1340  AODLabelNeg = kTRUE;
1341  }
1342  }
1343  if(AODLabelNeg && AODLabelPos){
1344  return;
1345  }
1346  }
1347  if(!AODLabelPos || !AODLabelNeg){
1348  AliError(Form("NO AOD Daughters Found Pos: %i %i Neg: %i %i, setting all labels to -999999",AODLabelPos,PhotonCandidate->GetTrackLabelPositive(),AODLabelNeg,PhotonCandidate->GetTrackLabelNegative()));
1349  if(!AODLabelNeg){
1350  PhotonCandidate->SetMCLabelNegative(-999999);
1351  PhotonCandidate->SetLabelNegative(-999999);
1352  }
1353  if(!AODLabelPos){
1354  PhotonCandidate->SetMCLabelPositive(-999999);
1355  PhotonCandidate->SetLabelPositive(-999999);
1356  }
1357  }
1358 
1359 }
1360 
1361 //************************************************************************
1362 // This function counts the number of primary tracks in the event, the
1363 // implementation for ESD and AOD had to be different due to the different
1364 // filters which are already applied on AOD level the so-called filter
1365 // bits, we tried to replicate the conditions in both but an exact match
1366 // could not be reached. The cuts are similar to the ones used by the
1367 // jet-group
1368 //************************************************************************
1369 //________________________________________________________________________
1371 
1372  // In Case of MC count only MB tracks
1373  // if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
1374  // fEventCuts->GetNotRejectedParticles(1,NULL,fMCEvent);
1375  // }
1376  // if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
1377  // fEventCuts->GetNotRejectedParticles(1,NULL,fInputEvent);
1378  // }
1379 
1380  if(fInputEvent->IsA()==AliESDEvent::Class()){
1381  static AliESDtrackCuts *EsdTrackCuts = 0x0;
1382  static int prevRun = -1;
1383  // Using standard function for setting Cuts
1384  Int_t runNumber = fInputEvent->GetRunNumber();
1385 
1386  if (prevRun!=runNumber) {
1387  delete EsdTrackCuts;
1388  EsdTrackCuts = 0;
1389  prevRun = runNumber;
1390  }
1391  if (!EsdTrackCuts) {
1392  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
1393  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1394  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1395  // else if run2 data use 2015 PbPb cuts
1396  } else if (runNumber>=209122){
1397  //EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
1398  // hard coded track cuts for the moment, because AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb() gives spams warnings
1399  EsdTrackCuts = new AliESDtrackCuts();
1400  // TPC; clusterCut = 1, cutAcceptanceEdges = kTRUE, removeDistortedRegions = kFALSE
1401  EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
1402  EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
1403  EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0); // only dead zone and not clusters per length
1404  //EsdTrackCuts->AliESDtrackCuts::SetCutOutDistortedRegionsTPC(kTRUE);
1405  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
1406  EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
1407  EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
1408  // ITS; selPrimaries = 1
1409  EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
1410  EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1411  AliESDtrackCuts::kAny);
1412  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
1413  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
1414  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
1415  EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
1416  EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
1417  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
1418  // else use 2011 version of track cuts
1419  }else{
1420  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1421  }
1422  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1423  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
1424  EsdTrackCuts->SetPtRange(0.15);
1425  }
1426  fNumberOfPrimaryTracks = 0;
1427  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1428  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1429  if(!curTrack) continue;
1430  if(!EsdTrackCuts->AcceptTrack(curTrack)) continue;
1431  //if(fMCEvent && !(fEventCuts->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()),fMCEvent->Stack(),fInputEvent))) continue;
1432  fNumberOfPrimaryTracks++;
1433  }
1434  }
1435  else if(fInputEvent->IsA()==AliAODEvent::Class()){
1436  fNumberOfPrimaryTracks = 0;
1437  for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
1438  AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
1439  if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
1440  if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
1441  if(TMath::Abs(curTrack->Eta())>0.8) continue;
1442  if(curTrack->Pt()<0.15) continue;
1443  //if(fMCEvent && !(fEventCuts->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()),NULL,fInputEvent))) continue;
1444  //if(TMath::Abs(curTrack->ZAtDCA())>2) continue; // Only Set For TPCOnly tracks
1445  fNumberOfPrimaryTracks++;
1446  }
1447  }
1448 
1449  return;
1450 }
1451 
1454  fNumberOfTPCoutTracks = 0;
1455 
1456  for (Int_t itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); itrk++) {
1457  AliVTrack *trk = dynamic_cast<AliVTrack*>(fInputEvent->GetTrack(itrk));
1458 
1459  if (trk != NULL) {
1460  /* the initial method of counting TPC out tracks */
1461  if (!(trk->Pt() < 0.15) && (TMath::Abs(trk->Eta()) < 0.8)) {
1462  if ((trk->GetStatus() & AliVTrack::kTPCout) == AliVTrack::kTPCout) {
1463  fNumberOfTPCoutTracks++;
1464  }
1465  }
1466  }
1467  }
1468  return;
1469 }
1472  TMatrixD Si(2,2);
1473  TMatrixD S(2,2);
1474  TMatrixD St(2,2);
1475  double_t P(0);
1476  fNumberOfRecTracks = 0;
1477  fSphericity = -1;
1478  TMatrixD EigenV(2,2);
1479  TVector2* EigenVector;
1480  fSphericityAxisMainPhi = 0;
1481  Double_t MirroredMainSphericityAxis = 0;
1482  fSphericityAxisSecondaryPhi = 0;
1483  fInEMCalAcceptance = kFALSE;
1484  if(fInputEvent->IsA()==AliESDEvent::Class()){
1485  static AliESDtrackCuts *EsdTrackCuts = 0x0;
1486  static int prevRun = -1;
1487  // Using standard function for setting Cuts
1488  Int_t runNumber = fInputEvent->GetRunNumber();
1489 
1490  if (prevRun!=runNumber) {
1491  delete EsdTrackCuts;
1492  EsdTrackCuts = 0;
1493  prevRun = runNumber;
1494  }
1495  if (!EsdTrackCuts) {
1496  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
1497  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1498  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1499  // else if run2 data use 2015 PbPb cuts
1500  } else if (runNumber>=209122){
1501  //EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
1502  // hard coded track cuts for the moment, because AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb() gives spams warnings
1503  EsdTrackCuts = new AliESDtrackCuts();
1504  // TPC; clusterCut = 1, cutAcceptanceEdges = kTRUE, removeDistortedRegions = kFALSE
1505  EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
1506  EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
1507  EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0); // only dead zone and not clusters per length
1508  //EsdTrackCuts->AliESDtrackCuts::SetCutOutDistortedRegionsTPC(kTRUE);
1509  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
1510  EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
1511  EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
1512  // ITS; selPrimaries = 1
1513  EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
1514  EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1515  AliESDtrackCuts::kAny);
1516  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
1517  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
1518  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
1519  EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
1520  EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
1521  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
1522  // else use 2011 version of track cuts
1523  }else{
1524  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1525  }
1526  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1527  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
1528  EsdTrackCuts->SetPtRange(0.5);
1529  }
1530  fSphericity = -1;
1531  fNumberOfRecTracks = 0;
1532  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1533  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1534  if(!curTrack) continue;
1535  if(!EsdTrackCuts->AcceptTrack(curTrack)) continue;
1536  fNumberOfRecTracks++;
1537  Si.Zero();
1538  Si(0,0)=pow(curTrack->Px(),2);
1539  Si(0,1)=curTrack->Px()*curTrack->Py();
1540  Si(1,0)=curTrack->Py()*curTrack->Px();
1541  Si(1,1)=pow(curTrack->Py(),2);
1542  S += (1/curTrack->Pt())*Si;
1543  P += curTrack->Pt();
1544  }
1545  if(P==0 || fNumberOfRecTracks<3){
1546  fSphericity = -1;
1547  }else{
1548  St = (1/P)*S;
1549  fSphericity = (2*TMatrixDEigen(St).GetEigenValues()(1,1))/(TMatrixDEigen(St).GetEigenValues()(0,0)+TMatrixDEigen(St).GetEigenValues()(1,1));
1550  EigenV.Zero();
1551  EigenV = TMatrixDEigen(St).GetEigenVectors();
1552  EigenVector = new TVector2(EigenV(0,0), EigenV(1,0));
1553  fSphericityAxisMainPhi = EigenVector->Phi();
1554  MirroredMainSphericityAxis = fSphericityAxisMainPhi + TMath::Pi();
1555  if(MirroredMainSphericityAxis > 2*TMath::Pi()) MirroredMainSphericityAxis -= 2*TMath::Pi();
1556  EigenVector = new TVector2(EigenV(0,1), EigenV(1,1));
1557  fSphericityAxisSecondaryPhi = EigenVector->Phi();
1558  if(fSphericityAxisMainPhi > 1.396263 && fSphericityAxisMainPhi < 3.263766){
1559  fInEMCalAcceptance = kTRUE;
1560  }else if((MirroredMainSphericityAxis > 1.396263) && (MirroredMainSphericityAxis < 3.263766)){
1561  fInEMCalAcceptance = kTRUE;
1562  }
1563  }
1564  }
1565  else if(fInputEvent->IsA()==AliAODEvent::Class()){
1566  fSphericity = -1;
1567  fNumberOfRecTracks = 0;
1568  for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
1569  AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
1570  if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
1571  if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
1572  if(TMath::Abs(curTrack->Eta())>0.8) continue;
1573  if(curTrack->Pt()<0.5) continue;
1574  fNumberOfRecTracks++;
1575  Si.Zero();
1576  Si(0,0)=pow(curTrack->Px(),2);
1577  Si(0,1)=curTrack->Px()*curTrack->Py();
1578  Si(1,0)=curTrack->Py()*curTrack->Px();
1579  Si(1,1)=pow(curTrack->Py(),2);
1580  S += (1/curTrack->Pt())*Si;
1581  P += curTrack->Pt();
1582  }
1583  if(P==0 || fNumberOfRecTracks<3){
1584  fSphericity = -1;
1585  }else{
1586  St = (1/P)*S;
1587  fSphericity = (2*TMatrixDEigen(St).GetEigenValues()(1,1))/(TMatrixDEigen(St).GetEigenValues()(0,0)+TMatrixDEigen(St).GetEigenValues()(1,1));
1588  EigenV.Zero();
1589  EigenV = TMatrixDEigen(St).GetEigenVectors();
1590  EigenVector = new TVector2(EigenV(0,0), EigenV(1,0));
1591  fSphericityAxisMainPhi = EigenVector->Phi();
1592  MirroredMainSphericityAxis = fSphericityAxisMainPhi + TMath::Pi();
1593  if(MirroredMainSphericityAxis > 2*TMath::Pi()) MirroredMainSphericityAxis -= 2*TMath::Pi();
1594  EigenVector = new TVector2(EigenV(0,1), EigenV(1,1));
1595  fSphericityAxisSecondaryPhi = EigenVector->Phi();
1596  if(fSphericityAxisMainPhi > 1.396263 && fSphericityAxisMainPhi < 3.263766){
1597  fInEMCalAcceptance = kTRUE;
1598  }else if((MirroredMainSphericityAxis > 1.396263) && (MirroredMainSphericityAxis < 3.263766)){
1599  fInEMCalAcceptance = kTRUE;
1600  }
1601  }
1602  }
1603  return;
1604 }
1606 void AliV0ReaderV1::CalculateSphericityMCTrue(AliVEvent *inputEvent){
1607  TMatrixD Si(2,2);
1608  TMatrixD S(2,2);
1609  TMatrixD St(2,2);
1610  double_t P(0);
1611  fNumberOfTruePrimaryTracks = 0;
1612  fSphericityTrue = -1;
1613  if(inputEvent->IsA()==AliAODEvent::Class()){
1614  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(inputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1615  if (AODMCTrackArray == NULL) return;
1616  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
1617  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
1618  if (!particle) continue;
1619  if (!particle->IsPhysicalPrimary()) continue;
1620  if (!particle->Pt()) continue;
1621  if(particle->Pt()<0.5) continue;
1622  if(TMath::Abs(particle->Eta())>0.8) continue;
1623  fNumberOfTruePrimaryTracks++;
1624  Si.Zero();
1625  Si(0,0)=pow(particle->Px(),2);
1626  Si(0,1)=particle->Px()*particle->Py();
1627  Si(1,0)=particle->Py()*particle->Px();
1628  Si(1,1)=pow(particle->Py(),2);
1629  S += (1/particle->Pt())*Si;
1630  P += particle->Pt();
1631  }
1632  }else if(inputEvent->IsA()==AliESDEvent::Class()){
1633  fSphericityTrue = -1;
1634  }
1635  if(P==0 || fNumberOfTruePrimaryTracks<3){
1636  fSphericityTrue = -1;
1637  }else{
1638  St = (1/P)*S;
1639  fSphericityTrue = (2*TMatrixDEigen(St).GetEigenValues()(1,1))/(TMatrixDEigen(St).GetEigenValues()(0,0)+TMatrixDEigen(St).GetEigenValues()(1,1));
1640  }
1641  return;
1642 }
1645 
1646 
1647  if(fInputEvent->IsA()==AliESDEvent::Class()){
1648  static AliESDtrackCuts *EsdTrackCuts = 0x0;
1649  static int prevRun = -1;
1650  // Using standard function for setting Cuts
1651  Int_t runNumber = fInputEvent->GetRunNumber();
1652 
1653  if (prevRun!=runNumber) {
1654  delete EsdTrackCuts;
1655  EsdTrackCuts = 0;
1656  prevRun = runNumber;
1657  }
1658  if (!EsdTrackCuts) {
1659  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
1660  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1661  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1662  // else if run2 data use 2015 PbPb cuts
1663  } else if (runNumber>=209122){
1664  //EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
1665  // hard coded track cuts for the moment, because AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb() gives spams warnings
1666  EsdTrackCuts = new AliESDtrackCuts();
1667  // TPC; clusterCut = 1, cutAcceptanceEdges = kTRUE, removeDistortedRegions = kFALSE
1668  EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
1669  EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
1670  EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0); // only dead zone and not clusters per length
1671  //EsdTrackCuts->AliESDtrackCuts::SetCutOutDistortedRegionsTPC(kTRUE);
1672  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
1673  EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
1674  EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
1675  // ITS; selPrimaries = 1
1676  EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
1677  EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1678  AliESDtrackCuts::kAny);
1679  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
1680  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
1681  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
1682  EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
1683  EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
1684  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
1685  // else use 2011 version of track cuts
1686  }else{
1687  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1688  }
1689  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1690  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
1691  EsdTrackCuts->SetPtRange(0.15);
1692  }
1693  fPtMaxSector = 0;
1694  Double_t PtMaxID = 0;
1695  Double_t tempPt = 0;
1696  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1697  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1698  if(!curTrack) continue;
1699  if(!EsdTrackCuts->AcceptTrack(curTrack)) continue;
1700  if(PtMaxID == 0){
1701  PtMaxID = iTracks;
1702  tempPt = curTrack->Pt();
1703  }
1704  if(curTrack->Pt() > tempPt){
1705  PtMaxID = iTracks;
1706  tempPt = curTrack->Pt();
1707  }
1708  }
1709  AliESDtrack* PtMaxTrack = (AliESDtrack*) fInputEvent->GetTrack(PtMaxID);
1710  if(tempPt!=0 && PtMaxTrack){
1711  Double_t PtMaxPhi = PtMaxTrack->Phi();
1712  fPtMaxSector = 0;
1713  if((PtMaxPhi > (TMath::Pi()/4.)) && (PtMaxPhi < (3*TMath::Pi()/4.))) fPtMaxSector = 1;
1714  if((PtMaxPhi > (3*TMath::Pi()/4.)) && (PtMaxPhi < (5*TMath::Pi()/4.))) fPtMaxSector = 2;
1715  if((PtMaxPhi > (5*TMath::Pi()/4.)) && (PtMaxPhi < (7*TMath::Pi()/4.))) fPtMaxSector = 3;
1716  if((PtMaxPhi > (7*TMath::Pi()/4.)) && (PtMaxPhi < (TMath::Pi()/4.))) fPtMaxSector = 4;
1717  if(PtMaxTrack->Eta()>0) fPtMaxSector += 4;
1718  }
1719  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
1720  fPtMaxSector = 0;
1721  Double_t PtMaxID = 0;
1722  Double_t tempPt = 0;
1723  for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
1724  AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
1725  if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
1726  if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
1727  if(TMath::Abs(curTrack->Eta())>0.8) continue;
1728  if(curTrack->Pt()<0.15) continue;
1729  if(PtMaxID == 0){
1730  PtMaxID = iTracks;
1731  tempPt = curTrack->Pt();
1732  }
1733  if(curTrack->Pt() > tempPt){
1734  PtMaxID = iTracks;
1735  tempPt = curTrack->Pt();
1736  }
1737  }
1738  AliAODTrack* PtMaxTrack = (AliAODTrack*) fInputEvent->GetTrack(PtMaxID);
1739  if(tempPt!=0 && PtMaxTrack){
1740  Double_t PtMaxPhi = PtMaxTrack->Phi();
1741  fPtMaxSector = 0;
1742  if((PtMaxPhi > (TMath::Pi()/4.)) && (PtMaxPhi < (3*TMath::Pi()/4.))) fPtMaxSector = 1;
1743  if((PtMaxPhi > (3*TMath::Pi()/4.)) && (PtMaxPhi < (5*TMath::Pi()/4.))) fPtMaxSector = 2;
1744  if((PtMaxPhi > (5*TMath::Pi()/4.)) && (PtMaxPhi < (7*TMath::Pi()/4.))) fPtMaxSector = 3;
1745  if((PtMaxPhi > (7*TMath::Pi()/4.)) && (PtMaxPhi < (TMath::Pi()/4.))) fPtMaxSector = 4;
1746  if(PtMaxTrack->Eta()>0) fPtMaxSector += 4;
1747  }
1748  }
1749  return;
1750 }
1752 Bool_t AliV0ReaderV1::ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax){
1753  // MonteCarlo Photon Selection
1754  if(!mcEvent)return kFALSE;
1755 
1756  if (particle->GetPdgCode() == 22){
1757  // check whether particle is within eta range
1758  if( TMath::Abs(particle->Eta()) > etaMax ) return kFALSE;
1759  // check if particle doesn't have a photon as mother
1760  if(particle->GetMother(0) >-1 && mcEvent->Particle(particle->GetMother(0))->GetPdgCode() == 22){
1761  return kFALSE; // no photon as mothers!
1762  }
1763  // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
1764  TParticle* ePos = NULL;
1765  TParticle* eNeg = NULL;
1766  if(particle->GetNDaughters() >= 2){
1767  for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1768  if(daughterIndex<0) continue;
1769  TParticle *tmpDaughter = mcEvent->Particle(daughterIndex);
1770  if(tmpDaughter->GetUniqueID() == 5){
1771  if(tmpDaughter->GetPdgCode() == 11){
1772  eNeg = tmpDaughter;
1773  } else if(tmpDaughter->GetPdgCode() == -11){
1774  ePos = tmpDaughter;
1775  }
1776  }
1777  }
1778  }
1779  if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
1780  return kFALSE;
1781  }
1782  // check if electrons are in correct eta window
1783  if( TMath::Abs(ePos->Eta()) > etaMax ||
1784  TMath::Abs(eNeg->Eta()) > etaMax )
1785  return kFALSE;
1786 
1787  // check if photons have converted in reconstructable range
1788  if(ePos->R() > rMax){
1789  return kFALSE; // cuts on distance from collision point
1790  }
1791  if(TMath::Abs(ePos->Vz()) > zMax){
1792  return kFALSE; // outside material
1793  }
1794  if(TMath::Abs(eNeg->Vz()) > zMax){
1795  return kFALSE; // outside material
1796  }
1797 
1798 
1799  Double_t lineCutZRSlope = tan(2*atan(exp(-etaMax)));
1800  Double_t lineCutZValue = 7.;
1801  if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * lineCutZRSlope) - lineCutZValue)){
1802  return kFALSE; // line cut to exclude regions where we do not reconstruct
1803  }
1804  if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * lineCutZRSlope) - lineCutZValue)){
1805  return kFALSE; // line cut to exclude regions where we do not reconstruct
1806  }
1807 
1808  return kTRUE;
1809  }
1810  return kFALSE;
1811 }
1812 
1815  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1816  Double_t mcProdVtxX = primVtxMC->GetX();
1817  Double_t mcProdVtxY = primVtxMC->GetY();
1818  Double_t mcProdVtxZ = primVtxMC->GetZ();
1819  //cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
1820 
1821  // Loop over all primary MC particle
1822  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
1823  if (fEventCuts->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
1824  // fill primary histogram
1825  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
1826  if (!particle) continue;
1827  if (ParticleIsConvertedPhoton(fMCEvent, particle, 0.9, 180.,250. )){
1828  if(particle->GetFirstDaughter()<0) continue;
1829  TParticle *tmpDaughter = fMCEvent->Particle(particle->GetFirstDaughter());
1830  if (!tmpDaughter) continue;
1831  fHistoMCGammaPtvsR->Fill(particle->Pt(),tmpDaughter->R());
1832  fHistoMCGammaPtvsPhi->Fill(particle->Pt(),particle->Phi());
1833  fHistoMCGammaRvsPhi->Fill(tmpDaughter->R(),particle->Phi());
1834  }
1835  if (ParticleIsConvertedPhoton(fMCEvent, particle, 1.4, 180.,250. )){
1836  if(particle->GetFirstDaughter()<0) continue;
1837  TParticle *tmpDaughter = fMCEvent->Particle(particle->GetFirstDaughter());
1838  if (!tmpDaughter) continue;
1839  fHistoMCGammaPtvsEta->Fill(particle->Pt(),particle->Eta());
1840  fHistoMCGammaRvsEta->Fill(tmpDaughter->R(),particle->Eta());
1841  fHistoMCGammaPhivsEta->Fill(particle->Phi(),particle->Eta());
1842  }
1843  }
1844  }
1845 }
1846 
1849 
1850  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1851  Double_t mcProdVtxX = primVtxMC->GetX();
1852  Double_t mcProdVtxY = primVtxMC->GetY();
1853  Double_t mcProdVtxZ = primVtxMC->GetZ();
1854 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
1855 
1856  Int_t tracklabelPos=currentV0->GetPindex();
1857  Int_t tracklabelNeg=currentV0->GetNindex();
1858 
1859  Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,tracklabelPos)->GetLabel());
1860  Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,tracklabelNeg)->GetLabel());
1861 
1862  TParticle* negPart = 0x0;
1863  if(labeln>-1) negPart = (TParticle *)fMCEvent->Particle(labeln);
1864  TParticle* posPart = 0x0;
1865  if(labelp>-1) posPart = (TParticle *)fMCEvent->Particle(labelp);
1866 
1867  if ( negPart == NULL || posPart == NULL ) return;
1868 // if (!(negPart->GetPdgCode() == 11)) return;
1869 // if (!(posPart->GetPdgCode() == -11)) return;
1870  Long_t motherlabelNeg = negPart->GetFirstMother();
1871  Long_t motherlabelPos = posPart->GetFirstMother();
1872 
1873 // cout << "mother neg " << motherlabelNeg << " mother pos " << motherlabelPos << endl;
1874  if (motherlabelNeg>-1 && motherlabelNeg == motherlabelPos && negPart->GetFirstMother() != -1){
1875  if (fEventCuts->IsConversionPrimaryESD( fMCEvent, negPart->GetFirstMother(), mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
1876 
1877  TParticle* mother = (TParticle *)fMCEvent->Particle(motherlabelNeg);
1878  if (mother->GetPdgCode() == 22 ){
1879  if (!CheckVectorForDoubleCount(fVectorFoundGammas,motherlabelNeg ) ){
1880  if (ParticleIsConvertedPhoton(fMCEvent, mother, 0.9, 180.,250. )){
1881  fHistoRecMCGammaPtvsR->Fill(mother->Pt(),negPart->R());
1882  fHistoRecMCGammaPtvsPhi->Fill(mother->Pt(),mother->Phi());
1883  fHistoRecMCGammaRvsPhi->Fill(negPart->R(),mother->Phi());
1884  }
1885  if (ParticleIsConvertedPhoton(fMCEvent, mother, 1.4, 180.,250. )){
1886  fHistoRecMCGammaPtvsEta->Fill(mother->Pt(),mother->Eta());
1887  fHistoRecMCGammaRvsEta->Fill(negPart->R(),mother->Eta());
1888  fHistoRecMCGammaPhivsEta->Fill(mother->Phi(),mother->Eta());
1889  }
1890 // cout << "new gamma found" << endl;
1891  } else {
1892  if (ParticleIsConvertedPhoton(fMCEvent, mother, 0.9, 180.,250. )){
1893  fHistoRecMCGammaMultiPt->Fill(mother->Pt());
1894  fHistoRecMCGammaMultiPhi->Fill(mother->Phi());
1895  fHistoRecMCGammaMultiR->Fill(negPart->R());
1896  }
1897  if (ParticleIsConvertedPhoton(fMCEvent, mother, 1.4, 180.,250. )){
1898  fHistoRecMCGammaMultiPtvsEta->Fill(mother->Pt(),mother->Eta());
1899  }
1900 // cout << "this one I had already: " << motherlabelNeg << endl << "-----------------------" << endl;
1901  }
1902 // cout << "event gammas: " << endl;
1903 // for(Int_t iGamma=0; iGamma<fVectorFoundGammas.size(); iGamma++){cout << fVectorFoundGammas.at(iGamma) << ", ";}
1904  }
1905  }
1906  }
1907 }
1908 
1909 //_________________________________________________________________________________
1910 void AliV0ReaderV1::FillImpactParamHistograms( AliVTrack* pTrack, AliVTrack* nTrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF){
1911 
1912  // values of cuts to be introduced in 2016 to reduce ESD size
1913  Float_t fZmax = 25; //cm
1914  Float_t fYmax = 25; //cm
1915  Double_t kTPCMargin = 1.0; //cm
1916  Int_t kMaxTPCV0Conflicts = 1; //# conflicting clusters tolerated
1917 
1918  //conversion point
1919  Double_t convX, convY, convZ;
1920  fCurrentV0->GetXYZ(convX,convY,convZ);
1921  Double_t convR = TMath::Sqrt(convX*convX+convY*convY);
1922  //recalculated conversion point
1923  Double_t convXrecalc=fCurrentMotherKF->GetConversionX();
1924  Double_t convYrecalc=fCurrentMotherKF->GetConversionY();
1925  Double_t convZrecalc=fCurrentMotherKF->GetConversionZ();
1926  Double_t convRrecalc = fCurrentMotherKF->GetConversionRadius();
1927 
1928  //count V0s
1929  fHistoImpactParameterStudy->Fill(0);
1930 
1931  //count V0s with two TPC-only tracks
1932  AliESDtrack* positiveTrack = (AliESDtrack*) pTrack;
1933  AliESDtrack* negativeTrack = (AliESDtrack*) nTrack;
1934  Bool_t TPConly = kFALSE;
1935  if (!positiveTrack->IsOn(AliESDtrack::kITSin) && !negativeTrack->IsOn(AliESDtrack::kITSin)){
1936  fHistoImpactParameterStudy->Fill(1);
1937  TPConly = kTRUE;
1938  }
1939 
1940  Bool_t RemovedByZcut = kFALSE;
1941  Bool_t RemovedByYcut = kFALSE;
1942 
1943  //count V0s which have...
1944  if(TPConly){
1945  //not passed z cut: pos.tr. or neg.tr.
1946  if(((TMath::Abs(positiveTrack->GetZ()))>fZmax) || ((TMath::Abs(negativeTrack->GetZ()))>fZmax)){
1947  fHistoImpactParameterStudy->Fill(2);
1948  RemovedByZcut=kTRUE;
1949  }
1950 
1951  //not passed y cut: pos.tr. or neg.tr.
1952  if(((TMath::Abs(positiveTrack->GetY()))>fYmax) || ((TMath::Abs(negativeTrack->GetY()))>fYmax)){
1953  fHistoImpactParameterStudy->Fill(3);
1954  RemovedByYcut=kTRUE;
1955  }
1956  }
1957 
1958  //causality cut
1959  Bool_t RemovedByCausality=kFALSE;
1960  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
1961  const Float_t rTPC[159]={
1962  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,
1963  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,
1964  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,
1965  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,
1966  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,
1967  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,
1968  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,
1969  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,
1970  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,
1971  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,
1972  233.850,235.350,236.850,238.350,239.850,241.350,242.850,244.350,245.850};
1973 
1974  // fill conversion radius histograms
1975  fHistoR->Fill(convR);
1976  fHistoRrecalc->Fill(convRrecalc);
1977  Double_t alpha = TMath::ATan2(convY,convX);
1978  if (alpha<0) alpha += TMath::Pi()*2;
1979  Int_t sec = alpha/(TMath::Pi()/9);
1980  alpha = (10.+sec*20.)*TMath::DegToRad();
1981  Double_t cs = TMath::Cos(alpha);
1982  Double_t sn = TMath::Sin(alpha);
1983  Double_t xsV0 = convX*cs - convY*sn;
1984  fHistoRviaAlpha->Fill(xsV0);
1985  Double_t alpha_r = TMath::ATan2(convYrecalc,convXrecalc);
1986  if (alpha_r<0) alpha_r += TMath::Pi()*2;
1987  Int_t sec_r = alpha_r/(TMath::Pi()/9);
1988  alpha_r = (10.+sec_r*20.)*TMath::DegToRad();
1989  Double_t cs_r = TMath::Cos(alpha_r);
1990  Double_t sn_r = TMath::Sin(alpha_r);
1991  Double_t xsV0_r = convXrecalc*cs_r - convYrecalc*sn_r;
1992  fHistoRviaAlphaRecalc->Fill(xsV0_r);
1993 
1994  if (convR > 80) { // conversion within TPC <-> TPC-only tracks
1995  fHistoImpactParameterStudy->Fill(4);
1996 
1997  for (Int_t it=2;it--;) {
1998  Int_t trId = fCurrentV0->GetIndex(it);
1999  AliESDtrack* tr = fESDEvent->GetTrack(trId);
2000  const TBits& bits = tr->GetTPCClusterMap();
2001  Int_t nConflict = 0;
2002  for (Int_t ic=0;ic<159;ic++) {
2003  if (rTPC[ic]>(xsV0-kTPCMargin)) break;
2004  if (bits.TestBitNumber(ic)){
2005  nConflict++;
2006  fHistoRdiff->Fill(xsV0-rTPC[ic]);
2007  }
2008  if (nConflict>kMaxTPCV0Conflicts) {
2009  fHistoImpactParameterStudy->Fill(5);
2010  RemovedByCausality=kTRUE;
2011  break;
2012  }
2013  }
2014  }
2015  }
2016 
2017  //not passed y or z o causality cut:
2018  Bool_t RemovedByAnyCut=kFALSE;
2019  if(RemovedByZcut||RemovedByYcut||RemovedByCausality){
2020  fHistoImpactParameterStudy->Fill(6);
2021  RemovedByAnyCut=kTRUE;
2022  }
2023 
2024  //Fill tree for further analysis
2025  Float_t posZ;
2026  Float_t posY;
2027  Float_t posX;
2028  Float_t posPt;
2029  Float_t negZ;
2030  Float_t negY;
2031  Float_t negX;
2032  Float_t negPt;
2033  Float_t R;
2034  fImpactParamTree->Branch("posPt",&posPt,"posPt/F");
2035  fImpactParamTree->Branch("posY",&posY,"posY/F");
2036  fImpactParamTree->Branch("R",&R,"R/F");
2037  posZ = positiveTrack->GetZ();
2038  posY = positiveTrack->GetY();
2039  posX = positiveTrack->GetX();
2040  posPt = positiveTrack->Pt();
2041  negZ = negativeTrack->GetZ();
2042  negY = negativeTrack->GetY();
2043  negX = negativeTrack->GetX();
2044  negPt = negativeTrack->Pt();
2045  R=convRrecalc;
2046  fImpactParamTree->Fill();
2047 
2048  // fill impact parameter histograms
2049  fHistoPosTrackImpactParamZ->Fill(posZ);
2050  fHistoPosTrackImpactParamY->Fill(posY);
2051  fHistoPosTrackImpactParamX->Fill(posX);
2052  fHistoPosTrackImpactParamZvsPt->Fill(posPt, posZ);
2053  fHistoPosTrackImpactParamYvsPt->Fill(posPt, posY);
2054  fHistoPosTrackImpactParamXvsPt->Fill(posPt, posX);
2055  fHistoNegTrackImpactParamZ->Fill(negZ);
2056  fHistoNegTrackImpactParamY->Fill(negY);
2057  fHistoNegTrackImpactParamX->Fill(negX);
2058  fHistoNegTrackImpactParamZvsPt->Fill(negPt, negZ);
2059  fHistoNegTrackImpactParamYvsPt->Fill(negPt, negY);
2060  fHistoNegTrackImpactParamXvsPt->Fill(negPt, negX);
2061 
2062  // fill comparison histos before / after new cuts
2063  fHistoPt->Fill(positiveTrack->Pt());
2064  fHistoImpactParamZvsR->Fill(convZrecalc,convRrecalc);
2065  //Float_t *DCAzPhoton;
2066  Float_t DCAzPhoton;
2067  //const AliVVertex *PrimVertex = fInputEvent->GetPrimaryVertex();
2068  AliAODConversionPhoton* fCurrentMother=(AliAODConversionPhoton*)fCurrentMotherKF;
2069  //AliAODConversionPhoton *fCurrentMother=dynamic_cast<AliAODConversionPhoton*>(fCurrentMotherKF);
2070  //fCurrentMotherKF->GetDistanceOfClossetApproachToPrimVtx(PrimVertex, DCAzPhoton);
2071  DCAzPhoton = fCurrentMother->GetDCAzToPrimVtx();
2072  fHistoDCAzPhoton->Fill(DCAzPhoton);
2073  if(!RemovedByAnyCut) {
2074  fHistoPt2->Fill(positiveTrack->Pt());
2075  fHistoImpactParamZvsR2->Fill(convZrecalc,convRrecalc);
2076  fHistoDCAzPhoton2->Fill(DCAzPhoton);
2077  }
2078 
2079  return;
2080 }
2081 
2082 //_________________________________________________________________________________
2083 Bool_t AliV0ReaderV1::CheckVectorOnly(vector<Int_t> &vec, Int_t tobechecked)
2084 {
2085  if(tobechecked > -1)
2086  {
2087  vector<Int_t>::iterator it;
2088  it = find (vec.begin(), vec.end(), tobechecked);
2089  if (it != vec.end()) return true;
2090  else return false;
2091  }
2092  return false;
2093 }
2094 
2095 //_________________________________________________________________________________
2097 {
2098  if(tobechecked > -1)
2099  {
2100  vector<Int_t>::iterator it;
2101  it = find (vec.begin(), vec.end(), tobechecked);
2102  if (it != vec.end()) return true;
2103  else{
2104  vec.push_back(tobechecked);
2105  return false;
2106  }
2107  }
2108  return false;
2109 }
2110 
2111 //________________________________________________________________________
2113 {
2114 
2115 }
2116 
2118  std::iterator<std::bidirectional_iterator_tag, AliConversionPhotonBase>(),
2119  fkData(reader),
2120  fCurrentIndex(position),
2121  fDirection(dir)
2122 {
2123 }
2124 
2126  std::iterator<std::bidirectional_iterator_tag, AliConversionPhotonBase>(other),
2127  fkData(other.fkData),
2129  fDirection(other.fDirection)
2130 {
2131 }
2132 
2134  if(this != &other){
2135  fkData = other.fkData;
2136  fCurrentIndex = other.fCurrentIndex;
2137  fDirection = other.fDirection;
2138  }
2139  return *this;
2140 }
2141 
2143  if(fkData != other.fkData) return true;
2144  return fCurrentIndex != other.fCurrentIndex;
2145 }
2146 
2148  iterator tmp(*this);
2149  operator++();
2150  return tmp;
2151 }
2152 
2155  fCurrentIndex++;
2156  } else {
2157  fCurrentIndex--;
2158  }
2159  return *this;
2160 }
2161 
2163  iterator tmp(*this);
2164  operator--();
2165  return tmp;
2166 }
2167 
2170  fCurrentIndex++;
2171  } else {
2172  fCurrentIndex--;
2173  }
2174  return *this;
2175 }
2176 
2178  return (*fkData)[fCurrentIndex];
2179 }
Int_t IsReaderPerformingRelabeling()
Int_t charge
Direction_t fDirection
Iterator in forward direction.
Definition: AliV0ReaderV1.h:69
void FillAODOutput()
anchored LHC16s pass 1 - jet-jet MC in EPOSLHC
#define P(T, U, S)
double Double_t
Definition: External.C:58
Bool_t ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax)
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 CalculateSphericityMCTrue(AliVEvent *inputEvent)
void SetMCLabelNegative(Int_t label)
Bool_t AreAODsRelabeled()
const AliV0ReaderV1 * fkData
V0 reader used to iterate over.
Definition: AliV0ReaderV1.h:67
void CreatePureMCHistosForV0FinderEffiESD()
Double_t mass
AliConversionPhotonBase * operator*()
Float_t GetDCAzToPrimVtx() const
void CalculateSphericity()
virtual void Init()
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 LHC16f pass 1 low B-field - Pythia8 JJ
anchored LHC13g pass 1 - JJ
anchored LHC13g pass 1 - JJ
int fCurrentIndex
Index of the current element.
Definition: AliV0ReaderV1.h:68
anchored LHC17p/q pass 1 - jet-jet MC w/GEANT3,
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)
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)
anchored LHC12[a-h] pass 2 - JJ
anchored LHC16r pass 1 - jet-jet MC in EPOSLHC
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
void CalculatePtMaxSector()
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.
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
anchored LHC16x pass 1 nom B-field - Pythia8 JJ
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