AliPhysics  e46d415 (e46d415)
AliConversionPhotonCuts.cxx
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Authors: Friederike Bock *
5  * Version 1.0 *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  ***************************************************************************/
15 
17 //---------------------------------------------
18 // Class handling photon selection cuts for
19 // Gamma Conversion analysis
20 //---------------------------------------------
22 
24 
25 #include "AliKFVertex.h"
26 #include "AliAODTrack.h"
27 #include "AliAODv0.h"
28 #include "AliAODEvent.h"
29 #include "AliESDtrack.h"
30 #include "AliAnalysisManager.h"
31 #include "AliInputEventHandler.h"
32 #include "AliMCEventHandler.h"
33 #include "AliAODHandler.h"
34 #include "AliPIDResponse.h"
35 #include "TH1.h"
36 #include "TH2.h"
37 #include "TF1.h"
38 #include "TProfile.h"
39 #include "AliMCEvent.h"
40 #include "AliAODConversionMother.h"
41 #include "TObjString.h"
42 #include "AliAODEvent.h"
43 #include "AliESDEvent.h"
44 #include "AliCentrality.h"
45 #include "TList.h"
46 #include "TFile.h"
47 #include "AliLog.h"
48 #include "AliGenCocktailEventHeader.h"
49 #include "AliGenDPMjetEventHeader.h"
50 #include "AliGenPythiaEventHeader.h"
51 #include "AliGenHijingEventHeader.h"
52 #include "AliTriggerAnalysis.h"
53 #include "AliV0ReaderV1.h"
54 #include "AliAODMCParticle.h"
55 #include "AliAODMCHeader.h"
56 #include "AliTRDTriggerAnalysis.h"
57 
58 class iostream;
59 
60 using namespace std;
61 
65 
66 const char* AliConversionPhotonCuts::fgkCutNames[AliConversionPhotonCuts::kNCuts] = {
67  "V0FinderType", // 0
68  "EtaCut", // 1
69  "MinRCut", // 2
70  "EtaForPhiCut", // 3
71  "MinPhiCut", // 4
72  "MaxPhiCut", // 5
73  "SinglePtCut", // 6
74  "ClsTPCCut", // 7
75  "ededxSigmaCut", // 8
76  "pidedxSigmaCut", // 9
77  "piMomdedxSigmaCut", // 10
78  "piMaxMomdedxSigmaCut", // 11
79  "LowPRejectionSigmaCut", // 12
80  "TOFelectronPID", // 13
81  "ITSelectronPID", // 14 -- new ITS PID
82  "TRDelectronPID", // 15 -- new TRD PID
83  "QtMaxCut", // 16
84  "Chi2GammaCut", // 17
85  "PsiPair", // 18
86  "DoPhotonAsymmetryCut", // 19
87  "CosinePointingAngle", // 20
88  "SharedElectronCuts", // 21
89  "RejectToCloseV0s", // 22
90  "DcaRPrimVtx", // 23
91  "DcaZPrimVtx", // 24
92  "EvetPlane" // 25
93 };
94 
95 
96 //________________________________________________________________________
98  AliAnalysisCuts(name,title),
99  fHistograms(NULL),
100  fPIDResponse(NULL),
101  fDoLightOutput(kFALSE),
102  fV0ReaderName("V0ReaderV1"),
103  fMaxR(200),
104  fMinR(0),
105  fEtaCut(0.9),
106  fEtaCutMin(-0.1),
107  fEtaForPhiCutMin(-10.),
108  fEtaForPhiCutMax(10.),
109  fMinPhiCut(0.),
110  fMaxPhiCut(100.),
111  fDoShrinkTPCAcceptance(kFALSE),
112  fPtCut(0.02),
113  fSinglePtCut(0),
114  fSinglePtCut2(0),
115  fDoAsymPtCut(kFALSE),
116  fMaxZ(1000),
117  fMinClsTPC(0.),
118  fMinClsTPCToF(0.),
119  fLineCutZRSlope(0.),
120  fLineCutZValue(0),
121  fLineCutZRSlopeMin(0.),
122  fLineCutZValueMin(0),
123  fChi2CutConversion(1000),
124  fPIDProbabilityCutNegativeParticle(0),
125  fPIDProbabilityCutPositiveParticle(0),
126  fDodEdxSigmaCut(kTRUE),
127  fDoTOFsigmaCut(kFALSE),
128  fPIDTRDEfficiency(1),
129  fDoTRDPID(kFALSE),
130  fPIDnSigmaAboveElectronLine(100),
131  fPIDnSigmaBelowElectronLine(-100),
132  fTofPIDnSigmaAboveElectronLine(100),
133  fTofPIDnSigmaBelowElectronLine(-100),
134  fPIDnSigmaAbovePionLine(0),
135  fPIDnSigmaAbovePionLineHighPt(-100),
136  fPIDMinPnSigmaAbovePionLine(0),
137  fPIDMaxPnSigmaAbovePionLine(0),
138  fDoKaonRejectionLowP(kFALSE),
139  fDoProtonRejectionLowP(kFALSE),
140  fDoPionRejectionLowP(kFALSE),
141  fPIDnSigmaAtLowPAroundKaonLine(0),
142  fPIDnSigmaAtLowPAroundProtonLine(0),
143  fPIDnSigmaAtLowPAroundPionLine(0),
144  fPIDMinPKaonRejectionLowP(1.5),
145  fPIDMinPProtonRejectionLowP(2),
146  fPIDMinPPionRejectionLowP(0),
147  fDoQtGammaSelection(kTRUE),
148  fDo2DQt(kFALSE),
149  fQtMax(100),
150  fNSigmaMass(0.),
151  fUseEtaMinCut(kFALSE),
152  fUseOnFlyV0Finder(kTRUE),
153  fUseOnFlyV0FinderSameSign(0),
154  fDoPhotonAsymmetryCut(kTRUE),
155  fDoPhotonPDependentAsymCut(kFALSE),
156  fFAsymmetryCut(0),
157  fMinPPhotonAsymmetryCut(100.),
158  fMinPhotonAsymmetry(0.),
159  fUseCorrectedTPCClsInfo(kFALSE),
160  fUseTOFpid(kFALSE),
161  fOpeningAngle(0.005),
162  fPsiPairCut(10000),
163  fDo2DPsiPairChi2(kFALSE),
164  fIncludeRejectedPsiPair(kFALSE),
165  fCosPAngleCut(10000),
166  fDoToCloseV0sCut(kFALSE),
167  fminV0Dist(200.),
168  fDoSharedElecCut(kFALSE),
169  fDoPhotonQualitySelectionCut(kFALSE),
170  fDoPhotonQualityRejectionCut(kFALSE),
171  fPhotonQualityCut(0),
172  fRandom(0),
173  fElectronArraySize(500),
174  fElectronLabelArray(NULL),
175  fDCAZPrimVtxCut(1000),
176  fDCARPrimVtxCut(1000),
177  fInPlaneOutOfPlane(0),
178  fConversionPointXArray(0.0),
179  fConversionPointYArray(0.0),
180  fConversionPointZArray(0.0),
181  fCutString(NULL),
182  fCutStringRead(""),
183  fIsHeavyIon(0),
184  fUseITSpid(kFALSE),
185  fITSPIDnSigmaAboveElectronLine(100),
186  fITSPIDnSigmaBelowElectronLine(-100),
187  fMaxPtPIDITS(1.5),
188  fTRDPIDAboveCut(100),
189  fTRDPIDBelowCut(-100),
190  fDoDoubleCountingCut(kFALSE),
191  fMinRDC(0.),
192  fDeltaR(0.),
193  fOpenAngle(0.),
194  fSwitchToKappa(kFALSE),
195  fKappaMinCut(-1),
196  fKappaMaxCut(1000),
197  fDoElecDeDxPostCalibration(kFALSE),
198  fHistoEtaDistV0s(NULL),
199  fHistoEtaDistV0sAfterdEdxCuts(NULL),
200  fHistodEdxCuts(NULL),
201  fHistoTPCdEdxbefore(NULL),
202  fHistoTPCdEdxafter(NULL),
203  fHistoTPCdEdxSigbefore(NULL),
204  fHistoTPCdEdxSigafter(NULL),
205  fHistoKappaafter(NULL),
206  fHistoTOFbefore(NULL),
207  fHistoTOFSigbefore(NULL),
208  fHistoTOFSigafter(NULL),
209  fHistoITSSigbefore(NULL),
210  fHistoITSSigafter(NULL),
211  fHistoPsiPairDeltaPhiafter(NULL),
212  fHistoTrackCuts(NULL),
213  fHistoPhotonCuts(NULL),
214  fHistoInvMassbefore(NULL),
215  fHistoArmenterosbefore(NULL),
216  fHistoInvMassafter(NULL),
217  fHistoArmenterosafter(NULL),
218  fHistoAsymmetrybefore(NULL),
219  fHistoAsymmetryafter(NULL),
220  fHistoAcceptanceCuts(NULL),
221  fHistoCutIndex(NULL),
222  fHistoEventPlanePhi(NULL),
223  fPreSelCut(kFALSE),
224  fProcessAODCheck(kFALSE),
225  fMaterialBudgetWeightsInitialized(kFALSE),
226  fProfileContainingMaterialBudgetWeights(NULL),
227  fElecDeDxPostCalibrationInitialized(kFALSE),
228  fnRBins(4),
229  fHistoEleMapMean(NULL),
230  fHistoEleMapWidth(NULL),
231  fHistoPosMapMean(NULL),
232  fHistoPosMapWidth(NULL)
233 {
234  InitPIDResponse();
235  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
236  fCutString=new TObjString((GetCutNumber()).Data());
237 
239 
240  fHistoEleMapMean = new TH2F*[fnRBins];
242  fHistoPosMapMean = new TH2F*[fnRBins];
244 
245  for (Int_t i = 0; i < fnRBins; i++) {
246  fHistoEleMapMean[i] = NULL;
247  fHistoEleMapWidth[i] = NULL;
248  fHistoPosMapMean[i] = NULL;
249  fHistoPosMapWidth[i] = NULL;
250  }
251 }
252 
253 //________________________________________________________________________
255  AliAnalysisCuts(ref),
256  fHistograms(NULL),
257  fPIDResponse(NULL),
259  fV0ReaderName("V0ReaderV1"),
260  fMaxR(ref.fMaxR),
261  fMinR(ref.fMinR),
262  fEtaCut(ref.fEtaCut),
263  fEtaCutMin(ref.fEtaCutMin),
266  fMinPhiCut(ref.fMinPhiCut),
267  fMaxPhiCut(ref.fMaxPhiCut),
269  fPtCut(ref.fPtCut),
273  fMaxZ(ref.fMaxZ),
274  fMinClsTPC(ref.fMinClsTPC),
286  fDoTRDPID(ref.fDoTRDPID),
305  fDo2DQt(ref.fDo2DQt),
306  fQtMax(ref.fQtMax),
317  fUseTOFpid(ref.fUseTOFpid),
324  fminV0Dist(ref.fminV0Dist),
329  fRandom(ref.fRandom),
331  fElectronLabelArray(NULL),
338  fCutString(NULL),
339  fCutStringRead(""),
341  fUseITSpid(ref.fUseITSpid),
348  fMinRDC(ref.fMinRDC),
349  fDeltaR(ref.fDeltaR),
350  fOpenAngle(ref.fOpenAngle),
355  fHistoEtaDistV0s(NULL),
357  fHistodEdxCuts(NULL),
358  fHistoTPCdEdxbefore(NULL),
359  fHistoTPCdEdxafter(NULL),
361  fHistoTPCdEdxSigafter(NULL),
362  fHistoKappaafter(NULL),
363  fHistoTOFbefore(NULL),
364  fHistoTOFSigbefore(NULL),
365  fHistoTOFSigafter(NULL),
366  fHistoITSSigbefore(NULL),
367  fHistoITSSigafter(NULL),
369  fHistoTrackCuts(NULL),
370  fHistoPhotonCuts(NULL),
371  fHistoInvMassbefore(NULL),
373  fHistoInvMassafter(NULL),
374  fHistoArmenterosafter(NULL),
375  fHistoAsymmetrybefore(NULL),
376  fHistoAsymmetryafter(NULL),
377  fHistoAcceptanceCuts(NULL),
378  fHistoCutIndex(NULL),
379  fHistoEventPlanePhi(NULL),
380  fPreSelCut(ref.fPreSelCut),
385  fnRBins(ref.fnRBins),
390 {
391  // Copy Constructor
392  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
393  fCutString=new TObjString((GetCutNumber()).Data());
395  // dont copy histograms (if you like histograms, call InitCutHistograms())
396 }
397 
398 
399 //________________________________________________________________________
401  // Destructor
402  //Deleting fHistograms leads to seg fault it it's added to output collection of a task
403  // if(fHistograms)
404  // delete fHistograms;
405  // fHistograms = NULL;
406  if(fCutString != NULL){
407  delete fCutString;
408  fCutString = NULL;
409  }
411  delete fElectronLabelArray;
412  fElectronLabelArray = NULL;
413  }
414 
415  if(fFAsymmetryCut != NULL){
416  delete fFAsymmetryCut;
417  fFAsymmetryCut = NULL;
418  }
422  }
423 
424  // if( fHistoEleMapMean != NULL){
425  // delete fHistoEleMapMean;
426  // fHistoEleMapMean =NULL;
427  // }
428 
429  for (Int_t i = 0; i < fnRBins; i++) {
430  if( fHistoEleMapMean[i] != NULL){
431  delete fHistoEleMapMean[i] ;
432  fHistoEleMapMean[i] =NULL;
433  }
434  if( fHistoEleMapWidth[i] != NULL){
435  delete fHistoEleMapWidth[i] ;
436  fHistoEleMapWidth[i] =NULL;
437  }
438 
439  if( fHistoPosMapMean[i] != NULL){
440  delete fHistoPosMapMean[i] ;
441  fHistoPosMapMean[i] =NULL;
442  }
443  if( fHistoPosMapWidth[i] != NULL){
444  delete fHistoPosMapWidth[i] ;
445  fHistoPosMapWidth[i] =NULL;
446  }
447 
448  }
449 
450 
451 }
452 
453 //________________________________________________________________________
455 
456  // Initialize Cut Histograms for QA (only initialized and filled if function is called)
457  TH1::AddDirectory(kFALSE);
458 
459  if(fHistograms != NULL){
460  delete fHistograms;
461  fHistograms=NULL;
462  }
463  if(fHistograms==NULL){
464  fHistograms=new TList();
465  fHistograms->SetOwner(kTRUE);
466  if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
467  else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
468  }
469 
470  // IsPhotonSelected
471  fHistoCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",12,-0.5,11.5);
472  fHistoCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
473  fHistoCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
474  fHistoCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
475  fHistoCutIndex->GetXaxis()->SetBinLabel(kNoV0+1,"miss. V0 in AOD");
476  if (!fSwitchToKappa)fHistoCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"PID");
477  else fHistoCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"Kappa+[TOF,ITS,TRD] PID");
478  fHistoCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
479  fHistoCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
480  fHistoCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
481  fHistoCutIndex->GetXaxis()->SetBinLabel(kEventPlane+1,"EventPlane");
482  fHistoCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
484 
485  // Track Cuts
486  fHistoTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
487  fHistoTrackCuts->GetXaxis()->SetBinLabel(1,"in");
488  fHistoTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
489  fHistoTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
490  fHistoTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
491  fHistoTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
492  fHistoTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
493  fHistoTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
494  fHistoTrackCuts->GetXaxis()->SetBinLabel(8,"out");
496 
497  // Photon Cuts
498  fHistoPhotonCuts=new TH2F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts vs p_{T,#gamma}",15,-0.5,14.5,250,0,50);
499  fHistoPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
500  fHistoPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
501  fHistoPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
502  fHistoPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
503  fHistoPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
504  fHistoPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
505  fHistoPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
506  fHistoPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
507  fHistoPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
508  fHistoPhotonCuts->GetXaxis()->SetBinLabel(10,"DCA R");
509  fHistoPhotonCuts->GetXaxis()->SetBinLabel(11,"DCA Z");
510  fHistoPhotonCuts->GetXaxis()->SetBinLabel(12,"Photon Quality");
511  fHistoPhotonCuts->GetXaxis()->SetBinLabel(13,"out");
513 
515  fProfileContainingMaterialBudgetWeights->SetName("InputMaterialBudgetWeightsPerGamma");
517  }
518 
520  for (Int_t i = 0; i < fnRBins; i++) {
521  if( fHistoEleMapMean[i] ){
522  fHistograms->Add(fHistoEleMapMean[i]);
523  }
524  if( fHistoEleMapWidth[i]){
526  }
527  if(fHistoPosMapMean[i]){
528  fHistograms->Add(fHistoPosMapMean[i]);
529  }
530  if( fHistoPosMapWidth[i]){
532  }
533  }
534  }
535 
536  if(!fDoLightOutput){
537 
538  if(preCut){
539  fHistoInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
541  fHistoArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
543  fHistoEtaDistV0s = new TH1F(Form("Eta_before %s",GetCutNumber().Data()),"Eta_before",2000,-2,2);
545  fHistoAsymmetrybefore=new TH2F(Form("Asymmetry_before %s",GetCutNumber().Data()),"Asymmetry_before",150,0.03,20.,200,0,1.);
547  }
548  fHistoInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
550  fHistoArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
552  // AM - save always to see distribution after selections cut
553  // if(fDoPhotonAsymmetryCut){
554  fHistoAsymmetryafter=new TH2F(Form("Asymmetry_after %s",GetCutNumber().Data()),"Asymmetry_after",150,0.03,20.,200,0,1.);
556  // }
557  }
558 
559  fHistoAcceptanceCuts=new TH2F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts vs p_{T,#gamma}",11,-0.5,10.5,250,0,50);
560  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
561  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
562  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
563  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
564  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
565  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
566  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(7,"phisector");
567  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(8,"minpt");
568  fHistoAcceptanceCuts->GetXaxis()->SetBinLabel(9,"out");
570 
571  // dEdx Cuts
572  fHistodEdxCuts=new TH2F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts vs p_{T,e}",11,-0.5,10.5,250,0,50);
573  fHistodEdxCuts->GetXaxis()->SetBinLabel(1,"in");
574  fHistodEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
575  fHistodEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
576  fHistodEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
577  fHistodEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
578  fHistodEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
579  fHistodEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
580  fHistodEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
581  fHistodEdxCuts->GetXaxis()->SetBinLabel(9,"ITSelectron");
582  fHistodEdxCuts->GetXaxis()->SetBinLabel(10,"TRDelectron");
583  fHistodEdxCuts->GetXaxis()->SetBinLabel(11,"out");
585 
586  if(!fDoLightOutput){
587  TAxis *AxisBeforedEdx = NULL;
588  TAxis *AxisBeforedEdxSig = NULL;
589  TAxis *AxisBeforeTOF = NULL;
590  TAxis *AxisBeforeTOFSig = NULL;
591  TAxis *AxisBeforeITSSig = NULL;
592  TAxis *AxisBeforeAsymmetry = NULL;
593 
594  if(preCut){
595  fHistoTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
597  AxisBeforedEdx = fHistoTPCdEdxbefore->GetXaxis();
598  fHistoTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
600  AxisBeforedEdxSig = fHistoTPCdEdxSigbefore->GetXaxis();
601 
602  fHistoTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
604  AxisBeforeTOF = fHistoTOFbefore->GetXaxis();
605  fHistoTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
607  AxisBeforeTOFSig = fHistoTOFSigbefore->GetXaxis();
608 
609  fHistoITSSigbefore=new TH2F(Form("Gamma_ITSSig_before %s",GetCutNumber().Data()),"ITS Sigma Gamma before" ,150,0.03,20,400,-10,10);
611  AxisBeforeITSSig = fHistoITSSigbefore->GetXaxis();
612 
613  AxisBeforeAsymmetry = fHistoAsymmetrybefore->GetXaxis();
614  }
615 
616  fHistoTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
618 
619  fHistoTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
621 
622  fHistoKappaafter=new TH2F(Form("Gamma_Kappa_after %s",GetCutNumber().Data()),"Kappa Gamma after" ,150,0.03,20,200,-20,20);
624 
625  fHistoTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
627 
628  fHistoITSSigafter=new TH2F(Form("Gamma_ITSSig_after %s",GetCutNumber().Data()),"ITS Sigma Gamma after" ,150,0.03,20,400,-10,10);
630 
631  fHistoEtaDistV0sAfterdEdxCuts = new TH1F(Form("Eta_afterdEdx %s",GetCutNumber().Data()),"Eta_afterdEdx",2000,-2,2);
633 
634  fHistoPsiPairDeltaPhiafter=new TH2F(Form("Gamma_PsiPairDeltaPhi_after %s",GetCutNumber().Data()),"Psi Pair vs Delta Phi Gamma after" ,200,-2,2,200,-2,2);
636 
637  TAxis *AxisAfter = fHistoTPCdEdxSigafter->GetXaxis();
638  Int_t bins = AxisAfter->GetNbins();
639  Double_t from = AxisAfter->GetXmin();
640  Double_t to = AxisAfter->GetXmax();
641  Double_t *newBins = new Double_t[bins+1];
642  newBins[0] = from;
643  Double_t factor = TMath::Power(to/from, 1./bins);
644  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
645  AxisAfter->Set(bins, newBins);
646  AxisAfter = fHistoTOFSigafter->GetXaxis();
647  AxisAfter->Set(bins, newBins);
648  AxisAfter = fHistoTPCdEdxafter->GetXaxis();
649  AxisAfter->Set(bins, newBins);
650  AxisAfter = fHistoKappaafter->GetXaxis();
651  AxisAfter->Set(bins, newBins);
652  AxisAfter = fHistoITSSigafter->GetXaxis();
653  AxisAfter->Set(bins, newBins);
654  // if(fDoPhotonAsymmetryCut){
655  AxisAfter = fHistoAsymmetryafter->GetXaxis();
656  AxisAfter->Set(bins, newBins);
657  // }
658  if(preCut){
659  AxisBeforedEdx->Set(bins, newBins);
660  AxisBeforeTOF->Set(bins, newBins);
661  AxisBeforedEdxSig->Set(bins, newBins);
662  AxisBeforeTOFSig->Set(bins, newBins);
663  AxisBeforeITSSig->Set(bins, newBins);
664  AxisBeforeAsymmetry->Set(bins, newBins);
665  }
666  delete [] newBins;
667 
668  // Event Cuts and Info
669  if(!preCut){
670  fHistoEventPlanePhi=new TH1F(Form("EventPlaneMinusPhotonAngle %s",GetCutNumber().Data()),"EventPlaneMinusPhotonAngle",360,-TMath::Pi(),TMath::Pi());
672  }
673  }
674 
675  TH1::AddDirectory(kTRUE);
676 }
677 
678 //________________________________________________________________________
680  // Set Pointer to AliPIDResponse
681 
682  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
683  if(man) {
684  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
685  fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
686  if(fPIDResponse)return kTRUE;
687 
688  }
689 
690 
691  return kFALSE;
692 }
695 
696  AliInfo("Entering loading of correction map for post calibration");
697 
698  TFile *file = TFile::Open(filename.Data());
699  if(!file){
700  AliError(Form("file for electron dEdx post calibration %s not found",filename.Data()));
701  return kFALSE;
702  }else{
703  AliInfo(Form("found %s ",filename.Data()));
704  }
705 
706  for(Int_t i=0;i<fnRBins;i++){
707  fHistoEleMapMean[i] = (TH2F*)file->Get(Form("Ele_R%d_mean",i));
708  fHistoEleMapWidth[i] = (TH2F*)file->Get(Form("Ele_R%d_width",i));
709  fHistoPosMapMean[i] = (TH2F*)file->Get(Form("Pos_R%d_mean",i));
710  fHistoPosMapWidth[i] = (TH2F*)file->Get(Form("Pos_R%d_width",i));
711  }
712  if (fHistoEleMapMean[0] == NULL || fHistoEleMapWidth[0] == NULL ||
713  fHistoEleMapMean[1] == NULL || fHistoEleMapWidth[1] == NULL ||
714  fHistoEleMapMean[2] == NULL || fHistoEleMapWidth[2] == NULL ||
715  fHistoEleMapMean[3] == NULL || fHistoEleMapWidth[3] == NULL ){
716  AliError("Histograms for dedx post calibration not found not found");
717  return kFALSE;// do nothing if correction map is not avaible
718  }
719  for(Int_t i=0;i<fnRBins;i++){
720  fHistoEleMapMean[i] ->SetDirectory(0);
721  fHistoEleMapWidth[i] ->SetDirectory(0);
722  fHistoPosMapMean[i] ->SetDirectory(0);
723  fHistoPosMapWidth[i] ->SetDirectory(0);
724  }
725 
726  file->Close();
727  delete file;
729  return kTRUE;
730 }
731 //_________________________________________________________________________
733 
734  Double_t Charge = charge;
735  Double_t CornSig = nsig;
736  Double_t mean = 1.;
737  Double_t width = 1.;
738  //X axis 12 Y axis 18 ... common for all R slice
739  Int_t BinP=4; // default value
740  Int_t BinEta=9; // default value
741 
742  if(Charge<0){
743  if (fHistoEleMapMean[0] == NULL || fHistoEleMapWidth[0] == NULL ||
744  fHistoEleMapMean[1] == NULL || fHistoEleMapWidth[1] == NULL ||
745  fHistoEleMapMean[2] == NULL || fHistoEleMapWidth[2] == NULL ||
746  fHistoEleMapMean[3] == NULL || fHistoEleMapWidth[3] == NULL ){
747  cout<< " histograms are null..., going out"<< endl;
748  return CornSig;// do nothing if correction map is not avaible
749  }
750 
751  BinP = fHistoEleMapMean[0]->GetXaxis()->FindBin(P);
752  BinEta = fHistoEleMapMean[0]->GetYaxis()->FindBin(Eta);
753 
754 
755 
756  if( R > 0. && R < 33.5){//0,33.5,72,145., 180 cm
757  if(P>0. && P<10.){
758  mean = fHistoEleMapMean[0]->GetBinContent(BinP,BinEta);
759  width = fHistoEleMapWidth[0]->GetBinContent(BinP,BinEta);
760  }else if(P>=10.){// use bin edge value
761  mean = fHistoEleMapMean[0]->GetBinContent(12,BinEta);;
762  width = fHistoEleMapWidth[0]->GetBinContent(12,BinEta);
763  }
764  }else if( R >= 30.5 && R < 72.){
765  if(P>0. && P<10.){
766  mean = fHistoEleMapMean[1]->GetBinContent(BinP,BinEta);
767  width = fHistoEleMapWidth[1]->GetBinContent(BinP,BinEta);
768  }else if(P>=10.){// use bin edge value
769  mean = fHistoEleMapMean[1]->GetBinContent(12,BinEta);
770  width = fHistoEleMapWidth[1]->GetBinContent(12,BinEta);
771  }
772  }else if( R >= 72. && R < 145.){
773  if(P>0. && P<10.){
774  mean = fHistoEleMapMean[2]->GetBinContent(BinP,BinEta);
775  width = fHistoEleMapWidth[2]->GetBinContent(BinP,BinEta);
776  }else if(P>=10.){// use bin edge value
777  mean = fHistoEleMapMean[2]->GetBinContent(12,BinEta);
778  width = fHistoEleMapWidth[2]->GetBinContent(12,BinEta);
779  }
780  }else if( R >= 145. && R < 180.){
781  if(P>0. && P<10.){
782  mean = fHistoEleMapMean[3]->GetBinContent(BinP,BinEta);
783  width = fHistoEleMapWidth[3]->GetBinContent(BinP,BinEta);
784  }else if(P>=10.){// use bin edge value
785  mean = fHistoEleMapMean[3]->GetBinContent(12,BinEta);
786  width = fHistoEleMapWidth[3]->GetBinContent(12,BinEta);
787  }
788  }else{
789  mean = 0.;
790  width = 1.;
791  }
792  }else{
793  //X axis 12 Y axis 18 ... common for all R slice
794  if (fHistoPosMapMean[0] == NULL || fHistoPosMapWidth[0] == NULL ||
795  fHistoPosMapMean[1] == NULL || fHistoPosMapWidth[1] == NULL ||
796  fHistoPosMapMean[2] == NULL || fHistoPosMapWidth[2] == NULL ||
797  fHistoPosMapMean[3] == NULL || fHistoPosMapWidth[3] == NULL ){
798  cout<< " histograms are null..., going out"<< endl;
799  return CornSig;// do nothing if correction map is not avaible
800  }
801 
802  BinP = fHistoPosMapMean[0]->GetXaxis()->FindBin(P);
803  BinEta = fHistoPosMapMean[0]->GetYaxis()->FindBin(Eta);
804 
805  if( R > 0. && R < 33.5){//0,33.5,72.,145.,180. cm
806  if(P>0. && P<10.){
807  mean = fHistoPosMapMean[0]->GetBinContent(BinP,BinEta);
808  width = fHistoPosMapWidth[0]->GetBinContent(BinP,BinEta);
809  }else if(P>=10.){// use bin edge value
810  mean = fHistoPosMapMean[0]->GetBinContent(12,BinEta);;
811  width = fHistoPosMapWidth[0]->GetBinContent(12,BinEta);
812  }
813  }else if( R >= 33.5 && R < 72.){
814  if(P>0. && P<10.){
815  mean = fHistoPosMapMean[1]->GetBinContent(BinP,BinEta);
816  width = fHistoPosMapWidth[1]->GetBinContent(BinP,BinEta);
817  }else if(P>=10.){// use bin edge value
818  mean = fHistoPosMapMean[1]->GetBinContent(12,BinEta);
819  width = fHistoPosMapWidth[1]->GetBinContent(12,BinEta);
820  }
821  }else if( R >= 72. && R < 145.){
822  if(P>0. && P<10.){
823  mean = fHistoPosMapMean[2]->GetBinContent(BinP,BinEta);
824  width = fHistoPosMapWidth[2]->GetBinContent(BinP,BinEta);
825  }else if(P>=10.){// use bin edge value
826  mean = fHistoPosMapMean[2]->GetBinContent(12,BinEta);
827  width = fHistoPosMapWidth[2]->GetBinContent(12,BinEta);
828  }
829  }else if( R >= 145. && R < 180.){
830  if(P>0. && P<10.){
831  mean = fHistoPosMapMean[3]->GetBinContent(BinP,BinEta);
832  width = fHistoPosMapWidth[3]->GetBinContent(BinP,BinEta);
833  }else if(P>=10.){// use bin edge value
834  mean = fHistoPosMapMean[3]->GetBinContent(12,BinEta);
835  width = fHistoPosMapWidth[3]->GetBinContent(12,BinEta);
836  }
837  }else{
838  mean = 0.;
839  width = 1.;
840  }
841  }
842  if (width!=0.){
843  CornSig = (nsig - mean) / width;
844  }
845  return CornSig;
846 }
848 Bool_t AliConversionPhotonCuts::PhotonIsSelectedMC(TParticle *particle,AliMCEvent *mcEvent,Bool_t checkForConvertedGamma){
849  // MonteCarlo Photon Selection
850 
851  if(!mcEvent)return kFALSE;
852 
853  if (particle->GetPdgCode() == 22){
854 
855 
856  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
857  return kFALSE;
858  if(fEtaCutMin>-0.1){
859  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
860  return kFALSE;
861  }
862 
863  if(particle->GetMother(0) >-1 && mcEvent->Particle(particle->GetMother(0))->GetPdgCode() == 22){
864  return kFALSE; // no photon as mothers!
865  }
866 
867  // removed, decision on primary and secondary taken in main task
868 // if(particle->GetMother(0) >= mcEvent->GetNumberOfPrimaries()){
869 // return kFALSE; // the gamma has a mother, and it is not a primary particle
870 // }
871 
872  if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
873 
874  // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
875  TParticle* ePos = NULL;
876  TParticle* eNeg = NULL;
877 
878  if(particle->GetNDaughters() >= 2){
879  for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
880  if(daughterIndex<0) continue;
881  TParticle *tmpDaughter = mcEvent->Particle(daughterIndex);
882  if(tmpDaughter->GetUniqueID() == 5){
883  if(tmpDaughter->GetPdgCode() == 11){
884  eNeg = tmpDaughter;
885  } else if(tmpDaughter->GetPdgCode() == -11){
886  ePos = tmpDaughter;
887  }
888  }
889  }
890  }
891 
892  if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
893  return kFALSE;
894  }
895 
896  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
897  eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
898  return kFALSE;
899 
900  if(fEtaCutMin > -0.1){
901  if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
902  (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
903  return kFALSE;
904  }
905 
906  if(ePos->R()>fMaxR){
907  return kFALSE; // cuts on distance from collision point
908  }
909 
910  if(TMath::Abs(ePos->Vz()) > fMaxZ){
911  return kFALSE; // outside material
912  }
913  if(TMath::Abs(eNeg->Vz()) > fMaxZ){
914  return kFALSE; // outside material
915  }
916 
917  if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
918  return kFALSE; // line cut to exclude regions where we do not reconstruct
919  } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((TMath::Abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
920  return kFALSE;
921  }
922 
923  if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
924  return kFALSE; // line cut to exclude regions where we do not reconstruct
925  } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((TMath::Abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
926  return kFALSE;
927  }
928 
929  return kTRUE;
930  //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
931  }
932  return kFALSE;
933 }
935 Bool_t AliConversionPhotonCuts::PhotonIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){
936  // MonteCarlo Photon Selection
937 
938  if(!aodmcArray)return kFALSE;
939 
940  if (particle->GetPdgCode() == 22){
941  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
942  return kFALSE;
943  if(fEtaCutMin>-0.1){
944  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
945  return kFALSE;
946  }
947 
948  if(particle->GetMother() > -1 && (static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
949  return kFALSE; // no photon as mothers!
950  }
951 
952  if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
953 
954  // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
955  AliAODMCParticle* ePos = NULL;
956  AliAODMCParticle* eNeg = NULL;
957 
958  if(particle->GetNDaughters() >= 2){
959  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
960  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(aodmcArray->At(daughterIndex));
961  if(!tmpDaughter) continue;
962  if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
963  if(tmpDaughter->GetPdgCode() == 11){
964  eNeg = tmpDaughter;
965  } else if(tmpDaughter->GetPdgCode() == -11){
966  ePos = tmpDaughter;
967  }
968  }
969  }
970  }
971 
972  if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
973  return kFALSE;
974  }
975 
976  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
977  eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
978  return kFALSE;
979 
980  if(fEtaCutMin > -0.1){
981  if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
982  (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
983  return kFALSE;
984  }
985 
986  Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) );
987  Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) );
988 
989  if(rPos>fMaxR){
990  return kFALSE; // cuts on distance from collision point
991  }
992  if(TMath::Abs(ePos->Zv()) > fMaxZ){
993  return kFALSE; // outside material
994  }
995  if(TMath::Abs(eNeg->Zv()) > fMaxZ){
996  return kFALSE; // outside material
997  }
998 
999  if( rPos <= ((TMath::Abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
1000  return kFALSE; // line cut to exclude regions where we do not reconstruct
1001  } else if ( fEtaCutMin != -0.1 && rPos >= ((TMath::Abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
1002  return kFALSE;
1003  }
1004 
1005  if( rNeg <= ((TMath::Abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
1006  return kFALSE; // line cut to exclude regions where we do not reconstruct
1007  } else if ( fEtaCutMin != -0.1 && rNeg >= ((TMath::Abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
1008  return kFALSE;
1009  }
1010 
1011  return kTRUE;
1012  //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
1013  }
1014  return kFALSE;
1015 }
1016 
1018 Bool_t AliConversionPhotonCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event){ // Specific Photon Cuts
1019 
1020  Int_t cutIndex = 0;
1021  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt());
1022  cutIndex++;
1023 
1024  AliVTrack * electronCandidate = GetTrack(event,photon->GetTrackLabelNegative());
1025  AliVTrack * positronCandidate = GetTrack(event,photon->GetTrackLabelPositive());
1026 
1027  // Fill Histos before Cuts
1028  if(fHistoInvMassbefore)fHistoInvMassbefore->Fill(photon->GetMass());
1031  if(photon->GetPhotonP()!=0 && electronCandidate->P()!=0)fHistoAsymmetrybefore->Fill(photon->GetPhotonP(),electronCandidate->P()/photon->GetPhotonP());
1032  }
1033  // Gamma selection based on QT from Armenteros
1034  if(fDoQtGammaSelection == kTRUE){
1035  if(!ArmenterosQtCut(photon)){
1036  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //1
1037  return kFALSE;
1038  }
1039  }
1040  cutIndex++; //2
1041 
1042  // Chi Cut
1043  if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
1044  {
1045  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //2
1046  return kFALSE;
1047  }
1048  }
1049  cutIndex++;//3
1050 
1051  // Reconstruction Acceptance Cuts
1052  if(!AcceptanceCuts(photon)){
1053  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //3
1054  return kFALSE;
1055  }
1056 
1057  cutIndex++; //4
1058  // Asymmetry Cut
1059  if(fDoPhotonAsymmetryCut == kTRUE){
1060  if(!AsymmetryCut(photon,event)){
1061  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //4
1062  return kFALSE;
1063  }
1064  }
1065 
1066  //Check the pid probability
1067  cutIndex++; //5
1068  if(!PIDProbabilityCut(photon, event)) {
1069  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //5
1070  return kFALSE;
1071  }
1072 
1073  cutIndex++; //6
1074  if(!CorrectedTPCClusterCut(photon, event)) {
1075  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //6
1076  return kFALSE;
1077  }
1078 
1079  Double_t magField = event->GetMagneticField();
1080  if( magField < 0.0 ){
1081  magField = 1.0;
1082  } else {
1083  magField = -1.0;
1084  }
1085 
1086  Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->Phi()-positronCandidate->Phi());
1087 
1088  cutIndex++; //7
1089  if(!PsiPairCut(photon)) {
1090  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //7
1091  return kFALSE;
1092  }
1093 
1094  cutIndex++; //8
1095  if(!CosinePAngleCut(photon, event)) {
1096  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //8
1097  return kFALSE;
1098  }
1099 
1100  AliAODConversionPhoton* photonAOD = dynamic_cast<AliAODConversionPhoton*>(photon);
1101  if (photonAOD){
1102  photonAOD->CalculateDistanceOfClossetApproachToPrimVtx(event->GetPrimaryVertex());
1103 
1104  cutIndex++; //9
1105  if(photonAOD->GetDCArToPrimVtx() > fDCARPrimVtxCut) { //DCA R cut of photon to primary vertex
1106  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //9
1107  return kFALSE;
1108  }
1109 
1110  cutIndex++; //10
1111  if(TMath::Abs(photonAOD->GetDCAzToPrimVtx()) > fDCAZPrimVtxCut) { //DCA Z cut of photon to primary vertex
1112  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //10
1113  return kFALSE;
1114  }
1115  } else {
1116  cutIndex++; //9
1117  cutIndex++; //10
1118  }
1119  cutIndex++; //11
1120 
1121  if (photonAOD){
1122  UChar_t photonQuality = 0;
1123  AliAODEvent * aodEvent = dynamic_cast<AliAODEvent*>(event);
1124  if(aodEvent) {
1125  photonQuality = DeterminePhotonQualityAOD(photonAOD, event);
1126  } else {
1127  photonQuality = photonAOD->GetPhotonQuality();
1128  }
1129  if (fDoPhotonQualitySelectionCut && photonQuality != fPhotonQualityCut){
1130  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //11
1131  return kFALSE;
1132  }
1133  if (fDoPhotonQualityRejectionCut && photonQuality == fPhotonQualityCut){
1134  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //11
1135  return kFALSE;
1136  }
1137  }
1138  cutIndex++; //12
1139  if(fHistoPhotonCuts)fHistoPhotonCuts->Fill(cutIndex, photon->GetPhotonPt()); //11
1140 
1141  // Histos after Cuts
1142  if(fHistoInvMassafter)fHistoInvMassafter->Fill(photon->GetMass());
1145  if(fHistoKappaafter)fHistoKappaafter->Fill(photon->GetPhotonPt(), GetKappaTPC(photon, event));
1147  if(photon->GetPhotonP()!=0 && electronCandidate->P()!=0)fHistoAsymmetryafter->Fill(photon->GetPhotonP(),electronCandidate->P()/photon->GetPhotonP());
1148  }
1149  return kTRUE;
1150 
1151 }
1152 
1154 Bool_t AliConversionPhotonCuts::CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event){ //Cut on corrected TPC Cluster Info
1155 
1156  AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1157  AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1158 
1159  if(!negTrack||!posTrack)return kFALSE;
1160 
1161  Double_t negclsToF=0;
1162 
1163  if (!fUseCorrectedTPCClsInfo ){
1164  if(negTrack->GetTPCNclsF()!=0){
1165  negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
1166  }
1167  else {
1168  negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1169  }
1170 
1171  Double_t posclsToF = 0.;
1172  if (!fUseCorrectedTPCClsInfo ){
1173  if(posTrack->GetTPCNclsF()!=0){
1174  posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
1175  }
1176  }else{
1177  posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1178  }
1179 
1180  if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
1181  return kFALSE;
1182  }
1183 
1184  return kTRUE;
1185 }
1186 
1189  //Selection of Reconstructed Photons
1190 
1192 
1193  if(event->IsA()==AliESDEvent::Class()) {
1194  if(!SelectV0Finder( ( ((AliESDEvent*)event)->GetV0(photon->GetV0Index()))->GetOnFlyStatus() ) ){
1196  return kFALSE;
1197  }
1198  }
1199 
1200  // Get Tracks
1201  AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1202  AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1203 
1204  if(!negTrack || !posTrack) {
1206  return kFALSE;
1207  }
1208 
1209  // check if V0 from AliAODGammaConversion.root is actually contained in AOD by checking if V0 exists with same tracks
1210  if(event->IsA()==AliAODEvent::Class() && fPreSelCut && ( fIsHeavyIon != 1 || (fIsHeavyIon == 1 && fProcessAODCheck) )) {
1211  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(event);
1212 
1213  Bool_t bFound = kFALSE;
1214  Int_t v0PosID = posTrack->GetID();
1215  Int_t v0NegID = negTrack->GetID();
1216  AliAODv0* v0 = NULL;
1217  for(Int_t iV=0; iV<aodEvent->GetNumberOfV0s(); iV++){
1218  v0 = aodEvent->GetV0(iV);
1219  if(!v0) continue;
1220  if( (v0PosID == v0->GetPosID() && v0NegID == v0->GetNegID()) || (v0PosID == v0->GetNegID() && v0NegID == v0->GetPosID()) ){
1221  bFound = kTRUE;
1222  break;
1223  }
1224  }
1225  if(!bFound){
1227  return kFALSE;
1228  }
1229  }
1230 
1231  photon->DeterminePhotonQuality(negTrack,posTrack);
1232 
1233  // Track Cuts
1234  if(!TracksAreSelected(negTrack, posTrack)){
1236  return kFALSE;
1237  }
1238  if (fHistoEtaDistV0s)fHistoEtaDistV0s->Fill(photon->GetPhotonEta());
1239 
1240  // dEdx Cuts
1241  // if(fDoElecDeDxPostCalibration && fElecDeDxPostCalibrationInitialized){
1242  if(!KappaCuts(photon, event) || !dEdxCuts(negTrack,photon) || !dEdxCuts(posTrack,photon)) {
1244  return kFALSE;
1245  }
1246 
1248  // Photon Cuts
1249  if(!PhotonCuts(photon,event)){
1251  return kFALSE;
1252  }
1253 
1254  // Photon passed cuts
1256  return kTRUE;
1257 }
1258 
1261  if(fDo2DQt){
1262  if ( !(TMath::Power(photon->GetArmenterosAlpha()/0.95,2)+TMath::Power(photon->GetArmenterosQt()/fQtMax,2) < 1) ){
1263  return kFALSE;
1264  }
1265  } else {
1266  if(photon->GetArmenterosQt()>fQtMax){
1267  return kFALSE;
1268  }
1269  }
1270  return kTRUE;
1271 }
1272 
1273 
1276  // Exclude certain areas for photon reconstruction
1277 
1278  Int_t cutIndex=0;
1279  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1280  cutIndex++;
1281 
1282  if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
1283  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1284  return kFALSE;
1285  }
1286  cutIndex++;
1287 
1288  if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
1289  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1290  return kFALSE;
1291  }
1292  cutIndex++;
1293 
1294  if(photon->GetConversionRadius() <= ((TMath::Abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
1295  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1296  return kFALSE;
1297  }
1298  else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((TMath::Abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1299  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1300  return kFALSE;
1301  }
1302  cutIndex++;
1303 
1304  if(TMath::Abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1305  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1306  return kFALSE;
1307  }
1308  cutIndex++;
1309 
1310 
1311  if( photon->GetPhotonEta() > (fEtaCut) || photon->GetPhotonEta() < (-fEtaCut) ){
1312  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1313  return kFALSE;
1314  }
1315  if(fEtaCutMin>-0.1){
1316  if( photon->GetPhotonEta() < (fEtaCutMin) && photon->GetPhotonEta() > (-fEtaCutMin) ){
1317  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1318  return kFALSE;
1319  }
1320  }
1321  cutIndex++;
1322 
1324  if(photon->GetPhotonEta() > fEtaForPhiCutMin && photon->GetPhotonEta() < fEtaForPhiCutMax ){
1325  if (fMinPhiCut < fMaxPhiCut){
1326  if( photon->GetPhotonPhi() > fMinPhiCut && photon->GetPhotonPhi() < fMaxPhiCut ) {
1327  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1328  return kFALSE;
1329  }
1330  } else {
1331  Double_t photonPhi = photon->GetPhotonPhi();
1332  if (photon->GetPhotonPhi() < TMath::Pi()) photonPhi = photon->GetPhotonPhi() + 2*TMath::Pi();
1333  if( photonPhi > fMinPhiCut && photonPhi < fMaxPhiCut+2*TMath::Pi() ) {
1334  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1335  return kFALSE;
1336  }
1337  }
1338  }
1339  }
1340  cutIndex++;
1341 
1342 
1343 
1344  if(photon->GetPhotonPt()<fPtCut){
1345  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1346  return kFALSE;
1347  }
1348  cutIndex++;
1349 
1350  if(fHistoAcceptanceCuts)fHistoAcceptanceCuts->Fill(cutIndex, photon->GetPhotonPt());
1351 
1352  return kTRUE;
1353 }
1354 
1355 
1357 Bool_t AliConversionPhotonCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
1358  // Track Cuts which require AOD/ESD specific implementation
1359 
1360  if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1361  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1362  return kFALSE;
1363  }
1364  cutIndex++;
1365 
1366  AliAODVertex * NegVtxType=negTrack->GetProdVertex();
1367  AliAODVertex * PosVtxType=posTrack->GetProdVertex();
1368  if( (NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
1369  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1370  return kFALSE;
1371  }
1372  return kTRUE;
1373 
1374 }
1375 
1376 
1378 Bool_t AliConversionPhotonCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
1379  // Track Cuts which require AOD/ESD specific implementation
1380 
1381  if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1382  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1383  return kFALSE;
1384  }
1385  cutIndex++;
1386 
1387  if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
1388  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1389  return kFALSE;
1390  }
1391  return kTRUE;
1392 }
1393 
1394 
1395 
1397 Bool_t AliConversionPhotonCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1398  // Track Selection for Photon Reconstruction
1399 
1400  Int_t cutIndex=0;
1401  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1402  cutIndex++;
1403 
1404  // avoid like sign
1406  if(negTrack->Charge() == posTrack->Charge()) {
1407  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1408  return kFALSE;
1409  }
1410  }else if(fUseOnFlyV0FinderSameSign==1){
1411  if(negTrack->Charge() != posTrack->Charge()) {
1412  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1413  return kFALSE;
1414  }
1415  }
1416  cutIndex++;
1417 
1418  // Number of TPC Clusters
1419 
1420 
1421  if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1422  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1423  return kFALSE;
1424  }
1425  cutIndex++;
1426 
1427  // Acceptance
1428  if( posTrack->Eta() > (fEtaCut) || posTrack->Eta() < (-fEtaCut) ||
1429  negTrack->Eta() > (fEtaCut) || negTrack->Eta() < (-fEtaCut) ){
1430  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1431  return kFALSE;
1432  }
1433  if(fEtaCutMin>-0.1){
1434  if( (posTrack->Eta() < (fEtaCutMin) && posTrack->Eta() > (-fEtaCutMin)) ||
1435  (negTrack->Eta() < (fEtaCutMin) && negTrack->Eta() > (-fEtaCutMin)) ){
1436  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1437  return kFALSE;
1438  }
1439  }
1440  cutIndex++;
1441 
1442  // Single Pt Cut
1443  if(fDoAsymPtCut){
1444  if((posTrack->Pt()<fSinglePtCut || negTrack->Pt()<fSinglePtCut2) && (posTrack->Pt()<fSinglePtCut2 || negTrack->Pt()<fSinglePtCut) ){
1445  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1446  return kFALSE;
1447  }
1448  } else {
1449  if(posTrack->Pt()<fSinglePtCut || negTrack->Pt()<fSinglePtCut){
1450  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1451  return kFALSE;
1452  }
1453  }
1454  cutIndex++;
1455 
1456  // AOD ESD specific cuts
1457  Bool_t passCuts = kTRUE;
1458 
1459  if(negTrack->IsA()==AliAODTrack::Class()) {
1460  passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1461  } else {
1462  passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1463  }
1464 
1465  if(!passCuts){
1466  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1467  return kFALSE;
1468  }
1469  cutIndex++;
1470 
1471  if(fHistoTrackCuts)fHistoTrackCuts->Fill(cutIndex);
1472 
1473  return kTRUE;
1474 
1475 }
1478 
1479  if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1480  if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1481 
1482  AliVTrack * negTrack = GetTrack(event, gamma->GetTrackLabelNegative());
1483  AliVTrack * posTrack = GetTrack(event, gamma->GetTrackLabelPositive());
1484 
1485  Double_t CentrnSig[2] ={-1.,-1.};//negative, positive
1486  Double_t P[2] ={-1.,-1.};
1487  Double_t Eta[2] ={-1.,-1.};
1488  Double_t R =-1.;
1489 
1490  Float_t KappaPlus, KappaMinus, Kappa;
1492  CentrnSig[0]=fPIDResponse->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
1493  CentrnSig[1]=fPIDResponse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
1494  P[0] =negTrack->P();
1495  P[1] =posTrack->P();
1496  Eta[0] =negTrack->Eta();
1497  Eta[1] =posTrack->Eta();
1498  R =gamma->GetConversionRadius();
1499  KappaMinus = GetCorrectedElectronTPCResponse(negTrack->Charge(),CentrnSig[0],P[0],Eta[0],R);
1500  KappaPlus = GetCorrectedElectronTPCResponse(posTrack->Charge(),CentrnSig[1],P[1],Eta[1],R);
1501  }else{
1502  KappaMinus = fPIDResponse->NumberOfSigmasTPC(negTrack, AliPID::kElectron);
1503  KappaPlus = fPIDResponse->NumberOfSigmasTPC(posTrack, AliPID::kElectron);
1504  }
1505  Kappa = ( TMath::Abs(KappaMinus) + TMath::Abs(KappaPlus) ) / 2.0 + 2.0*(KappaMinus+KappaPlus);
1506 
1507  return Kappa;
1508 
1509 }
1510 
1511 
1514  // Supposed to use post calibration
1515  // Electron Identification Cuts for Photon reconstruction
1516 
1517  if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1518  if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1519 
1520  Short_t Charge = fCurrentTrack->Charge();
1521  Double_t electronNSigmaTPC = fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron);
1522  Double_t electronNSigmaTPCCor=0.;
1523  Double_t P=0.;
1524  Double_t Eta=0.;
1525  Double_t R=0.;
1526 
1528  P = fCurrentTrack->P();
1529  Eta = fCurrentTrack->Eta();
1530  R = photon->GetConversionRadius();
1531  electronNSigmaTPCCor = GetCorrectedElectronTPCResponse(Charge,electronNSigmaTPC,P,Eta,R);
1532  }
1533 
1534  Int_t cutIndex=0;
1535  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1536  if(fHistoTPCdEdxSigbefore)fHistoTPCdEdxSigbefore->Fill(fCurrentTrack->P(), electronNSigmaTPC);
1537  if(fHistoTPCdEdxbefore)fHistoTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1538  cutIndex++;
1539  if(fDodEdxSigmaCut == kTRUE && !fSwitchToKappa){
1540  // TPC Electron Line
1542  if( electronNSigmaTPCCor < fPIDnSigmaBelowElectronLine || electronNSigmaTPCCor >fPIDnSigmaAboveElectronLine ){
1543  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1544  return kFALSE;
1545  }
1546  } else{
1547  if( electronNSigmaTPC < fPIDnSigmaBelowElectronLine ||
1548  electronNSigmaTPC > fPIDnSigmaAboveElectronLine){
1549  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1550  return kFALSE;
1551  }
1552  }
1553  cutIndex++;
1554  // TPC Pion Line
1555  if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1557  if( electronNSigmaTPCCor >fPIDnSigmaBelowElectronLine && electronNSigmaTPCCor < fPIDnSigmaAboveElectronLine&&
1558  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1559  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1560  return kFALSE;
1561  }
1562  } else{
1563  if( electronNSigmaTPC > fPIDnSigmaBelowElectronLine &&
1564  electronNSigmaTPC < fPIDnSigmaAboveElectronLine&&
1565  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1566  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1567  return kFALSE;
1568  }
1569  }
1570  cutIndex++;
1571  }
1572 
1573  // High Pt Pion rej
1574  if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1576  if( electronNSigmaTPCCor > fPIDnSigmaBelowElectronLine &&
1577  electronNSigmaTPCCor < fPIDnSigmaAboveElectronLine &&
1578  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1579  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1580  return kFALSE;
1581  }
1582  } else{
1583  if( electronNSigmaTPC > fPIDnSigmaBelowElectronLine &&
1584  electronNSigmaTPC < fPIDnSigmaAboveElectronLine &&
1585  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1586  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1587  return kFALSE;
1588  }
1589  }
1590  }
1591  cutIndex++;
1592  }
1593  else{cutIndex+=3;}
1594 
1595  if(fDoKaonRejectionLowP == kTRUE && !fSwitchToKappa){
1596  if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1597  if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1598  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1599  return kFALSE;
1600  }
1601  }
1602  }
1603  cutIndex++;
1604 
1605  if(fDoProtonRejectionLowP == kTRUE && !fSwitchToKappa){
1606  if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1607  if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1608  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1609  return kFALSE;
1610  }
1611  }
1612  }
1613  cutIndex++;
1614 
1615  if(fDoPionRejectionLowP == kTRUE && !fSwitchToKappa){
1616  if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1617  if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1618  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1619  return kFALSE;
1620  }
1621  }
1622  }
1623  cutIndex++;
1624 
1625 
1626  // cout<<"Start"<<endl;
1627  // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1628 
1629  // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1630  // {cout<<"TOF DA"<<endl;}
1631  // if(status == AliPIDResponse::kDetPidOk){
1632  // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1633  // cout<<"--> "<<probMis<<endl;
1634  // if(probMis > 0.01){
1635 
1636  // }
1637  // }
1638 
1639  if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid ) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1640  if(fHistoTOFbefore){
1641  Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1642  Double_t times[AliPID::kSPECIESC];
1643  fCurrentTrack->GetIntegratedTimes(times,AliPID::kSPECIESC);
1644  Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1645  Double_t dT = TOFsignal - t0 - times[0];
1646  fHistoTOFbefore->Fill(fCurrentTrack->P(),dT);
1647  }
1648  if(fHistoTOFSigbefore) fHistoTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1649  if(fUseTOFpid){
1650  if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1651  fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1652  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1653  return kFALSE;
1654  }
1655  }
1656  if(fHistoTOFSigafter)fHistoTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1657  }
1658  cutIndex++;
1659 
1660  if((fCurrentTrack->GetStatus() & AliESDtrack::kITSpid)){
1661  if(fHistoITSSigbefore) fHistoITSSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron));
1662  if(fUseITSpid){
1663  if(fCurrentTrack->Pt()<=fMaxPtPIDITS){
1664  if(fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron)>fITSPIDnSigmaAboveElectronLine || fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron)<fITSPIDnSigmaBelowElectronLine ){
1665  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1666  return kFALSE;
1667  }
1668  }
1669  }
1670  if(fHistoITSSigafter)fHistoITSSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron));
1671  }
1672 
1673  cutIndex++;
1674 
1675  // Apply TRD PID
1676  if(fDoTRDPID){
1677  if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1678  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1679  return kFALSE;
1680  }
1681  }
1682  cutIndex++;
1683 
1684  if(fHistodEdxCuts)fHistodEdxCuts->Fill(cutIndex,fCurrentTrack->Pt());
1686  if(fHistoTPCdEdxSigafter)fHistoTPCdEdxSigafter->Fill(fCurrentTrack->P(),electronNSigmaTPCCor);
1687  }else{
1688  if(fHistoTPCdEdxSigafter)fHistoTPCdEdxSigafter->Fill(fCurrentTrack->P(),electronNSigmaTPC);
1689  }
1690  if(fHistoTPCdEdxafter)fHistoTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1691 
1692  return kTRUE;
1693 }
1694 
1697  // abort if Kappa selection not enabled
1698  if (!fSwitchToKappa) return kTRUE;
1699 
1700  Float_t kappa = GetKappaTPC(photon, event);
1701  if (kappa < fKappaMinCut) return kFALSE;
1702  if (kappa > fKappaMaxCut) return kFALSE;
1703  return kTRUE;
1704 }
1705 
1708  // Cut on Energy Asymmetry
1709 
1710  for(Int_t ii=0;ii<2;ii++){
1711 
1712  AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1713 
1715  Double_t trackNegAsy=0;
1716  if (photon->GetPhotonP()!=0.){
1717  trackNegAsy= track->P()/photon->GetPhotonP();
1718  }
1719 
1720  if( trackNegAsy > fFAsymmetryCut->Eval(photon->GetPhotonP()) || trackNegAsy < 1.-fFAsymmetryCut->Eval(photon->GetPhotonP()) ){
1721  return kFALSE;
1722  }
1723 
1724  } else {
1725  if( track->P() > fMinPPhotonAsymmetryCut ){
1726  Double_t trackNegAsy=0;
1727  if (photon->GetPhotonP()!=0.){
1728  trackNegAsy= track->P()/photon->GetPhotonP();
1729  }
1730 
1731  if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1732  return kFALSE;
1733  }
1734  }
1735  }
1736 
1737  }
1738  return kTRUE;
1739 }
1740 
1742 AliVTrack *AliConversionPhotonCuts::GetTrack(AliVEvent * event, Int_t label){
1743  //Returns pointer to the track with given ESD label
1744  //(Important for AOD implementation, since Track array in AOD data is different
1745  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1746 
1747  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1748  if(esdEvent) {
1749  if(label > event->GetNumberOfTracks() ) return NULL;
1750  AliESDtrack * track = esdEvent->GetTrack(label);
1751  return track;
1752 
1753  } else {
1754  if(label == -999999) return NULL; // if AOD relabelling goes wrong, immediately return NULL
1755  AliVTrack * track = 0x0;
1756  if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->AreAODsRelabeled()){
1757  if(event->GetTrack(label)) track = dynamic_cast<AliVTrack*>(event->GetTrack(label));
1758  return track;
1759  }
1760  else{
1761  for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1762  if(event->GetTrack(ii)) track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1763  if(track){
1764  if(track->GetID() == label) {
1765  return track;
1766  }
1767  }
1768  }
1769  }
1770  }
1771  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1772  return NULL;
1773 }
1774 
1777  //Returns pointer to the track with given ESD label
1778  //(Important for AOD implementation, since Track array in AOD data is different
1779  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1780 
1781  if(event) {
1782  if(label > event->GetNumberOfTracks() ) return NULL;
1783  AliESDtrack * track = event->GetTrack(label);
1784  return track;
1785  }
1786  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1787  return NULL;
1788 }
1789 
1790 
1791 
1794  // Cut on Electron Probability for Photon Reconstruction
1795 
1796  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1797 
1798  if(esdEvent){
1799 
1800  Bool_t iResult=kFALSE;
1801 
1802  Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1803  Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1804 
1805  AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1806  AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1807 
1808  if(negProbArray && posProbArray){
1809 
1810  negTrack->GetTPCpid(negProbArray);
1811  posTrack->GetTPCpid(posProbArray);
1812 
1814  iResult=kTRUE;
1815  }
1816  }
1817 
1818  delete [] posProbArray;
1819  delete [] negProbArray;
1820  return iResult;
1821 
1822  } else {
1824  return kTRUE;
1825  }
1826 }
1827 
1828 
1830 Bool_t AliConversionPhotonCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1831  // MC Acceptance Cuts
1832  //(Certain areas were excluded for photon reconstruction)
1833 
1834  if(particle->R()>fMaxR){
1835  return kFALSE;}
1836 
1837  if(ePos->R()>fMaxR){
1838  return kFALSE;
1839  }
1840 
1841  if(ePos->R()<fMinR){
1842  return kFALSE;
1843  }
1844 
1845  if( ePos->R() <= ((TMath::Abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1846  return kFALSE;
1847  }
1848  else if (fUseEtaMinCut && ePos->R() >= ((TMath::Abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1849  return kFALSE;
1850  }
1851 
1852  if(TMath::Abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1853  return kFALSE;
1854  }
1855 
1856  if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1857  return kFALSE;
1858  }
1859 
1860  if(TMath::Abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1861  return kFALSE;
1862  }
1863 
1864 
1865  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) ){
1866  return kFALSE;
1867  }
1868  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ){
1869  return kFALSE;
1870  }
1871  if( eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) ){
1872  return kFALSE;
1873  }
1874  if(fEtaCutMin>-0.1){
1875  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) ){
1876  return kFALSE;
1877  }
1878  if( ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin) ){
1879  return kFALSE;
1880  }
1881  if( eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin) ){
1882  return kFALSE;
1883  }
1884  }
1885 
1886  if(fDoAsymPtCut){
1887  if((ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut2) && (ePos->Pt()<fSinglePtCut2 || eNeg->Pt()<fSinglePtCut) ){
1888  return kFALSE;
1889  }
1890  } else {
1891  if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
1892  return kFALSE;
1893  }
1894  }
1895 
1896  if(particle->Pt()<fPtCut){
1897  return kFALSE;
1898  }
1899 
1900  return kTRUE;
1901 }
1905 
1906  if(fCutString && fCutString->GetString().Length() == kNCuts) {
1907  fCutString->SetString(GetCutNumber());
1908  } else {
1909  return kFALSE;
1910  }
1911  return kTRUE;
1912 }
1913 
1914 
1917  fCutStringRead = Form("%s",analysisCutSelection.Data());
1918 
1919  // Initialize Cuts from a given Cut string
1920  AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1921  if(analysisCutSelection.Length()!=kNCuts) {
1922  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1923  return kFALSE;
1924  }
1925  if(!analysisCutSelection.IsAlnum()){
1926  AliError("Cut selection is not alphanumeric");
1927  return kFALSE;
1928  }
1929 
1930  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
1931  analysisCutSelectionLowerCase.ToLower();
1932  const char *cutSelection = analysisCutSelectionLowerCase.Data();
1933  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
1934  for(Int_t ii=0;ii<kNCuts;ii++){
1935  ASSIGNARRAY(ii);
1936  }
1937 
1938  // Set Individual Cuts
1939  for(Int_t ii=0;ii<kNCuts;ii++){
1940  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1941  }
1942 
1944 
1945  return kTRUE;
1946 }
1950 
1951  switch (cutID) {
1952 
1953  case kv0FinderType:
1954  if( SetV0Finder(value)) {
1955  fCuts[kv0FinderType] = value;
1956  UpdateCutString();
1957  return kTRUE;
1958  } else return kFALSE;
1959 
1960  case ketaCut:
1961  if( SetEtaCut(value)) {
1962  fCuts[ketaCut] = value;
1963  UpdateCutString();
1964  return kTRUE;
1965  } else return kFALSE;
1966 
1967  case kRCut:
1968  if( SetRCut(value)) {
1969  fCuts[kRCut] = value;
1970  UpdateCutString();
1971  return kTRUE;
1972  } else return kFALSE;
1973 
1974  case kEtaForPhiSector:
1975  if( SetEtaForPhiCut(value)) {
1976  fCuts[kEtaForPhiSector] = value;
1977  UpdateCutString();
1978  return kTRUE;
1979  } else return kFALSE;
1980  case kMinPhiSector:
1981  if( SetMinPhiSectorCut(value)) {
1982  fCuts[kMinPhiSector] = value;
1983  UpdateCutString();
1984  return kTRUE;
1985  } else return kFALSE;
1986  case kMaxPhiSector:
1987  if( SetMaxPhiSectorCut(value)) {
1988  fCuts[kMaxPhiSector] = value;
1989  UpdateCutString();
1990  return kTRUE;
1991  } else return kFALSE;
1992 
1993  case ksinglePtCut:
1994  if( SetSinglePtCut(value)) {
1995  fCuts[ksinglePtCut] = value;
1996  UpdateCutString();
1997  return kTRUE;
1998  } else return kFALSE;
1999 
2000  case kclsTPCCut:
2001  if( SetTPCClusterCut(value)) {
2002  fCuts[kclsTPCCut] = value;
2003  UpdateCutString();
2004  return kTRUE;
2005  } else return kFALSE;
2006 
2007  case kededxSigmaCut:
2008  if (!fSwitchToKappa){
2009  if( SetTPCdEdxCutElectronLine(value)) {
2010  fCuts[kededxSigmaCut] = value;
2011  UpdateCutString();
2012  return kTRUE;
2013  } else return kFALSE;
2014  } else {
2015  if( SetKappaTPCCut(value)) {
2016  fCuts[kededxSigmaCut] = value;
2017  UpdateCutString();
2018  return kTRUE;
2019  } else return kFALSE;
2020  }
2021  case kpidedxSigmaCut:
2022  if (!fSwitchToKappa){
2023  if( SetTPCdEdxCutPionLine(value)) {
2024  fCuts[kpidedxSigmaCut] = value;
2025  UpdateCutString();
2026  return kTRUE;
2027  } else return kFALSE;
2028  } else {
2029  fCuts[kpidedxSigmaCut] = 0;
2030  return kTRUE;
2031  }
2032  case kpiMomdedxSigmaCut:
2033  if (!fSwitchToKappa){
2034  if( SetMinMomPiondEdxCut(value)) {
2035  fCuts[kpiMomdedxSigmaCut] = value;
2036  UpdateCutString();
2037  return kTRUE;
2038  } else return kFALSE;
2039  } else {
2041  return kTRUE;
2042  }
2043  case kpiMaxMomdedxSigmaCut:
2044  if (!fSwitchToKappa){
2045  if( SetMaxMomPiondEdxCut(value)) {
2046  fCuts[kpiMaxMomdedxSigmaCut] = value;
2047  UpdateCutString();
2048  return kTRUE;
2049  } else return kFALSE;
2050  } else {
2052  return kTRUE;
2053  }
2055  if (!fSwitchToKappa){
2056  if( SetLowPRejectionCuts(value)) {
2057  fCuts[kLowPRejectionSigmaCut] = value;
2058  UpdateCutString();
2059  return kTRUE;
2060  } else return kFALSE;
2061  } else {
2063  return kTRUE;
2064  }
2065  case kTOFelectronPID:
2066  if( SetTOFElectronPIDCut(value)) {
2067  fCuts[kTOFelectronPID] = value;
2068  UpdateCutString();
2069  return kTRUE;
2070  } else return kFALSE;
2071 
2072  case kQtMaxCut:
2073  if( SetQtMaxCut(value)) {
2074  fCuts[kQtMaxCut] = value;
2075  UpdateCutString();
2076  return kTRUE;
2077  } else return kFALSE;
2078 
2079 
2080  case kchi2GammaCut:
2081  if( SetChi2GammaCut(value)) {
2082  fCuts[kchi2GammaCut] = value;
2083  UpdateCutString();
2084  return kTRUE;
2085  } else return kFALSE;
2086 
2087  case kPsiPair:
2088  if( SetPsiPairCut(value)) {
2089  fCuts[kPsiPair] = value;
2090  UpdateCutString();
2091  return kTRUE;
2092  } else return kFALSE;
2093 
2094  case kdoPhotonAsymmetryCut:
2095  if( SetPhotonAsymmetryCut(value)) {
2096  fCuts[kdoPhotonAsymmetryCut] = value;
2097  UpdateCutString();
2098  return kTRUE;
2099  } else return kFALSE;
2100 
2101  case kCosPAngle:
2102  if( SetCosPAngleCut(value)) {
2103  fCuts[kCosPAngle] = value;
2104  UpdateCutString();
2105  return kTRUE;
2106  } else return kFALSE;
2107 
2108  case kElecShare:
2109  if( SetSharedElectronCut(value)) {
2110  fCuts[kElecShare] = value;
2111  UpdateCutString();
2112  return kTRUE;
2113  } else return kFALSE;
2114 
2115  case kToCloseV0s:
2116  if( SetToCloseV0sCut(value)) {
2117  fCuts[kToCloseV0s] = value;
2118  UpdateCutString();
2119  return kTRUE;
2120  } else return kFALSE;
2121 
2122  case kDcaRPrimVtx:
2123  if( SetDCARPhotonPrimVtxCut(value)) {
2124  fCuts[kDcaRPrimVtx] = value;
2125  UpdateCutString();
2126  return kTRUE;
2127  } else return kFALSE;
2128 
2129  case kDcaZPrimVtx:
2130  if( SetDCAZPhotonPrimVtxCut(value)) {
2131  fCuts[kDcaZPrimVtx] = value;
2132  UpdateCutString();
2133  return kTRUE;
2134  } else return kFALSE;
2135 
2136  case kInPlaneOutOfPlane:
2137  if( SetInPlaneOutOfPlane(value)) {
2138  fCuts[kInPlaneOutOfPlane] = value;
2139  UpdateCutString();
2140  return kTRUE;
2141  } else return kFALSE;
2142 
2143  case kITSelectronPID:
2144  if( SetITSElectronPIDCut(value)) {
2145  fCuts[kITSelectronPID] = value;
2146  UpdateCutString();
2147  return kTRUE;
2148  } else return kFALSE;
2149 
2150  case kTRDelectronPID:
2151  if( SetTRDElectronPIDCut(value)) {
2152  fCuts[kTRDelectronPID] = value;
2153  UpdateCutString();
2154  return kTRUE;
2155  } else return kFALSE;
2156 
2157  case kNCuts:
2158  AliError("Cut id out of range");
2159  return kFALSE;
2160  }
2161 
2162  AliError("Cut id %d not recognized");
2163  return kFALSE;
2164 }
2167  // Print out current Cut Selection
2168  for(Int_t ic = 0; ic < kNCuts; ic++) {
2169  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
2170  }
2171 }
2172 
2174  // Print out current Cut Selection with value
2175  printf("\nConversion cutnumber \n");
2176  for(Int_t ic = 0; ic < kNCuts; ic++) {
2177  printf("%d",fCuts[ic]);
2178  }
2179  printf("\n\n");
2180  printf("Electron cuts & Secondary Track Cuts - only track from secondaries enter analysis: \n");
2181  printf("\t no like sign pairs from V0s \n");
2182  if (!fUseCorrectedTPCClsInfo) printf("\t # TPC clusters > %3.2f \n", fMinClsTPC);
2183  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{e} < %3.2f\n", fEtaCutMin, fEtaCut );
2184  else printf("\t eta_{e} < %3.2f\n", fEtaCut );
2185  printf("\t reject: %3.2f < phi < %3.2f with %3.2f < eta < %3.2f \n", fMinPhiCut, fMaxPhiCut, fEtaForPhiCutMin, fEtaForPhiCutMax);
2186  if(fDoAsymPtCut)
2187  printf("\t Asymmetric cut: p_{T,e1} > %3.2f and p_{T,e2} > %3.2f\n", fSinglePtCut, fSinglePtCut2 );
2188  else
2189  printf("\t p_{T,e} > %3.2f\n", fSinglePtCut );
2190  printf("\t TPC refit \n");
2191  printf("\t no kinks \n");
2192  if (!fSwitchToKappa){
2193  printf("\t accept: %3.2f < n sigma_{e,TPC} < %3.2f\n", fPIDnSigmaBelowElectronLine, fPIDnSigmaAboveElectronLine );
2194  printf("\t reject: %3.2f < p_{e,T} < %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMinPnSigmaAbovePionLine, fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLine );
2195  printf("\t reject: p_{e,T} > %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLineHighPt );
2196  if (fDoPionRejectionLowP) printf("\t reject: p_{e,T} < %3.2f, -%3.2f < n sigma_{pi,TPC} < %3.2f\n", fPIDMinPPionRejectionLowP, fPIDnSigmaAtLowPAroundPionLine, fPIDnSigmaAtLowPAroundPionLine );
2197  if (fDoKaonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{K,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundKaonLine, fPIDnSigmaAtLowPAroundKaonLine );
2198  if (fDoProtonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{p,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundProtonLine, fPIDnSigmaAtLowPAroundProtonLine );
2199  } else {
2200  printf("\t accept: %3.2f <= Kappa_{TPC} < %3.2f\n", fKappaMinCut, fKappaMaxCut );
2201  }
2202  if (fUseTOFpid) printf("\t accept: %3.2f < n sigma_{e,TOF} < %3.2f\n", fTofPIDnSigmaBelowElectronLine, fTofPIDnSigmaAboveElectronLine);
2203  if (fUseITSpid) printf("\t accept: %3.2f < n sigma_{e,ITS} < %3.2f\n -- up to pT %3.2f", fITSPIDnSigmaBelowElectronLine, fITSPIDnSigmaAboveElectronLine, fMaxPtPIDITS);
2204 
2205  printf("Photon cuts: \n");
2206  if (fUseOnFlyV0Finder) printf("\t using Onfly V0 finder \n");
2207  else printf("\t using Offline V0 finder \n");
2208  if (fDo2DQt){
2209  printf("\t 2 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2210  } else {
2211  printf("\t 1 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2212  }
2213  if (fDo2DPsiPairChi2){
2214  printf("\t 2 dimensional triangle chi^{2} and psi_{pair} cut applied with maximum of chi^{2} = %3.2f and |psi_{pair}| = %3.2f \n", fChi2CutConversion, fPsiPairCut );
2215  } else {
2216  printf("\t chi^{2} max cut chi^{2} < %3.2f \n", fChi2CutConversion );
2217  printf("\t psi_{pair} max cut |psi_{pair}| < %3.2f \n", fPsiPairCut );
2218  }
2219  printf("\t %3.2f < R_{conv} < %3.2f\n", fMinR, fMaxR );
2220  printf("\t Z_{conv} < %3.2f\n", fMaxZ );
2221  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{conv} < %3.2f\n", fEtaCutMin, fEtaCut );
2222  else printf("\t eta_{conv} < %3.2f\n", fEtaCut );
2223  if (fDoPhotonAsymmetryCut) printf("\t for p_{T,track} > %3.2f, A_{gamma} < %3.2f \n", fMinPPhotonAsymmetryCut, fMinPhotonAsymmetry );
2224  if (fDoPhotonPDependentAsymCut && fDoPhotonAsymmetryCut) printf("\t p-dependent asymmetry cut \n");
2225  if (fUseCorrectedTPCClsInfo) printf("\t #cluster TPC/ #findable clusters TPC (corrected for radius) > %3.2f\n", fMinClsTPCToF );
2226  printf("\t p_{T,gamma} > %3.2f\n", fPtCut );
2227  printf("\t cos(Theta_{point}) > %3.2f \n", fCosPAngleCut );
2228  printf("\t dca_{R} < %3.2f \n", fDCARPrimVtxCut );
2229  printf("\t dca_{Z} < %3.2f \n", fDCAZPrimVtxCut );
2230  if (fDoPhotonQualitySelectionCut) printf("\t selection based on photon quality with quality %d \n", fPhotonQualityCut );
2231  if (fDoPhotonQualityRejectionCut) printf("\t rejection based on photon quality with quality %d \n", fPhotonQualityCut );
2232  if (fDoDoubleCountingCut) printf("\t Reject doubly counted photons with R > %3.2f, DeltaR < %3.2f, OpenAngle < %3.2f \n", fMinRDC, fDeltaR,fOpenAngle );
2233 
2234 }
2235 
2238  switch (v0FinderType){
2239  case 0: // on fly V0 finder
2240  cout << "have chosen onfly V0" << endl;
2241  fUseOnFlyV0Finder=kTRUE;
2243  break;
2244  case 1: // offline V0 finder
2245  cout << "have chosen offline V0" << endl;
2246  fUseOnFlyV0Finder=kFALSE;
2248  break;
2249  case 2: // on fly V0 finder with same signs
2250  cout << "have chosen onfly V0 same sign pairing" << endl;
2251  fUseOnFlyV0Finder=kTRUE;
2253  break;
2254  case 3: // on fly V0 finder with unlike signs and same signs
2255  cout << "have chosen onfly V0 unlike sign and same signs pairing" << endl;
2256  fUseOnFlyV0Finder=kTRUE;
2258  break;
2259  default:
2260  AliError(Form(" v0FinderType not defined %d",v0FinderType));
2261  return kFALSE;
2262  }
2263  return kTRUE;
2264 }
2265 
2268 
2269  //Set Standard LineCutZValues
2270  fLineCutZValueMin = -2;
2271  fLineCutZValue = 7.;
2272 
2273  switch(etaCut){
2274  case 0: // 0.9
2275  fEtaCut = 0.9;
2276  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2277  fEtaCutMin = -0.1;
2278  fLineCutZRSlopeMin = 0.;
2279  break;
2280  case 1: // 0.6 // changed from 1.2 to 0.6 on 2013.06.10
2281  fEtaCut = 0.6;
2282  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2283  fEtaCutMin = -0.1;
2284  fLineCutZRSlopeMin = 0.;
2285  break;
2286  case 2: // 1.4
2287  fEtaCut = 1.4;
2288  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2289  fEtaCutMin = -0.1;
2290  fLineCutZRSlopeMin = 0.;
2291  break;
2292  case 3: // 0.65
2293  fEtaCut = 0.65;
2294  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2295  fEtaCutMin = -0.1;
2296  fLineCutZRSlopeMin = 0.;
2297  break;
2298  case 4: // 0.75
2299  fEtaCut = 0.75;
2300  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2301  fEtaCutMin = -0.1;
2302  fLineCutZRSlopeMin = 0.;
2303  break;
2304  case 5: // 0.5
2305  fEtaCut = 0.5;
2306  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2307  fEtaCutMin = -0.1;
2308  fLineCutZRSlopeMin = 0.;
2309  break;
2310  case 6: // 5.
2311  fEtaCut = 5.;
2312  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2313  fEtaCutMin = -0.1;
2314  fLineCutZRSlopeMin = 0.;
2315  break;
2316  case 7:
2317  if (fIsHeavyIon==1){
2318  fEtaCut = 0.7;
2319  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2320  fEtaCutMin = -0.1;
2321  fLineCutZRSlopeMin = 0.;
2322  break;
2323  } else {
2324  fEtaCut = 0.3;
2325  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2326  fEtaCutMin = -0.1;
2327  fLineCutZRSlopeMin = 0.;
2328  break;
2329  }
2330  // case 8: // 0.1 - 0.8
2331  // fEtaCut = 0.9;
2332  // fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2333  // fEtaCutMin = 0.1;
2334  // fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2335  // break;
2336  case 8: // 0.4
2337  fEtaCut = 0.4;
2338  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2339  fEtaCutMin = -0.1;
2340  fLineCutZRSlopeMin = 0.;
2341  break;
2342  case 9: // 10
2343  fEtaCut = 10;
2344  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2345  fEtaCutMin = -0.1;
2346  fLineCutZRSlopeMin = 0.;
2347  break;
2348  case 10: // 0.2-0.9
2349  fEtaCut = 0.9;
2350  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2351  fEtaCutMin = 0.2;
2352  fLineCutZRSlopeMin = 0.;
2353  break;
2354  case 11: // 0.2-0.9
2355  fEtaCut = 0.9;
2356  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2357  fEtaCutMin = 0.2;
2358  fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2359  break;
2360  case 12: // 0.85
2361  fEtaCut = 0.85;
2362  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2363  fEtaCutMin = -0.1;
2364  fLineCutZRSlopeMin = 0.;
2365  break;
2366  case 13: // 0.8
2367  fEtaCut = 0.8;
2368  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2369  fEtaCutMin = -0.1;
2370  fLineCutZRSlopeMin = 0.;
2371  break;
2372  default:
2373  AliError(Form(" EtaCut not defined %d",etaCut));
2374  return kFALSE;
2375  }
2376  return kTRUE;
2377 }
2378 
2381  // Set Cut
2382  switch(RCut){
2383  case 0:
2384  fMinR=0;
2385  fMaxR = 180.;
2386  break;
2387  case 1:
2388  fMinR=2.8;
2389  fMaxR = 180.;
2390  break;
2391  case 2:
2392  fMinR=5.;
2393  fMaxR = 180.;
2394  break;
2395  case 3:
2396  fMaxR = 70.;
2397  fMinR = 10.;
2398  break;
2399  case 4:
2400  fMaxR = 70.;
2401  fMinR = 5.;
2402  break;
2403  case 5:
2404  fMaxR = 180.;
2405  fMinR = 10.;
2406  break;
2407  case 6:
2408  fMaxR = 180.;
2409  fMinR = 20.;
2410  break;
2411  case 7:
2412  fMaxR = 180.;
2413  fMinR = 35.; //old 26.
2414  break;
2415  case 8:
2416  fMaxR = 180.;
2417  fMinR = 12.5;
2418  break;
2419  case 9:
2420  fMaxR = 180.;
2421  fMinR = 7.5;
2422  break;
2423  case 10:
2424  fMaxR = 33.5;
2425  fMinR = 5.;
2426  break;
2427  case 11:
2428  fMaxR = 72.;
2429  fMinR = 33.5;
2430  break;
2431  case 12:
2432  fMaxR = 180.;
2433  fMinR = 72.;
2434  break;
2435  case 13:
2436  fMaxR = 55.;
2437  fMinR = 5.;
2438  break;
2439  case 14:
2440  fMaxR = 180.;
2441  fMinR = 55.;
2442  break;
2443  case 15:
2444  fMaxR = 72.;
2445  fMinR = 5.;
2446  break;
2447  case 16:
2448  fMaxR = 180.;
2449  fMinR = 95.;
2450  break;
2451 
2452  default:
2453  AliError("RCut not defined");
2454  return kFALSE;
2455  }
2456  return kTRUE;
2457 }
2458 
2461 
2462  switch(etaPhiCut) {
2463  case 0: //no specific eta range selected, full eta range
2466  break;
2467  case 1: //eta < 0 only
2470  fEtaForPhiCutMax = 0.;
2471  break;
2472  case 2://eta > 0 only
2474  fEtaForPhiCutMin = 0.;
2476  break;
2477  default:
2478  AliError(Form("EtaForPhiCut not defined %d",etaPhiCut));
2479  return kFALSE;
2480  }
2481 
2482  return kTRUE;
2483 }
2484 
2486 // This are exclusion cuts, everything between fMinPhiCut & fMaxPhiCut will be excluded
2488 
2489  switch(minPhiCut) {
2490  case 0:
2491  fDoShrinkTPCAcceptance = kFALSE;
2492  fMinPhiCut = 0;
2493  break;
2494  case 1:
2496  fMinPhiCut = 1.7; //OROC C08 large cut
2497  break;
2498  case 2:
2500  fMinPhiCut = 4.4; //EMCal
2501  break;
2502  case 3:
2504  fMinPhiCut = 1.0; //PHOS
2505  break;
2506  case 4:
2508  fMinPhiCut = 3.4; //EMCal tight
2509  break;
2510  case 5:
2512  fMinPhiCut = 2.0; //OROC C08 medium cut
2513  break;
2514  case 6:
2516  fMinPhiCut = 2.2; //OROC C08 small cut
2517  break;
2518  case 7:
2520  fMinPhiCut = 2.4; //OROC C08 tightest cut
2521  break;
2522  case 8:
2524  fMinPhiCut = 4.54; //PHOS phi
2525  break;
2526  default:
2527  AliError(Form("MinPhiCut not defined %d",minPhiCut));
2528  return kFALSE;
2529  }
2530 
2531  return kTRUE;
2532 }
2533 
2535 // This are exclusion cuts, everything between fMinPhiCut & fMaxPhiCut will be excluded
2537 
2538  switch(maxPhiCut) {
2539  case 0:
2541  fMaxPhiCut = 2*TMath::Pi()+0.00001;
2542  break;
2543  case 1:
2545  fMaxPhiCut = 4.3; //OROC C08 large cut
2546  break;
2547  case 2:
2549  fMaxPhiCut = 5.8; //EMCal
2550  break;
2551  case 3:
2553  fMaxPhiCut = 3.0; //PHOS
2554  break;
2555  case 4:
2557  fMaxPhiCut = 1.; //EMCal
2558  break;
2559  case 5:
2561  fMaxPhiCut = 4.0; //OROC C08 medium cut
2562  break;
2563  case 6:
2565  fMaxPhiCut = 3.8; //OROC C08 small cut
2566  break;
2567  case 7:
2569  fMaxPhiCut = 3.6; //OROC C08 tighest cut
2570  break;
2571  case 8:
2573  fMaxPhiCut = 5.59; //PHOS phi
2574  break;
2575  default:
2576  AliError(Form("MaxPhiCut not defined %d",maxPhiCut));
2577  return kFALSE;
2578  }
2579 
2580  return kTRUE;
2581 }
2582 
2583 
2586  switch(singlePtCut){
2587  case 0: // 0.050 GeV + min gamma pT cut of 20 MeV
2588  fSinglePtCut = 0.050;
2589  fPtCut = 0.02;
2590  break;
2591  case 1: // 0.100 GeV + min gamma pT cut of 20 MeV
2592  fSinglePtCut = 0.100;
2593  fPtCut = 0.02;
2594  break;
2595  case 2: // 0.150 GeV + min gamma pT cut of 20 MeV
2596  fSinglePtCut = 0.150;
2597  fPtCut = 0.02;
2598  break;
2599  case 3: // 0.200 GeV + min gamma pT cut of 20 MeV
2600  fSinglePtCut = 0.200;
2601  fPtCut = 0.02;
2602  break;
2603  case 4: // 0.075 GeV + min gamma pT cut of 20 MeV
2604  fSinglePtCut = 0.075;
2605  fPtCut = 0.02;
2606  break;
2607  case 5: // 0.125 GeV + min gamma pT cut of 20 MeV
2608  fSinglePtCut = 0.125;
2609  fPtCut = 0.02;
2610  break;
2611  case 6: // 0.04 GeV + min gamma pT cut of 10 MeV
2612  fSinglePtCut = 0.040;
2613  fPtCut = 0.01;
2614  break;
2615  case 7: // 0.0 GeV + min gamma pT cut of 0 MeV
2616  fSinglePtCut = 0.0;
2617  fPtCut = 0.0;
2618  break;
2619  case 8: // 0.02 GeV + min gamma pT cut of 20 MeV, equivalent to .05 for the low B field runs
2620  fSinglePtCut = 0.02;
2621  fPtCut = 0.01;
2622  break;
2623  case 9: // 0.050 GeV + min gamma pT cut of 100 MeV
2624  fSinglePtCut = 0.050;
2625  fPtCut = 0.100;
2626  break;
2627  case 10: //a: 0.050 GeV + min gamma pT cut of 150 MeV
2628  fSinglePtCut = 0.050;
2629  fPtCut = 0.150;
2630  break;
2631  case 11: //b: 0.050 GeV + min gamma pT cut of 200 MeV
2632  fSinglePtCut = 0.050;
2633  fPtCut = 0.200;
2634  break;
2635  case 12: //c: 0.060 GeV
2636  fSinglePtCut = 0.060;
2637  break;
2638  case 13: //d: 0.060 GeV + min gamma pT cut of 100 MeV
2639  fSinglePtCut = 0.060;
2640  fPtCut = 0.100;
2641  break;
2642  case 14: //e: 0.060 GeV + min gamma pT cut of 150 MeV
2643  fSinglePtCut = 0.060;
2644  fPtCut = 0.150;
2645  break;
2646  case 15: //f: 0.060 GeV + min gamma pT cut of 200 MeV
2647  fSinglePtCut = 0.060;
2648  fPtCut = 0.200;
2649  break;
2650  case 16: //g: 0.075 GeV + min gamma pT cut of 150 MeV
2651  fSinglePtCut = 0.075;
2652  fPtCut = 0.150;
2653  break;
2654  case 17: //h: 0.100 GeV + min gamma pT cut of 200 MeV
2655  fSinglePtCut = 0.100;
2656  fPtCut = 0.200;
2657  break;
2658  case 18: //i: 0.150 GeV + min gamma pT cut of 300 MeV
2659  fSinglePtCut = 0.150;
2660  fPtCut = 0.300;
2661  break;
2662  case 19: //j: asym: 0.100 GeV and 0.075 GeV
2663  fSinglePtCut = 0.100;
2664  fDoAsymPtCut = kTRUE;
2665  fSinglePtCut2= 0.075;
2666  break;
2667  case 20: //k: asym: 0.150 GeV and 0.075 GeV
2668  fSinglePtCut = 0.150;
2669  fDoAsymPtCut = kTRUE;
2670  fSinglePtCut2= 0.075;
2671  break;
2672  case 21: //l: asym: 0.200 GeV and 0.075 GeV
2673  fSinglePtCut = 0.200;
2674  fDoAsymPtCut = kTRUE;
2675  fSinglePtCut2= 0.075;
2676  break;
2677  case 22: // m: 0.080 GeV + min gamma pT cut of 20 MeV
2678  fSinglePtCut = 0.080;
2679  fPtCut = 0.02;
2680  break;
2681  case 23: // n: 0.090 GeV + min gamma pT cut of 20 MeV
2682  fSinglePtCut = 0.090;
2683  fPtCut = 0.02;
2684  break;
2685  case 24: // o: 0.024 GeV + min gamma pT cut of 20 MeV ; equiv. 0.06 for lowB
2686  fSinglePtCut = 0.024;
2687  fPtCut = 0.01;
2688  break;
2689  case 25: // p: 0.030 GeV + min gamma pT cut of 20 MeV ; equiv. 0.075 for lowB
2690  fSinglePtCut = 0.030;
2691  fPtCut = 0.01;
2692  break;
2693  case 26: // q: 0.032 GeV + min gamma pT cut of 20 MeV ; equiv. 0.08 for lowB
2694  fSinglePtCut = 0.032;
2695  fPtCut = 0.01;
2696  break;
2697  case 27: // r: 0.036 GeV + min gamma pT cut of 20 MeV ; equiv. 0.09 for lowB
2698  fSinglePtCut = 0.036;
2699  fPtCut = 0.01;
2700  break;
2701  case 28: // s: 0.040 GeV + min gamma pT cut of 20 MeV ; equiv. 0.075 for lowB
2702  fSinglePtCut = 0.040;
2703  fPtCut = 0.01;
2704  break;
2705 
2706  default:
2707  AliError(Form("singlePtCut not defined %d",singlePtCut));
2708  return kFALSE;
2709  }
2710  return kTRUE;
2711 }
2712 
2715  switch(clsTPCCut){
2716  case 0: // 0
2717  fMinClsTPC= 0.;
2718  break;
2719  case 1: // 60
2720  fMinClsTPC= 60.;
2721  break;
2722  case 2: // 80
2723  fMinClsTPC= 80.;
2724  break;
2725  case 3: // 100
2726  fMinClsTPC= 100.;
2727  break;
2728  case 4: // 95% of findable clusters
2729  fMinClsTPCToF= 0.95;
2731  break;
2732  case 5: // 0% of findable clusters
2733  fMinClsTPCToF= 0.0;
2735  break;
2736  case 6: // 70% of findable clusters
2737  fMinClsTPCToF= 0.7;
2739  break;
2740  case 7: // 0% of findable clusters
2741  fMinClsTPCToF= 0.35;
2743  break;
2744  case 8:
2745  fMinClsTPCToF= 0.35;
2747  break;
2748  case 9:
2749  fMinClsTPCToF= 0.6;
2751  break;
2752  default:
2753  AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2754  return kFALSE;
2755  }
2756  return kTRUE;
2757 }
2758 
2761  switch(ededxSigmaCut){
2762  case 0: // -10,10
2765  break;
2766  case 1: // -5,5
2769  break;
2770  case 2: // -3,5
2773  break;
2774  case 3: // -4,5
2777  break;
2778  case 4: // -6,7
2781  break;
2782  case 5: // -4,4
2785  break;
2786  case 6: // -2.5,4
2789  break;
2790  case 7: // -2,3.5
2793  break;
2794  case 8: // -2.5,3.
2797  break;
2798  case 9: // -2.5,5.
2801  break;
2802  case 10: //a -3,3.
2805  break;
2806  case 11: //b -3.2,3.2.
2809  break;
2810  case 12: //c -2.8,2.8
2813  break;
2814  case 13: //d -1E9,1E9
2817  break;
2818  case 14: //e -7,1
2821  break;
2822  default:
2823  AliError("TPCdEdxCutElectronLine not defined");
2824  return kFALSE;
2825 
2826  }
2827  return kTRUE;
2828 }
2829 
2832 
2833  switch(pidedxSigmaCut){
2834  case 0: // -10
2837  break;
2838  case 1: // 0
2841  break;
2842  case 2: // 1
2845  break;
2846  case 3: // 1
2849  break;
2850  case 4: // 3.0sigma, 1.0 sigma at high pt
2853  break;
2854  case 5: // 1
2857  break;
2858  case 6: // 1
2861  break;
2862  case 7: // 1
2865  break;
2866  case 8: // 1
2869  break;
2870  case 9:
2871  fPIDnSigmaAbovePionLine=1; // We need a bit less tight cut on dE/dx
2873  break;
2874  case 10: //a
2875  fPIDnSigmaAbovePionLine=-3; // We need a bit less tight cut on dE/dx
2877  break;
2878  default:
2879  AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2880  return kFALSE;
2881  }
2882  return kTRUE;
2883 }
2884 
2887  switch(piMomdedxSigmaCut){
2888  case 0: // 0.5 GeV
2890  break;
2891  case 1: // 1. GeV
2893  break;
2894  case 2: // 1.5 GeV
2896  break;
2897  case 3: // 20.0 GeV
2899  break;
2900  case 4: // 50.0 GeV
2902  break;
2903  case 5: // 0.3 GeV
2905  break;
2906  case 6: // 0.25 GeV
2908  break;
2909  case 7: // 0.4 GeV
2911  break;
2912  case 8: // 0.2 GeV
2914  break;
2915  default:
2916  AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2917  return kFALSE;
2918  }
2919  return kTRUE;
2920 }
2921 
2924  switch(piMaxMomdedxSigmaCut){
2925  case 0: // 100. GeV
2927  break;
2928  case 1: // 5. GeV
2930  break;
2931  case 2: // 4. GeV
2933  break;
2934  case 3: // 3.5 GeV
2936  break;
2937  case 4: // 3. GeV
2939  break;
2940  case 5: // 7. GeV
2942  break;
2943  case 6: // 2. GeV
2945  break;
2946  default:
2947  AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2948  return kFALSE;
2949  }
2950  return kTRUE;
2951 }
2952 
2955  switch(LowPRejectionSigmaCut){
2956  case 0: //
2960  fDoKaonRejectionLowP = kFALSE;
2961  fDoProtonRejectionLowP = kFALSE;
2962  fDoPionRejectionLowP = kFALSE;
2964  break;
2965  case 1: //
2969  fDoKaonRejectionLowP = kTRUE;
2970  fDoProtonRejectionLowP = kTRUE;
2971  fDoPionRejectionLowP = kTRUE;
2973  break;
2974  case 2: //
2978  fDoKaonRejectionLowP = kTRUE;
2979  fDoProtonRejectionLowP = kTRUE;
2980  fDoPionRejectionLowP = kTRUE;
2982  break;
2983  case 3: //
2987  fDoKaonRejectionLowP = kTRUE;
2988  fDoProtonRejectionLowP = kTRUE;
2989  fDoPionRejectionLowP = kTRUE;
2991  break;
2992  case 4: //
2996  fDoKaonRejectionLowP = kFALSE;
2997  fDoProtonRejectionLowP = kFALSE;
2998  fDoPionRejectionLowP = kTRUE;
3000  break;
3001  case 5: //
3005  fDoKaonRejectionLowP = kFALSE;
3006  fDoProtonRejectionLowP = kFALSE;
3007  fDoPionRejectionLowP = kTRUE;
3009  break;
3010  case 6: //
3014  fDoKaonRejectionLowP = kFALSE;
3015  fDoProtonRejectionLowP = kFALSE;
3016  fDoPionRejectionLowP = kTRUE;
3018  break;
3019  case 7: //
3023  fDoKaonRejectionLowP = kFALSE;
3024  fDoProtonRejectionLowP = kFALSE;
3025  fDoPionRejectionLowP = kTRUE;
3027  break;
3028  case 8: //
3032  fDoKaonRejectionLowP = kFALSE;
3033  fDoProtonRejectionLowP = kTRUE;
3034  fDoPionRejectionLowP = kFALSE;
3036  break;
3037  default:
3038  AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
3039  return kFALSE;
3040  }
3041  return kTRUE;
3042 }
3043 
3046  switch(kappaCut){
3047  case 0: // completely open
3048  fKappaMaxCut=200;
3049  fKappaMinCut=-200;
3050  break;
3051  case 1: // mainly pi pi
3052  fKappaMaxCut=-13;
3053  fKappaMinCut=-20;
3054  break;
3055  case 2: // mainly pi e
3056  fKappaMaxCut=-6;
3057  fKappaMinCut=-11;
3058  break;
3059  case 3: // signal
3060  fKappaMaxCut=5;
3061  fKappaMinCut=-3;
3062  break;
3063  case 4: // remaining
3064  fKappaMaxCut=20;
3065  fKappaMinCut=11;
3066  break;
3067  case 5: // -5-10 full signal peak(including background)
3068  fKappaMaxCut=10;
3069  fKappaMinCut=-5;
3070  break;
3071  case 6: //
3072  fKappaMaxCut=10;
3073  fKappaMinCut=-3;
3074  break;
3075  case 7: //
3076  fKappaMaxCut=10;
3077  fKappaMinCut=0;
3078  break;
3079  default:
3080  AliError("KappaTPCCut not defined");
3081  return kFALSE;
3082 
3083  }
3084  return kTRUE;
3085 }
3086 
3087 
3090  // Set Cut
3091  switch(TOFelectronPID){
3092  case 0: // no cut
3093  fUseTOFpid = kFALSE;
3096  break;
3097  case 1: // -7,7
3098  fUseTOFpid = kTRUE;
3101  break;
3102  case 2: // -5,5
3103  fUseTOFpid = kTRUE;
3106  break;
3107  case 3: // -3,5
3108  fUseTOFpid = kTRUE;
3111  break;
3112  case 4: // -2,3
3113  fUseTOFpid = kTRUE;
3116  break;
3117  case 5: // -3,3
3118  fUseTOFpid = kTRUE;
3121  break;
3122  default:
3123  AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
3124  return kFALSE;
3125  }
3126  return kTRUE;
3127 }
3128 
3131  // Set Cut
3132  switch(ITSelectronPID){
3133  case 0: // no cut
3134  fUseITSpid = kFALSE;
3137  fMaxPtPIDITS = 1.5;
3138  break;
3139  case 1: // -3,3
3140  fUseITSpid = kTRUE;
3143  fMaxPtPIDITS = 1.5;
3144  break;
3145  case 2: // -2,2
3146  fUseITSpid = kTRUE;
3149  fMaxPtPIDITS = 1.5;
3150  break;
3151  case 3: // -1,1
3152  fUseITSpid = kTRUE;
3155  fMaxPtPIDITS = 1.5;
3156  break;
3157  case 4: // -3,5
3158  fUseITSpid = kTRUE;
3161  fMaxPtPIDITS = 1.5;
3162  break;
3163  case 5: // -5,5
3164  fUseITSpid = kTRUE;
3167  fMaxPtPIDITS = 1.5;
3168  break;
3169  case 6: // -3,3
3170  fUseITSpid = kTRUE;
3173  fMaxPtPIDITS = 2;
3174  break;
3175  case 7: // -2,2
3176  fUseITSpid = kTRUE;
3179  fMaxPtPIDITS = 2;
3180  break;
3181  case 8: // -1,1
3182  fUseITSpid = kTRUE;
3185  fMaxPtPIDITS = 2;
3186  break;
3187  case 9: // -3,5
3188  fUseITSpid = kTRUE;
3191  fMaxPtPIDITS = 2;
3192  break;
3193  default:
3194  AliError(Form("ITSelectronPID not defined %d",ITSelectronPID));
3195  return kFALSE;
3196  }
3197  return kTRUE;
3198 }
3199 
3202  // Set Cut
3203  switch(TRDelectronPID){
3204  case 0: // no cut
3205  fDoTRDPID = kFALSE;
3206  fTRDPIDBelowCut=-100;
3207  fTRDPIDAboveCut=100;
3208  break;
3209  default:
3210  AliError(Form("TRDelectronPID not defined %d",TRDelectronPID));
3211  return kFALSE;
3212  }
3213  return kTRUE;
3214 }
3215 
3216 
3219  switch(QtMaxCut){
3220  case 0: //
3221  fQtMax=1.;
3222  fDoQtGammaSelection=kFALSE;
3223  fDo2DQt=kFALSE;
3224  break;
3225  case 1:
3226  fQtMax=0.1;
3227  fDo2DQt=kFALSE;
3228  break;
3229  case 2:
3230  fQtMax=0.06;
3231  fDo2DQt=kTRUE;
3232  break;
3233  case 3:
3234  fQtMax=0.05;
3235  fDo2DQt=kFALSE;
3236  break;
3237  case 4:
3238  fQtMax=0.03;
3239  fDo2DQt=kFALSE;
3240  break;
3241  case 5:
3242  fQtMax=0.02;
3243  fDo2DQt=kFALSE;
3244  break;
3245  case 6:
3246  fQtMax=0.02;
3247  fDo2DQt=kTRUE;
3248  break;
3249  case 7:
3250  fQtMax=0.15;
3251  fDo2DQt=kFALSE;
3252  break;
3253  case 8:
3254  fQtMax=0.05;
3255  fDo2DQt=kTRUE;
3256  break;
3257  case 9:
3258  fQtMax=0.03;
3259  fDo2DQt=kTRUE;
3260  break;
3261  default:
3262  AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
3263  return kFALSE;
3264  }
3265  return kTRUE;
3266 }
3267 
3270 
3271  switch(chi2GammaCut){
3272  case 0: // 100
3273  fChi2CutConversion = 100.;
3274  break;
3275  case 1: // 50
3276  fChi2CutConversion = 50.;
3277  break;
3278  case 2: // 30
3279  fChi2CutConversion = 30.;
3280  break;
3281  case 3:
3282  fChi2CutConversion = 200.;
3283  break;
3284  case 4:
3285  if (fIsHeavyIon==1){
3286  fChi2CutConversion = 7.;
3287  } else {
3288  fChi2CutConversion = 500.;
3289  }
3290  break;
3291  case 5:
3292  fChi2CutConversion = 100000.;
3293  break;
3294  case 6:
3295  fChi2CutConversion = 5.;
3296  break;
3297  case 7:
3298  fChi2CutConversion = 10.;
3299  break;
3300  case 8:
3301  fChi2CutConversion = 20.;
3302  break;
3303  case 9:
3304  fChi2CutConversion = 15.;
3305  break;
3306  case 10:
3307  fChi2CutConversion = 25.;
3308  break;
3309  case 11:
3310  fChi2CutConversion = 35.;
3311  break;
3312  case 12:
3313  fChi2CutConversion = 40.;
3314  break;
3315  case 13:
3316  fChi2CutConversion = 45.;
3317  break;
3318  case 14:
3319  fChi2CutConversion = 55.;
3320  break;
3321  default:
3322  AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
3323  return kFALSE;
3324  }
3325  return kTRUE;
3326 }
3327 
3330  switch(psiCut) {
3331  case 0:
3332  fPsiPairCut = 10000; //
3333  break;
3334  case 1:
3335  fPsiPairCut = 0.1; //
3336  break;
3337  case 2:
3338  fPsiPairCut = 0.05; // Standard
3339  break;
3340  case 3:
3341  fPsiPairCut = 0.035; //
3342  break;
3343  case 4:
3344  fPsiPairCut = 0.2; //
3345  break;
3346  case 5:
3347  fPsiPairCut = 0.1; //
3348  fDo2DPsiPairChi2 = kTRUE;
3349  break;
3350  case 6:
3351  fPsiPairCut = 0.05; //
3352  fDo2DPsiPairChi2 = kTRUE;
3353  break;
3354  case 7:
3355  if (fIsHeavyIon==1){
3356  fPsiPairCut = 0.07; //
3357  } else {
3358  fPsiPairCut = 0.035; //
3359  }
3360  fDo2DPsiPairChi2 = kTRUE;
3361  break;
3362  case 8:
3363  fPsiPairCut = 0.2; //
3364  fDo2DPsiPairChi2 = kTRUE; //
3365  break;
3366  case 9:
3367  // if (fIsHeavyIon==1){ //AM 2016-05-13
3368  fPsiPairCut = 0.1; //
3369  fDo2DPsiPairChi2 = kTRUE;
3370  fIncludeRejectedPsiPair = kTRUE;
3371  break;
3372 
3373  case 10:
3374  fPsiPairCut = 0.25; //
3375  fDo2DPsiPairChi2 = kTRUE; //
3376  break;
3377 
3378  case 11:
3379  fPsiPairCut = 0.3; //
3380  fDo2DPsiPairChi2 = kTRUE; //
3381  break;
3382 
3383  case 12:
3384  fPsiPairCut = 0.15; //
3385  fDo2DPsiPairChi2 = kTRUE; //
3386  break;
3387 
3388 
3389  // } else {
3390  // fPsiPairCut = 0.5; //
3391  // break;
3392  // }
3393  default:
3394  AliError(Form("PsiPairCut not defined %d",psiCut));
3395  return kFALSE;
3396  }
3397 
3398  return kTRUE;
3399 }
3400 
3403  // Set Cut
3404  switch(doPhotonAsymmetryCut){
3405  case 0:
3409  break;
3410  case 1:
3413  fMinPhotonAsymmetry=0.04;
3414  break;
3415  case 2:
3418  fMinPhotonAsymmetry=0.06;
3419  break;
3420  case 3:
3423  fMinPhotonAsymmetry=0.05;
3424  break;
3425  case 4:
3428  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3429  fFAsymmetryCut->SetParameter(0,0.3);
3430  fFAsymmetryCut->SetParameter(1,0.66);
3431  fFAsymmetryCut->SetParameter(2,0.7);
3434  break;
3435  case 5:
3438  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3439  fFAsymmetryCut->SetParameter(0,0.14);
3440  fFAsymmetryCut->SetParameter(1,0.66);
3441  fFAsymmetryCut->SetParameter(2,0.5);
3444  break;
3445  case 6:
3448  fMinPhotonAsymmetry=0.05;
3449  break;
3450  case 7:
3453  fMinPhotonAsymmetry=0.05;
3454  break;
3455  case 8:
3458  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3459  fFAsymmetryCut->SetParameter(0,0.5);
3460  fFAsymmetryCut->SetParameter(1,0.46);
3461  fFAsymmetryCut->SetParameter(2,0.7);
3464  break;
3465  default:
3466  AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
3467  return kFALSE;
3468  }
3469  fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
3470  return kTRUE;
3471 }
3472 
3475 
3476  switch(cosCut){
3477  case 0:
3478  fCosPAngleCut = -1;
3479  break;
3480  case 1:
3481  fCosPAngleCut = 0;
3482  break;
3483  case 2:
3484  fCosPAngleCut = 0.5;
3485  break;
3486  case 3:
3487  fCosPAngleCut = 0.75;
3488  break;
3489  case 4:
3490  fCosPAngleCut = 0.85;
3491  break;
3492  case 5:
3493  fCosPAngleCut = 0.88;
3494  break;
3495  case 6:
3496  fCosPAngleCut = 0.9;
3497  break;
3498  case 7:
3499  fCosPAngleCut = 0.95;
3500  break;
3501  case 8:
3502  fCosPAngleCut = 0.98;
3503  break;
3504  case 9:
3505  fCosPAngleCut = 0.99;
3506  break;
3507  case 10://a
3508  fCosPAngleCut = 0.995;
3509  break;
3510  case 11://b
3511  fCosPAngleCut = 0.985;
3512  break;
3513  case 12://c
3514  fCosPAngleCut = 0.996;
3515  break;
3516  case 13://d
3517  fCosPAngleCut = 0.997;
3518  break;
3519  case 14://e
3520  fCosPAngleCut = 0.998;
3521  break;
3522  case 15://f
3523  fCosPAngleCut = 0.999;
3524  break;
3525  default:
3526  AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
3527  return kFALSE;
3528  }
3529 
3530  return kTRUE;
3531 }
3532 
3535 
3536  switch(sharedElec){
3537  case 0:
3538  fDoSharedElecCut = kFALSE;
3541  fPhotonQualityCut = 0;
3542  break;
3543  case 1:
3544  fDoSharedElecCut = kTRUE;
3547  fPhotonQualityCut = 0;
3548  break;
3549  case 2:
3550  fDoSharedElecCut = kFALSE;
3553  fPhotonQualityCut = 1;
3554  break;
3555  case 3:
3556  fDoSharedElecCut = kFALSE;
3559  fPhotonQualityCut = 2;
3560  break;
3561  case 4:
3562  fDoSharedElecCut = kFALSE;
3565  fPhotonQualityCut = 3;
3566  break;
3567  case 5://Cat1 rejection
3568  fDoSharedElecCut = kFALSE;
3571  fPhotonQualityCut = 1;
3572  break;
3573  default:
3574  AliError(Form("Shared Electron Cut not defined %d",sharedElec));
3575  return kFALSE;
3576  }
3577 
3578  return kTRUE;
3579 }
3580 
3583 
3584  switch(toClose){
3585  case 0:
3586  fDoToCloseV0sCut = kFALSE;
3587  fminV0Dist = 250;
3588  break;
3589  case 1:
3590  fDoToCloseV0sCut = kTRUE;
3591  fminV0Dist = 1;
3592  break;
3593  case 2:
3594  fDoToCloseV0sCut = kTRUE;
3595  fminV0Dist = 2;
3596  break;
3597  case 3:
3598  fDoToCloseV0sCut = kTRUE;
3599  fminV0Dist = 3;
3600  break;
3601  case 4:
3602  fDoToCloseV0sCut = kTRUE;
3603  fDoDoubleCountingCut = kTRUE;
3604  fMinRDC=0.;
3605  fDeltaR=6.;
3606  fOpenAngle=0.02;
3607  break;
3608  case 5:
3609  fDoToCloseV0sCut = kTRUE;
3610  fDoDoubleCountingCut = kTRUE;
3611  fMinRDC=0.;
3612  fDeltaR=6.;
3613  fOpenAngle=0.03;
3614  break;
3615  case 6:
3616  fDoToCloseV0sCut = kTRUE;
3617  fDoDoubleCountingCut = kTRUE;
3618  fMinRDC=0.;
3619  fDeltaR=6.;
3620  fOpenAngle=0.04;
3621  break;
3622 
3623  default:
3624  AliError(Form("Shared Electron Cut not defined %d",toClose));
3625  return kFALSE;
3626  }
3627  return kTRUE;
3628 }
3629 
3632  switch(TRDElectronCut){
3633  case 0:
3634  fDoTRDPID=kFALSE;
3635  break;
3636  case 1:
3637  fDoTRDPID=kTRUE;
3638  fPIDTRDEfficiency=0.1;
3639  break;
3640  case 8:
3641  fDoTRDPID=kTRUE;
3642  fPIDTRDEfficiency=0.8;
3643  break;
3644  case 9:
3645  fDoTRDPID=kTRUE;
3646  fPIDTRDEfficiency=0.9;
3647  break;
3648  default:
3649  AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
3650  return kFALSE;
3651  }
3652 
3653  return kTRUE;
3654 }
3655 
3658  // Set Cut
3659  switch(DCAZPhotonPrimVtx){
3660  case 0: //
3661  fDCAZPrimVtxCut = 1000;
3662  break;
3663  case 1: //
3664  fDCAZPrimVtxCut = 10;
3665  break;
3666  case 2: //
3667  fDCAZPrimVtxCut = 5;
3668  break;
3669  case 3: //
3670  fDCAZPrimVtxCut = 4;
3671  break;
3672  case 4: //
3673  fDCAZPrimVtxCut = 3;
3674  break;
3675  case 5: //
3676  fDCAZPrimVtxCut = 2.5;
3677  break;
3678  case 6: //
3679  fDCAZPrimVtxCut = 2;
3680  break;
3681  case 7: //
3682  fDCAZPrimVtxCut = 1.5;
3683  break;
3684  case 8: //
3685  fDCAZPrimVtxCut = 1;
3686  break;
3687  case 9: //
3688  fDCAZPrimVtxCut = 0.5;
3689  break;
3690  default:
3691  cout<<"Warning: DCAZPhotonPrimVtx not defined "<<DCAZPhotonPrimVtx<<endl;
3692  return kFALSE;
3693  }
3694  return kTRUE;
3695 }
3696 
3699  // Set Cut
3700  switch(DCARPhotonPrimVtx){
3701  case 0: //
3702  fDCARPrimVtxCut = 1000;
3703  break;
3704  case 1: //
3705  fDCARPrimVtxCut = 10;
3706  break;
3707  case 2: //
3708  fDCARPrimVtxCut = 5;
3709  break;
3710  case 3: //
3711  fDCARPrimVtxCut = 4;
3712  break;
3713  case 4: //
3714  fDCARPrimVtxCut = 3;
3715  break;
3716  case 5: //
3717  fDCARPrimVtxCut = 2.5;
3718  break;
3719  case 6: //
3720  fDCARPrimVtxCut = 2;
3721  break;
3722  case 7: //
3723  fDCARPrimVtxCut = 1.5;
3724  break;
3725  case 8: //
3726  fDCARPrimVtxCut = 1;
3727  break;
3728  case 9: //
3729  fDCARPrimVtxCut = 0.5;
3730  break;
3731  default:
3732  cout<<"Warning: DCARPhotonPrimVtx not defined "<<DCARPhotonPrimVtx<<endl;
3733  return kFALSE;
3734  }
3735  return kTRUE;
3736 }
3737 
3740  // Set Cut
3741  switch(inOutPlane){
3742  case 0: //
3743  fInPlaneOutOfPlane = 0; // No Event Plane
3744  break;
3745  case 1: //
3746  fInPlaneOutOfPlane = 1; // In-Plane
3747  break;
3748  case 2: //
3749  fInPlaneOutOfPlane = 2; // Out-Of-Plane
3750  break;
3751  default:
3752  cout<<"Warning: In-Plane or Out-Of-Plane not defined "<<inOutPlane<<endl;
3753  return kFALSE;
3754  }
3755  return kTRUE;
3756 }
3757 
3758 
3761  // Get first TPC row
3762  Int_t firstTPCRow = 0;
3763  Double_t radiusI = 84.8;
3764  Double_t radiusO = 134.6;
3765  Double_t radiusOB = 198.;
3766  Double_t rSizeI = 0.75;
3767  Double_t rSizeO = 1.;
3768  Double_t rSizeOB = 1.5;
3769  Int_t nClsI = 63;
3770  Int_t nClsIO = 127;
3771 
3772  if(radius <= radiusI){
3773  return firstTPCRow;
3774  }
3775  if(radius>radiusI && radius<=radiusO){
3776  firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
3777  }
3778  if(radius>radiusO && radius<=radiusOB){
3779  firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
3780  }
3781 
3782  if(radius>radiusOB){
3783  firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
3784  }
3785 
3786  return firstTPCRow;
3787 }
3788 
3792  if(GetCosineOfPointingAngle(photon, event) < fCosPAngleCut){
3793  return kFALSE;
3794  }
3795  return kTRUE;
3796 }
3797 
3800  // calculates the pointing angle of the recalculated V0
3801 
3802  Double_t momV0[3] = {0,0,0};
3803  if(event->IsA()==AliESDEvent::Class()){
3804  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
3805  if(!esdEvent) return -999;
3806  AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
3807  if(!v0) return -999;
3808  v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
3809  }
3810  if(event->IsA()==AliAODEvent::Class()){
3811  momV0[0] = photon->GetPx();
3812  momV0[1] = photon->GetPy();
3813  momV0[2] = photon->GetPz();
3814  }
3815 
3816  //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
3817  Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
3818  photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
3819  photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
3820 
3821  Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
3822  Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
3823 
3824 
3825  Double_t cosinePointingAngle = -999;
3826  if(momV02*PosV02 > 0.0)
3827  cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
3828 
3829  return cosinePointingAngle;
3830 }
3831 
3834 
3835  if (fDo2DPsiPairChi2){
3837  if (TMath::Abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut || (photon->GetPsiPair()) == 4){
3838  return kTRUE;
3839  } else {
3840  return kFALSE;
3841  }
3842 
3843  } else {
3844  if (TMath::Abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut ){
3845  return kTRUE;
3846  } else {
3847  return kFALSE;
3848  }
3849  }
3850  } else {
3852  if(TMath::Abs(photon->GetPsiPair()) > fPsiPairCut || (photon->GetPsiPair()) != 4){
3853  return kFALSE;
3854  } else {
3855  return kTRUE;
3856  }
3857  } else {
3858  if(TMath::Abs(photon->GetPsiPair()) > fPsiPairCut){
3859  return kFALSE;
3860  } else {
3861  return kTRUE;
3862  }
3863  }
3864  }
3865 }
3866 
3869  // returns TString with current cut number
3870  return fCutStringRead;
3871 }
3872 
3875 
3876  Int_t posLabel = photon->GetTrackLabelPositive();
3877  Int_t negLabel = photon->GetTrackLabelNegative();
3878 
3879  fElectronLabelArray[nV0*2] = posLabel;
3880  fElectronLabelArray[(nV0*2)+1] = negLabel;
3881 }
3882 
3885 
3886  Int_t posLabel = photon->GetTrackLabelPositive();
3887  Int_t negLabel = photon->GetTrackLabelNegative();
3888 
3889  for(Int_t i = 0; i<nV0s*2;i++){
3890  if(i==nV0*2) continue;
3891  if(i==(nV0*2)+1) continue;
3892  if(fElectronLabelArray[i] == posLabel){
3893  return kFALSE;}
3894  if(fElectronLabelArray[i] == negLabel){
3895  return kFALSE;}
3896  }
3897 
3898  return kTRUE;
3899 }
3900 
3903 
3904  if (fDoDoubleCountingCut && photon->GetConversionRadius() < fMinRDC) return kTRUE;
3905 
3906  Double_t posX = photon->GetConversionX();
3907  Double_t posY = photon->GetConversionY();
3908  Double_t posZ = photon->GetConversionZ();
3909 
3910  for(Int_t i = 0;i<photons->GetEntries();i++){
3911  if(nV0 == i) continue;
3912  AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
3913  Double_t posCompX = photonComp->GetConversionX();
3914  Double_t posCompY = photonComp->GetConversionY();
3915  Double_t posCompZ = photonComp->GetConversionZ();
3916 
3917  if (!fDoDoubleCountingCut){
3918  Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
3919 
3920  if(dist < fminV0Dist*fminV0Dist){
3921  if(photon->GetChi2perNDF() > photonComp->GetChi2perNDF()) return kFALSE;
3922  }
3923  }else{
3924  TVector3 v1(photon->Px(),photon->Py(),photon->Pz());
3925  TVector3 v2(photonComp->Px(),photonComp->Py(),photonComp->Pz());
3926  Double_t OpeningAngle=v1.Angle(v2);
3927  if( OpeningAngle < fOpenAngle && TMath::Abs(photon->GetConversionRadius()-photonComp->GetConversionRadius()) < fDeltaR){
3928  if(photon->GetChi2perNDF() > photonComp->GetChi2perNDF()) return kFALSE;
3929  }
3930  }
3931 
3932  }
3933  return kTRUE;
3934 }
3935 
3936 
3939  //Create and return standard 2010 PbPb cuts
3940  AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
3941  if(!cuts->InitializeCutsFromCutString("04209297002322000000")){
3942  cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
3943  return cuts;
3944 }
3945 
3948  //Create and return standard 2010 PbPb cuts
3949  AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010pp","StandardCuts2010pp");
3950  if(!cuts->InitializeCutsFromCutString("00209366300380000000")){
3951  cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
3952  return cuts;
3953 }
3954 
3957 
3958  //GetPhotonPhi() 0-2 Pi //eventPlaneAngle -1pi-1pi
3959  eventPlaneAngle=eventPlaneAngle+TMath::Pi();
3960  Double_t gammaToEPAngle = eventPlaneAngle-photonPhi;
3961  if(gammaToEPAngle < 0) gammaToEPAngle=gammaToEPAngle+2*TMath::Pi();
3962  gammaToEPAngle = gammaToEPAngle-TMath::Pi(); // angle from -pi +pi
3963 
3964  if(!fInPlaneOutOfPlane){
3965  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3966  return kTRUE;
3967  }
3968  else if(fInPlaneOutOfPlane == 1){
3969  if(TMath::Abs(gammaToEPAngle)<=0.25*TMath::Pi() || TMath::Abs(gammaToEPAngle)>=0.75*TMath::Pi()){
3970  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3971  return kTRUE;
3972  }
3973  else return kFALSE;
3974  }
3975  else if(fInPlaneOutOfPlane == 2){
3976  if(TMath::Abs(gammaToEPAngle)>0.25*TMath::Pi() && TMath::Abs(gammaToEPAngle)<0.75*TMath::Pi()){
3977  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3978  return kTRUE;
3979  }
3980  else return kFALSE;
3981  }
3982  return kFALSE;
3983 }
3984 
3987 
3988  AliAODTrack * negTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelNegative()));
3989  AliAODTrack * posTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelPositive()));
3990 
3991  if(!negTrack || !posTrack) {
3992  return 0;
3993  }
3994  if(negTrack->Charge() == posTrack->Charge()){
3995  return 0;
3996  }
3997  Int_t nClusterITSneg = negTrack->GetITSNcls();
3998  Int_t nClusterITSpos = posTrack->GetITSNcls();
3999  // cout << nClusterITSneg << "\t" << nClusterITSpos <<endl;
4000 
4001  if (nClusterITSneg > 1 && nClusterITSpos > 1){
4002  return 3;
4003  } else if (nClusterITSneg > 1 || nClusterITSpos > 1){
4004  return 2;
4005  } else {
4006  return 1;
4007  }
4008  return 0;
4009 }
4010 
4013 
4014  TString nameProfile;
4015  if (flag==1){
4016  nameProfile = "profileContainingMaterialBudgetWeights_fewRadialBins";}
4017  else if (flag==2){
4018  nameProfile = "profileContainingMaterialBudgetWeights_manyRadialBins";}
4019  else {
4020  AliError(Form("%d not a valid flag for InitMaterialBudgetWeightingOfPi0Candidates()",flag));
4021  return kFALSE;
4022  }
4023  TFile* file = TFile::Open(filename.Data());
4024  if (!file) {
4025  AliError(Form("File %s for materialbudgetweights not found",filename.Data()));
4026  return kFALSE;
4027  }
4028  fProfileContainingMaterialBudgetWeights = (TProfile*)file->Get(nameProfile.Data());
4030  AliError(Form("Histogram %s not found in file",nameProfile.Data()));
4031  return kFALSE;
4032  }
4033  fProfileContainingMaterialBudgetWeights->SetDirectory(0);
4034  file->Close();
4035  delete file;
4036 
4038  AliInfo(Form("MaterialBudgetWeightingOfPi0Candidates initialized with flag %d. This means %d radial bins will be used for the weighting. File used: %s.",flag, fProfileContainingMaterialBudgetWeights->GetNbinsX(), filename.Data()));
4039  return kTRUE;
4040 }
4041 
4044 
4045  Float_t weight = 1.0;
4046  Float_t gammaConversionRadius = gamma->GetConversionRadius();
4047  Int_t bin = fProfileContainingMaterialBudgetWeights->FindBin(gammaConversionRadius);
4048  if (bin > 0 && bin <= fProfileContainingMaterialBudgetWeights->GetNbinsX()){
4049  weight = fProfileContainingMaterialBudgetWeights->GetBinContent(bin);
4050  }
4051  return weight;
4052 }
Int_t charge
Double_t fTofPIDnSigmaAboveElectronLine
sigma cut RRnewTOF
Double_t fMinRDC
Min R for Double Counting Cut.
Bool_t SetDCARPhotonPrimVtxCut(Int_t DCARPhotonPrimVtx)
const char * filename
Definition: TestFCM.C:1
TH2F * fHistoTOFSigafter
TOF Sigma after cuts.
Bool_t SetQtMaxCut(Int_t QtMaxCut)
Float_t fMaxPhiCut
phi sector cut
Bool_t fPreSelCut
Flag for preselection cut used in V0Reader.
Double_t fMinPPhotonAsymmetryCut
Min Momentum for Asymmetry Cut.
TH2F * fHistoAcceptanceCuts
bookkeeping for acceptance cuts
#define P(T, U, S)
Double_t fPIDTRDEfficiency
required electron efficiency for TRD PID
Double_t GetArmenterosAlpha() const
double Double_t
Definition: External.C:58
TH2F * fHistodEdxCuts
bookkeeping for dEdx cuts
Bool_t RejectSharedElectronV0s(AliAODConversionPhoton *photon, Int_t nV0, Int_t nV0s)
Double_t fOpenAngle
Opening Angle for Double Counting Cut.
TH2F * fHistoPhotonCuts
bookkeeping for photon specific cuts
Double_t fPIDnSigmaAbovePionLine
sigma cut
virtual Double_t GetPz() const =0
Definition: External.C:236
Bool_t fDodEdxSigmaCut
flag to use the dEdxCut based on sigmas
TObjString * fCutString
cut number used for analysis
Double_t fMinClsTPC
minimum clusters in the TPC
const char * title
Definition: MakeQAPdf.C:27
Int_t GetFirstTPCRow(Double_t radius)
static const char * fgkCutNames[kNCuts]
Bool_t InitializeElecDeDxPostCalibration(TString filename)
Double_t fDCAZPrimVtxCut
cut value for the maximum distance in Z between the photon & the primary vertex [cm] ...
Bool_t fSwitchToKappa
switches from standard dEdx nSigma TPC cuts to Kappa TPC
TH1F * fHistoCutIndex
bookkeeping for cuts
Bool_t PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent *event)
Bool_t SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
TH2F * fHistoTPCdEdxSigafter
TPC Sigm dEdx after cuts.
Double_t fMinPhotonAsymmetry
Asymmetry Cut.
Double_t fTRDPIDAboveCut
TRD cut range.
Float_t fEtaForPhiCutMin
eta cut for phi sector selection
#define ASSIGNARRAY(i)
Bool_t SetSinglePtCut(Int_t singlePtCut)
Bool_t fMaterialBudgetWeightsInitialized
weights for conversions photons due due deviating material budget in MC compared to data ...
TH2F * fHistoTPCdEdxafter
TPC dEdx after cuts.
Double_t fDeltaR
Delta R for Double Counting Cut.
Int_t fInPlaneOutOfPlane
In-Plane Out-Of Plane Analysis.
Float_t GetDCAzToPrimVtx() const
TH2F * fHistoArmenterosafter
armenteros podolanski plot after cuts
AliPIDResponse * fPIDResponse
PID response.
Bool_t AsymmetryCut(AliConversionPhotonBase *photon, AliVEvent *event)
virtual Double_t GetPx() const =0
Double_t fPIDMinPPionRejectionLowP
Momentum limit to apply proton rejection.
TH2F * fHistoPsiPairDeltaPhiafter
TOF Sigma after cuts.
TH2F * fHistoArmenterosbefore
armenteros podolanski plot before cuts
Bool_t SetToCloseV0sCut(Int_t toClose)
void InitCutHistograms(TString name="", Bool_t preCut=kTRUE)
TH2F * fHistoTOFbefore
TOF before cuts.
Bool_t SetTOFElectronPIDCut(Int_t TOFelectronPID)
Bool_t fDoShrinkTPCAcceptance
Flag for shrinking the TPC acceptance due to different reasons.
Bool_t PhotonIsSelectedAODMC(AliAODMCParticle *particle, TClonesArray *aodmcArray, Bool_t checkForConvertedGamma=kTRUE)
AliConversionPhotonCuts(const char *name="V0Cuts", const char *title="V0 Cuts")
Float_t fMinPhiCut
phi sector cut
TH1F * fHistoInvMassafter
e+e- inv mass distribution after cuts
Bool_t SetMinPhiSectorCut(Int_t minPhiCut)
void FillElectonLabelArray(AliAODConversionPhoton *photon, Int_t nV0)
Double_t fSinglePtCut2
second pt cut for electron/positron if asymmetric cut is chosen
Double_t GetCorrectedElectronTPCResponse(Short_t charge, Double_t nsig, Double_t P, Double_t Eta, Double_t R)
AliESDtrack * GetESDTrack(AliESDEvent *event, Int_t label)
TH2F * fHistoITSSigafter
ITS Sigma after cuts.
static AliConversionPhotonCuts * GetStandardCuts2010PbPb()
Double_t fDoKaonRejectionLowP
Kaon rejection at low p.
Int_t fElectronArraySize
Size of electron array.
TH2F * fHistoTOFSigbefore
TOF Sigma before cuts.
Int_t fIsHeavyIon
flag for pp (0), PbPb (1), pPb (2)
Bool_t RejectToCloseV0s(AliAODConversionPhoton *photon, TList *photons, Int_t nV0)
virtual Double_t GetPhotonP() const =0
virtual Double_t GetPhotonPhi() const =0
Bool_t InPlaneOutOfPlaneCut(Double_t photonPhi, Double_t eventPlaneAngle=-100, Bool_t fill=kTRUE)
Bool_t fElecDeDxPostCalibrationInitialized
flag to check that initialization worked
Bool_t PhotonCuts(AliConversionPhotonBase *photon, AliVEvent *event)
Bool_t SetChi2GammaCut(Int_t chi2GammaCut)
int Int_t
Definition: External.C:63
Bool_t SetCut(cutIds cutID, Int_t cut)
Double_t fDoPionRejectionLowP
Pion rejection at low p.
TH1F * fHistoInvMassbefore
e+e- inv mass distribution before cuts
TH1F * fHistoEventPlanePhi
EventPlaneAngle Minus Photon Angle.
float Float_t
Definition: External.C:68
Bool_t fUseITSpid
flag to use tof pid
TH1F * fHistoEtaDistV0sAfterdEdxCuts
eta-distribution of all V0s after Finder selection after dEdx cuts
Float_t fConversionPointYArray
Array with conversion Point y.
Double_t fTRDPIDBelowCut
TRD cut range.
Double_t fPIDMaxPnSigmaAbovePionLine
sigma cut
Double_t fITSPIDnSigmaAboveElectronLine
sigma cut RRnewTOF
Double_t fDCARPrimVtxCut
cut value for the maximum distance in R between the photon & the primary vertex [cm] ...
void DeterminePhotonQuality(AliVTrack *negTrack, AliVTrack *posTrack)
Bool_t SetITSElectronPIDCut(Int_t ITSelectronPID)
Bool_t SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut)
TH2F * fHistoITSSigbefore
ITS Sigma before cuts.
Double_t fPIDnSigmaAtLowPAroundKaonLine
sigma cut
Bool_t SetKappaTPCCut(Int_t kappaCut)
Double_t fPIDnSigmaAtLowPAroundPionLine
sigma cut
Bool_t fDoTOFsigmaCut
flag to use TOF pid cut RRnewTOF
Bool_t SetDCAZPhotonPrimVtxCut(Int_t DCAZPhotonPrimVtx)
Int_t GetTrackLabel(Int_t i) const
Bool_t SetMinMomPiondEdxCut(Int_t piMinMomdedxSigmaCut)
Double_t fPIDMinPnSigmaAbovePionLine
sigma cut
Double_t fPIDnSigmaBelowElectronLine
sigma cut
Bool_t PhotonIsSelectedMC(TParticle *particle, AliMCEvent *mcEvent, Bool_t checkForConvertedGamma=kTRUE)
Class handling all kinds of selection cuts for Gamma Conversion analysis.
Bool_t fDoPhotonAsymmetryCut
flag to use the PhotonAsymetryCut
TString fV0ReaderName
Name of the V0 reader.
Float_t GetDCArToPrimVtx() const
TH2F * fHistoAsymmetryafter
asymmetry plot after cuts
Bool_t fDoPhotonPDependentAsymCut
flag to use the PhotonAsymetryCut with P dependent cut
virtual Double_t GetPhotonPt() const =0
TProfile * fProfileContainingMaterialBudgetWeights
Bool_t InitializeCutsFromCutString(const TString analysisCutSelection)
Bool_t SetCosPAngleCut(Int_t cosCut)
Bool_t SetEtaForPhiCut(Int_t etaPhiCut)
Bool_t SetTPCClusterCut(Int_t clsTPCCut)
Bool_t InitializeMaterialBudgetWeights(Int_t flag, TString filename)
Bool_t fUseTOFpid
flag to use tof pid
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)
short Short_t
Definition: External.C:23
Float_t GetMaterialBudgetCorrectingWeightForTrueGamma(AliAODConversionPhoton *gamma)
TList * fHistograms
List of QA histograms.
Bool_t fDoQtGammaSelection
Select gammas using qtMax.
Float_t fKappaMinCut
maximum Kappa cut
TH2F * fHistoTPCdEdxbefore
TPC dEdx before cuts.
Bool_t fProcessAODCheck
Flag for processing check for AOD to be contained in AliAODs.root and AliAODGammaConversion.root.
TH2F * fHistoKappaafter
Kappa vs photon pt after cuts.
Float_t fKappaMaxCut
maximum Kappa cut
virtual Double_t GetPy() const =0
Bool_t SetTRDElectronCut(Int_t TRDElectronCut)
void FillPhotonCutIndex(Int_t photoncut)
Double_t fSinglePtCut
pt cut for electron/positron
Bool_t SetPsiPairCut(Int_t psiCut)
TH2F * fHistoTPCdEdxSigbefore
TPC Sigma dEdx before cuts.
Bool_t SpecificTrackCuts(AliAODTrack *negTrack, AliAODTrack *posTrack, Int_t &cutIndex)
Cut functions.
Double_t fQtMax
Maximum Qt from Armenteros to select Gammas.
Double_t fTofPIDnSigmaBelowElectronLine
sigma cut RRnewTOF
Float_t fOpeningAngle
min opening angle for meson
UChar_t DeterminePhotonQualityAOD(AliAODConversionPhoton *, AliVEvent *)
Bool_t SelectV0Finder(Bool_t onfly)
TH1F * fHistoEtaDistV0s
eta-distribution of all V0s after Finder selection
Bool_t fDo2DQt
Select gammas using ellipse cut.
Bool_t AcceptanceCuts(AliConversionPhotonBase *photon)
Bool_t fDoDoubleCountingCut
Flag to reject double counting.
Double_t fMinClsTPCToF
minimum clusters to findable clusters
TFile * file
TList with histograms for a given trigger.
Float_t GetKappaTPC(AliConversionPhotonBase *gamma, AliVEvent *event)
AliVTrack * GetTrack(AliVEvent *event, Int_t label)
Bool_t CosinePAngleCut(const AliConversionPhotonBase *photon, AliVEvent *event) const
Int_t fUseOnFlyV0FinderSameSign
int to set same sign pairing
Double_t fPIDnSigmaAbovePionLineHighPt
sigma cut
Double_t fPIDMinPProtonRejectionLowP
Momentum limit to apply proton rejection.
Float_t fConversionPointXArray
Array with conversion Point x.
static AliConversionPhotonCuts * GetStandardCuts2010pp()
Bool_t SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
Double_t fPIDnSigmaAtLowPAroundProtonLine
sigma cut
Bool_t PsiPairCut(const AliConversionPhotonBase *photon) const
Double_t fMaxPtPIDITS
max pt for ITS PID
Bool_t SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
bool Bool_t
Definition: External.C:53
Bool_t dEdxCuts(AliVTrack *track, AliConversionPhotonBase *photon)
void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex *primVertex)
Bool_t fUseCorrectedTPCClsInfo
flag to use corrected tpc cl info
Double_t fPIDnSigmaAboveElectronLine
sigma cut
Bool_t TracksAreSelected(AliVTrack *negTrack, AliVTrack *posTrack)
Bool_t KappaCuts(AliConversionPhotonBase *photon, AliVEvent *event)
Bool_t SetInPlaneOutOfPlane(Int_t inOutPlane)
Bool_t SetMaxPhiSectorCut(Int_t maxPhiCut)
Bool_t fDoTRDPID
flag to use TRD pid
Bool_t SetSharedElectronCut(Int_t sharedElec)
Double_t fITSPIDnSigmaBelowElectronLine
sigma cut RRnewTOF
Bool_t SetV0Finder(Int_t v0FinderType)
Bool_t AcceptanceCut(TParticle *particle, TParticle *ePos, TParticle *eNeg)
Bool_t SetTRDElectronPIDCut(Int_t TRDelectronPID)
Bool_t fDoLightOutput
switch for running light output, kFALSE -> normal mode, kTRUE -> light mode
Bool_t fDoAsymPtCut
Flag for setting asymmetric pT cut on electron/positron.
TH1F * fHistoTrackCuts
bookkeeping for track cuts
Double_t GetCosineOfPointingAngle(const AliConversionPhotonBase *photon, AliVEvent *event) const
Double_t GetConversionRadius() const
Bool_t ArmenterosQtCut(AliConversionPhotonBase *photon)
Bool_t CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent *event)
Float_t fEtaForPhiCutMax
eta cut for phi sector selection
Double_t fDoProtonRejectionLowP
Proton rejection at low p.
virtual Double_t GetPhotonEta() const =0
Double_t fPIDMinPKaonRejectionLowP
Momentum limit to apply kaon rejection.
Bool_t PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent *event)
Float_t fConversionPointZArray
Array with conversion Point z.
Bool_t SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
TH2F * fHistoAsymmetrybefore
asymmetry plot after cuts