AliPhysics  9b6b435 (9b6b435)
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[AliPID::kSPECIES];
1803  Double_t negProbArray[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  return iResult;
1819 
1820  } else {
1822  return kTRUE;
1823  }
1824 }
1825 
1826 
1828 Bool_t AliConversionPhotonCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1829  // MC Acceptance Cuts
1830  //(Certain areas were excluded for photon reconstruction)
1831 
1832  if(particle->R()>fMaxR){
1833  return kFALSE;}
1834 
1835  if(ePos->R()>fMaxR){
1836  return kFALSE;
1837  }
1838 
1839  if(ePos->R()<fMinR){
1840  return kFALSE;
1841  }
1842 
1843  if( ePos->R() <= ((TMath::Abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1844  return kFALSE;
1845  }
1846  else if (fUseEtaMinCut && ePos->R() >= ((TMath::Abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1847  return kFALSE;
1848  }
1849 
1850  if(TMath::Abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1851  return kFALSE;
1852  }
1853 
1854  if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1855  return kFALSE;
1856  }
1857 
1858  if(TMath::Abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1859  return kFALSE;
1860  }
1861 
1862 
1863  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) ){
1864  return kFALSE;
1865  }
1866  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ){
1867  return kFALSE;
1868  }
1869  if( eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) ){
1870  return kFALSE;
1871  }
1872  if(fEtaCutMin>-0.1){
1873  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) ){
1874  return kFALSE;
1875  }
1876  if( ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin) ){
1877  return kFALSE;
1878  }
1879  if( eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin) ){
1880  return kFALSE;
1881  }
1882  }
1883 
1884  if(fDoAsymPtCut){
1885  if((ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut2) && (ePos->Pt()<fSinglePtCut2 || eNeg->Pt()<fSinglePtCut) ){
1886  return kFALSE;
1887  }
1888  } else {
1889  if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
1890  return kFALSE;
1891  }
1892  }
1893 
1894  if(particle->Pt()<fPtCut){
1895  return kFALSE;
1896  }
1897 
1898  return kTRUE;
1899 }
1903 
1904  if(fCutString && fCutString->GetString().Length() == kNCuts) {
1905  fCutString->SetString(GetCutNumber());
1906  } else {
1907  return kFALSE;
1908  }
1909  return kTRUE;
1910 }
1911 
1912 
1915  fCutStringRead = Form("%s",analysisCutSelection.Data());
1916 
1917  // Initialize Cuts from a given Cut string
1918  AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1919  if(analysisCutSelection.Length()!=kNCuts) {
1920  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1921  return kFALSE;
1922  }
1923  if(!analysisCutSelection.IsAlnum()){
1924  AliError("Cut selection is not alphanumeric");
1925  return kFALSE;
1926  }
1927 
1928  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
1929  analysisCutSelectionLowerCase.ToLower();
1930  const char *cutSelection = analysisCutSelectionLowerCase.Data();
1931  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
1932  for(Int_t ii=0;ii<kNCuts;ii++){
1933  ASSIGNARRAY(ii);
1934  }
1935 
1936  // Set Individual Cuts
1937  for(Int_t ii=0;ii<kNCuts;ii++){
1938  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1939  }
1940 
1942 
1943  return kTRUE;
1944 }
1948 
1949  switch (cutID) {
1950 
1951  case kv0FinderType:
1952  if( SetV0Finder(value)) {
1953  fCuts[kv0FinderType] = value;
1954  UpdateCutString();
1955  return kTRUE;
1956  } else return kFALSE;
1957 
1958  case ketaCut:
1959  if( SetEtaCut(value)) {
1960  fCuts[ketaCut] = value;
1961  UpdateCutString();
1962  return kTRUE;
1963  } else return kFALSE;
1964 
1965  case kRCut:
1966  if( SetRCut(value)) {
1967  fCuts[kRCut] = value;
1968  UpdateCutString();
1969  return kTRUE;
1970  } else return kFALSE;
1971 
1972  case kEtaForPhiSector:
1973  if( SetEtaForPhiCut(value)) {
1974  fCuts[kEtaForPhiSector] = value;
1975  UpdateCutString();
1976  return kTRUE;
1977  } else return kFALSE;
1978  case kMinPhiSector:
1979  if( SetMinPhiSectorCut(value)) {
1980  fCuts[kMinPhiSector] = value;
1981  UpdateCutString();
1982  return kTRUE;
1983  } else return kFALSE;
1984  case kMaxPhiSector:
1985  if( SetMaxPhiSectorCut(value)) {
1986  fCuts[kMaxPhiSector] = value;
1987  UpdateCutString();
1988  return kTRUE;
1989  } else return kFALSE;
1990 
1991  case ksinglePtCut:
1992  if( SetSinglePtCut(value)) {
1993  fCuts[ksinglePtCut] = value;
1994  UpdateCutString();
1995  return kTRUE;
1996  } else return kFALSE;
1997 
1998  case kclsTPCCut:
1999  if( SetTPCClusterCut(value)) {
2000  fCuts[kclsTPCCut] = value;
2001  UpdateCutString();
2002  return kTRUE;
2003  } else return kFALSE;
2004 
2005  case kededxSigmaCut:
2006  if (!fSwitchToKappa){
2007  if( SetTPCdEdxCutElectronLine(value)) {
2008  fCuts[kededxSigmaCut] = value;
2009  UpdateCutString();
2010  return kTRUE;
2011  } else return kFALSE;
2012  } else {
2013  if( SetKappaTPCCut(value)) {
2014  fCuts[kededxSigmaCut] = value;
2015  UpdateCutString();
2016  return kTRUE;
2017  } else return kFALSE;
2018  }
2019  case kpidedxSigmaCut:
2020  if (!fSwitchToKappa){
2021  if( SetTPCdEdxCutPionLine(value)) {
2022  fCuts[kpidedxSigmaCut] = value;
2023  UpdateCutString();
2024  return kTRUE;
2025  } else return kFALSE;
2026  } else {
2027  fCuts[kpidedxSigmaCut] = 0;
2028  return kTRUE;
2029  }
2030  case kpiMomdedxSigmaCut:
2031  if (!fSwitchToKappa){
2032  if( SetMinMomPiondEdxCut(value)) {
2033  fCuts[kpiMomdedxSigmaCut] = value;
2034  UpdateCutString();
2035  return kTRUE;
2036  } else return kFALSE;
2037  } else {
2039  return kTRUE;
2040  }
2041  case kpiMaxMomdedxSigmaCut:
2042  if (!fSwitchToKappa){
2043  if( SetMaxMomPiondEdxCut(value)) {
2044  fCuts[kpiMaxMomdedxSigmaCut] = value;
2045  UpdateCutString();
2046  return kTRUE;
2047  } else return kFALSE;
2048  } else {
2050  return kTRUE;
2051  }
2053  if (!fSwitchToKappa){
2054  if( SetLowPRejectionCuts(value)) {
2055  fCuts[kLowPRejectionSigmaCut] = value;
2056  UpdateCutString();
2057  return kTRUE;
2058  } else return kFALSE;
2059  } else {
2061  return kTRUE;
2062  }
2063  case kTOFelectronPID:
2064  if( SetTOFElectronPIDCut(value)) {
2065  fCuts[kTOFelectronPID] = value;
2066  UpdateCutString();
2067  return kTRUE;
2068  } else return kFALSE;
2069 
2070  case kQtMaxCut:
2071  if( SetQtMaxCut(value)) {
2072  fCuts[kQtMaxCut] = value;
2073  UpdateCutString();
2074  return kTRUE;
2075  } else return kFALSE;
2076 
2077 
2078  case kchi2GammaCut:
2079  if( SetChi2GammaCut(value)) {
2080  fCuts[kchi2GammaCut] = value;
2081  UpdateCutString();
2082  return kTRUE;
2083  } else return kFALSE;
2084 
2085  case kPsiPair:
2086  if( SetPsiPairCut(value)) {
2087  fCuts[kPsiPair] = value;
2088  UpdateCutString();
2089  return kTRUE;
2090  } else return kFALSE;
2091 
2092  case kdoPhotonAsymmetryCut:
2093  if( SetPhotonAsymmetryCut(value)) {
2094  fCuts[kdoPhotonAsymmetryCut] = value;
2095  UpdateCutString();
2096  return kTRUE;
2097  } else return kFALSE;
2098 
2099  case kCosPAngle:
2100  if( SetCosPAngleCut(value)) {
2101  fCuts[kCosPAngle] = value;
2102  UpdateCutString();
2103  return kTRUE;
2104  } else return kFALSE;
2105 
2106  case kElecShare:
2107  if( SetSharedElectronCut(value)) {
2108  fCuts[kElecShare] = value;
2109  UpdateCutString();
2110  return kTRUE;
2111  } else return kFALSE;
2112 
2113  case kToCloseV0s:
2114  if( SetToCloseV0sCut(value)) {
2115  fCuts[kToCloseV0s] = value;
2116  UpdateCutString();
2117  return kTRUE;
2118  } else return kFALSE;
2119 
2120  case kDcaRPrimVtx:
2121  if( SetDCARPhotonPrimVtxCut(value)) {
2122  fCuts[kDcaRPrimVtx] = value;
2123  UpdateCutString();
2124  return kTRUE;
2125  } else return kFALSE;
2126 
2127  case kDcaZPrimVtx:
2128  if( SetDCAZPhotonPrimVtxCut(value)) {
2129  fCuts[kDcaZPrimVtx] = value;
2130  UpdateCutString();
2131  return kTRUE;
2132  } else return kFALSE;
2133 
2134  case kInPlaneOutOfPlane:
2135  if( SetInPlaneOutOfPlane(value)) {
2136  fCuts[kInPlaneOutOfPlane] = value;
2137  UpdateCutString();
2138  return kTRUE;
2139  } else return kFALSE;
2140 
2141  case kITSelectronPID:
2142  if( SetITSElectronPIDCut(value)) {
2143  fCuts[kITSelectronPID] = value;
2144  UpdateCutString();
2145  return kTRUE;
2146  } else return kFALSE;
2147 
2148  case kTRDelectronPID:
2149  if( SetTRDElectronPIDCut(value)) {
2150  fCuts[kTRDelectronPID] = value;
2151  UpdateCutString();
2152  return kTRUE;
2153  } else return kFALSE;
2154 
2155  case kNCuts:
2156  AliError("Cut id out of range");
2157  return kFALSE;
2158  }
2159 
2160  AliError("Cut id %d not recognized");
2161  return kFALSE;
2162 }
2165  // Print out current Cut Selection
2166  for(Int_t ic = 0; ic < kNCuts; ic++) {
2167  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
2168  }
2169 }
2170 
2172  // Print out current Cut Selection with value
2173  printf("\nConversion cutnumber \n");
2174  for(Int_t ic = 0; ic < kNCuts; ic++) {
2175  printf("%d",fCuts[ic]);
2176  }
2177  printf("\n\n");
2178  printf("Electron cuts & Secondary Track Cuts - only track from secondaries enter analysis: \n");
2179  printf("\t no like sign pairs from V0s \n");
2180  if (!fUseCorrectedTPCClsInfo) printf("\t # TPC clusters > %3.2f \n", fMinClsTPC);
2181  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{e} < %3.2f\n", fEtaCutMin, fEtaCut );
2182  else printf("\t eta_{e} < %3.2f\n", fEtaCut );
2183  printf("\t reject: %3.2f < phi < %3.2f with %3.2f < eta < %3.2f \n", fMinPhiCut, fMaxPhiCut, fEtaForPhiCutMin, fEtaForPhiCutMax);
2184  if(fDoAsymPtCut)
2185  printf("\t Asymmetric cut: p_{T,e1} > %3.2f and p_{T,e2} > %3.2f\n", fSinglePtCut, fSinglePtCut2 );
2186  else
2187  printf("\t p_{T,e} > %3.2f\n", fSinglePtCut );
2188  printf("\t TPC refit \n");
2189  printf("\t no kinks \n");
2190  if (!fSwitchToKappa){
2191  printf("\t accept: %3.2f < n sigma_{e,TPC} < %3.2f\n", fPIDnSigmaBelowElectronLine, fPIDnSigmaAboveElectronLine );
2192  printf("\t reject: %3.2f < p_{e,T} < %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMinPnSigmaAbovePionLine, fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLine );
2193  printf("\t reject: p_{e,T} > %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLineHighPt );
2194  if (fDoPionRejectionLowP) printf("\t reject: p_{e,T} < %3.2f, -%3.2f < n sigma_{pi,TPC} < %3.2f\n", fPIDMinPPionRejectionLowP, fPIDnSigmaAtLowPAroundPionLine, fPIDnSigmaAtLowPAroundPionLine );
2195  if (fDoKaonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{K,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundKaonLine, fPIDnSigmaAtLowPAroundKaonLine );
2196  if (fDoProtonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{p,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundProtonLine, fPIDnSigmaAtLowPAroundProtonLine );
2197  } else {
2198  printf("\t accept: %3.2f <= Kappa_{TPC} < %3.2f\n", fKappaMinCut, fKappaMaxCut );
2199  }
2200  if (fUseTOFpid) printf("\t accept: %3.2f < n sigma_{e,TOF} < %3.2f\n", fTofPIDnSigmaBelowElectronLine, fTofPIDnSigmaAboveElectronLine);
2201  if (fUseITSpid) printf("\t accept: %3.2f < n sigma_{e,ITS} < %3.2f\n -- up to pT %3.2f", fITSPIDnSigmaBelowElectronLine, fITSPIDnSigmaAboveElectronLine, fMaxPtPIDITS);
2202 
2203  printf("Photon cuts: \n");
2204  if (fUseOnFlyV0Finder) printf("\t using Onfly V0 finder \n");
2205  else printf("\t using Offline V0 finder \n");
2206  if (fDo2DQt){
2207  printf("\t 2 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2208  } else {
2209  printf("\t 1 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2210  }
2211  if (fDo2DPsiPairChi2){
2212  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 );
2213  } else {
2214  printf("\t chi^{2} max cut chi^{2} < %3.2f \n", fChi2CutConversion );
2215  printf("\t psi_{pair} max cut |psi_{pair}| < %3.2f \n", fPsiPairCut );
2216  }
2217  printf("\t %3.2f < R_{conv} < %3.2f\n", fMinR, fMaxR );
2218  printf("\t Z_{conv} < %3.2f\n", fMaxZ );
2219  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{conv} < %3.2f\n", fEtaCutMin, fEtaCut );
2220  else printf("\t eta_{conv} < %3.2f\n", fEtaCut );
2221  if (fDoPhotonAsymmetryCut) printf("\t for p_{T,track} > %3.2f, A_{gamma} < %3.2f \n", fMinPPhotonAsymmetryCut, fMinPhotonAsymmetry );
2222  if (fDoPhotonPDependentAsymCut && fDoPhotonAsymmetryCut) printf("\t p-dependent asymmetry cut \n");
2223  if (fUseCorrectedTPCClsInfo) printf("\t #cluster TPC/ #findable clusters TPC (corrected for radius) > %3.2f\n", fMinClsTPCToF );
2224  printf("\t p_{T,gamma} > %3.2f\n", fPtCut );
2225  printf("\t cos(Theta_{point}) > %3.2f \n", fCosPAngleCut );
2226  printf("\t dca_{R} < %3.2f \n", fDCARPrimVtxCut );
2227  printf("\t dca_{Z} < %3.2f \n", fDCAZPrimVtxCut );
2228  if (fDoPhotonQualitySelectionCut) printf("\t selection based on photon quality with quality %d \n", fPhotonQualityCut );
2229  if (fDoPhotonQualityRejectionCut) printf("\t rejection based on photon quality with quality %d \n", fPhotonQualityCut );
2230  if (fDoDoubleCountingCut) printf("\t Reject doubly counted photons with R > %3.2f, DeltaR < %3.2f, OpenAngle < %3.2f \n", fMinRDC, fDeltaR,fOpenAngle );
2231 
2232 }
2233 
2236  switch (v0FinderType){
2237  case 0: // on fly V0 finder
2238  cout << "have chosen onfly V0" << endl;
2239  fUseOnFlyV0Finder=kTRUE;
2241  break;
2242  case 1: // offline V0 finder
2243  cout << "have chosen offline V0" << endl;
2244  fUseOnFlyV0Finder=kFALSE;
2246  break;
2247  case 2: // on fly V0 finder with same signs
2248  cout << "have chosen onfly V0 same sign pairing" << endl;
2249  fUseOnFlyV0Finder=kTRUE;
2251  break;
2252  case 3: // on fly V0 finder with unlike signs and same signs
2253  cout << "have chosen onfly V0 unlike sign and same signs pairing" << endl;
2254  fUseOnFlyV0Finder=kTRUE;
2256  break;
2257  default:
2258  AliError(Form(" v0FinderType not defined %d",v0FinderType));
2259  return kFALSE;
2260  }
2261  return kTRUE;
2262 }
2263 
2266 
2267  //Set Standard LineCutZValues
2268  fLineCutZValueMin = -2;
2269  fLineCutZValue = 7.;
2270 
2271  switch(etaCut){
2272  case 0: // 0.9
2273  fEtaCut = 0.9;
2274  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2275  fEtaCutMin = -0.1;
2276  fLineCutZRSlopeMin = 0.;
2277  break;
2278  case 1: // 0.6 // changed from 1.2 to 0.6 on 2013.06.10
2279  fEtaCut = 0.6;
2280  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2281  fEtaCutMin = -0.1;
2282  fLineCutZRSlopeMin = 0.;
2283  break;
2284  case 2: // 1.4
2285  fEtaCut = 1.4;
2286  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2287  fEtaCutMin = -0.1;
2288  fLineCutZRSlopeMin = 0.;
2289  break;
2290  case 3: // 0.65
2291  fEtaCut = 0.65;
2292  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2293  fEtaCutMin = -0.1;
2294  fLineCutZRSlopeMin = 0.;
2295  break;
2296  case 4: // 0.75
2297  fEtaCut = 0.75;
2298  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2299  fEtaCutMin = -0.1;
2300  fLineCutZRSlopeMin = 0.;
2301  break;
2302  case 5: // 0.5
2303  fEtaCut = 0.5;
2304  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2305  fEtaCutMin = -0.1;
2306  fLineCutZRSlopeMin = 0.;
2307  break;
2308  case 6: // 5.
2309  fEtaCut = 5.;
2310  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2311  fEtaCutMin = -0.1;
2312  fLineCutZRSlopeMin = 0.;
2313  break;
2314  case 7:
2315  if (fIsHeavyIon==1){
2316  fEtaCut = 0.7;
2317  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2318  fEtaCutMin = -0.1;
2319  fLineCutZRSlopeMin = 0.;
2320  break;
2321  } else {
2322  fEtaCut = 0.3;
2323  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2324  fEtaCutMin = -0.1;
2325  fLineCutZRSlopeMin = 0.;
2326  break;
2327  }
2328  // case 8: // 0.1 - 0.8
2329  // fEtaCut = 0.9;
2330  // fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2331  // fEtaCutMin = 0.1;
2332  // fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2333  // break;
2334  case 8: // 0.4
2335  fEtaCut = 0.4;
2336  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2337  fEtaCutMin = -0.1;
2338  fLineCutZRSlopeMin = 0.;
2339  break;
2340  case 9: // 10
2341  fEtaCut = 10;
2342  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2343  fEtaCutMin = -0.1;
2344  fLineCutZRSlopeMin = 0.;
2345  break;
2346  case 10: // 0.2-0.9
2347  fEtaCut = 0.9;
2348  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2349  fEtaCutMin = 0.2;
2350  fLineCutZRSlopeMin = 0.;
2351  break;
2352  case 11: // 0.2-0.9
2353  fEtaCut = 0.9;
2354  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2355  fEtaCutMin = 0.2;
2356  fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2357  break;
2358  case 12: // 0.85
2359  fEtaCut = 0.85;
2360  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2361  fEtaCutMin = -0.1;
2362  fLineCutZRSlopeMin = 0.;
2363  break;
2364  case 13: // 0.8
2365  fEtaCut = 0.8;
2366  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2367  fEtaCutMin = -0.1;
2368  fLineCutZRSlopeMin = 0.;
2369  break;
2370  default:
2371  AliError(Form(" EtaCut not defined %d",etaCut));
2372  return kFALSE;
2373  }
2374  return kTRUE;
2375 }
2376 
2379  // Set Cut
2380  switch(RCut){
2381  case 0:
2382  fMinR=0;
2383  fMaxR = 180.;
2384  break;
2385  case 1:
2386  fMinR=2.8;
2387  fMaxR = 180.;
2388  break;
2389  case 2:
2390  fMinR=5.;
2391  fMaxR = 180.;
2392  break;
2393  case 3:
2394  fMaxR = 70.;
2395  fMinR = 10.;
2396  break;
2397  case 4:
2398  fMaxR = 70.;
2399  fMinR = 5.;
2400  break;
2401  case 5:
2402  fMaxR = 180.;
2403  fMinR = 10.;
2404  break;
2405  case 6:
2406  fMaxR = 180.;
2407  fMinR = 20.;
2408  break;
2409  case 7:
2410  fMaxR = 180.;
2411  fMinR = 35.; //old 26.
2412  break;
2413  case 8:
2414  fMaxR = 180.;
2415  fMinR = 12.5;
2416  break;
2417  case 9:
2418  fMaxR = 180.;
2419  fMinR = 7.5;
2420  break;
2421  case 10:
2422  fMaxR = 33.5;
2423  fMinR = 5.;
2424  break;
2425  case 11:
2426  fMaxR = 72.;
2427  fMinR = 33.5;
2428  break;
2429  case 12:
2430  fMaxR = 180.;
2431  fMinR = 72.;
2432  break;
2433  case 13:
2434  fMaxR = 55.;
2435  fMinR = 5.;
2436  break;
2437  case 14:
2438  fMaxR = 180.;
2439  fMinR = 55.;
2440  break;
2441  case 15:
2442  fMaxR = 72.;
2443  fMinR = 5.;
2444  break;
2445  case 16:
2446  fMaxR = 180.;
2447  fMinR = 95.;
2448  break;
2449 
2450  default:
2451  AliError("RCut not defined");
2452  return kFALSE;
2453  }
2454  return kTRUE;
2455 }
2456 
2459 
2460  switch(etaPhiCut) {
2461  case 0: //no specific eta range selected, full eta range
2464  break;
2465  case 1: //eta < 0 only
2468  fEtaForPhiCutMax = 0.;
2469  break;
2470  case 2://eta > 0 only
2472  fEtaForPhiCutMin = 0.;
2474  break;
2475  default:
2476  AliError(Form("EtaForPhiCut not defined %d",etaPhiCut));
2477  return kFALSE;
2478  }
2479 
2480  return kTRUE;
2481 }
2482 
2484 // This are exclusion cuts, everything between fMinPhiCut & fMaxPhiCut will be excluded
2486 
2487  switch(minPhiCut) {
2488  case 0:
2489  fDoShrinkTPCAcceptance = kFALSE;
2490  fMinPhiCut = 0;
2491  break;
2492  case 1:
2494  fMinPhiCut = 1.7; //OROC C08 large cut
2495  break;
2496  case 2:
2498  fMinPhiCut = 4.4; //EMCal
2499  break;
2500  case 3:
2502  fMinPhiCut = 1.0; //PHOS
2503  break;
2504  case 4:
2506  fMinPhiCut = 3.4; //EMCal tight
2507  break;
2508  case 5:
2510  fMinPhiCut = 2.0; //OROC C08 medium cut
2511  break;
2512  case 6:
2514  fMinPhiCut = 2.2; //OROC C08 small cut
2515  break;
2516  case 7:
2518  fMinPhiCut = 2.4; //OROC C08 tightest cut
2519  break;
2520  case 8:
2522  fMinPhiCut = 4.54; //PHOS phi
2523  break;
2524  default:
2525  AliError(Form("MinPhiCut not defined %d",minPhiCut));
2526  return kFALSE;
2527  }
2528 
2529  return kTRUE;
2530 }
2531 
2533 // This are exclusion cuts, everything between fMinPhiCut & fMaxPhiCut will be excluded
2535 
2536  switch(maxPhiCut) {
2537  case 0:
2539  fMaxPhiCut = 2*TMath::Pi()+0.00001;
2540  break;
2541  case 1:
2543  fMaxPhiCut = 4.3; //OROC C08 large cut
2544  break;
2545  case 2:
2547  fMaxPhiCut = 5.8; //EMCal
2548  break;
2549  case 3:
2551  fMaxPhiCut = 3.0; //PHOS
2552  break;
2553  case 4:
2555  fMaxPhiCut = 1.; //EMCal
2556  break;
2557  case 5:
2559  fMaxPhiCut = 4.0; //OROC C08 medium cut
2560  break;
2561  case 6:
2563  fMaxPhiCut = 3.8; //OROC C08 small cut
2564  break;
2565  case 7:
2567  fMaxPhiCut = 3.6; //OROC C08 tighest cut
2568  break;
2569  case 8:
2571  fMaxPhiCut = 5.59; //PHOS phi
2572  break;
2573  default:
2574  AliError(Form("MaxPhiCut not defined %d",maxPhiCut));
2575  return kFALSE;
2576  }
2577 
2578  return kTRUE;
2579 }
2580 
2581 
2584  switch(singlePtCut){
2585  case 0: // 0.050 GeV + min gamma pT cut of 20 MeV
2586  fSinglePtCut = 0.050;
2587  fPtCut = 0.02;
2588  break;
2589  case 1: // 0.100 GeV + min gamma pT cut of 20 MeV
2590  fSinglePtCut = 0.100;
2591  fPtCut = 0.02;
2592  break;
2593  case 2: // 0.150 GeV + min gamma pT cut of 20 MeV
2594  fSinglePtCut = 0.150;
2595  fPtCut = 0.02;
2596  break;
2597  case 3: // 0.200 GeV + min gamma pT cut of 20 MeV
2598  fSinglePtCut = 0.200;
2599  fPtCut = 0.02;
2600  break;
2601  case 4: // 0.075 GeV + min gamma pT cut of 20 MeV
2602  fSinglePtCut = 0.075;
2603  fPtCut = 0.02;
2604  break;
2605  case 5: // 0.125 GeV + min gamma pT cut of 20 MeV
2606  fSinglePtCut = 0.125;
2607  fPtCut = 0.02;
2608  break;
2609  case 6: // 0.04 GeV + min gamma pT cut of 10 MeV
2610  fSinglePtCut = 0.040;
2611  fPtCut = 0.01;
2612  break;
2613  case 7: // 0.0 GeV + min gamma pT cut of 0 MeV
2614  fSinglePtCut = 0.0;
2615  fPtCut = 0.0;
2616  break;
2617  case 8: // 0.02 GeV + min gamma pT cut of 20 MeV, equivalent to .05 for the low B field runs
2618  fSinglePtCut = 0.02;
2619  fPtCut = 0.01;
2620  break;
2621  case 9: // 0.050 GeV + min gamma pT cut of 100 MeV
2622  fSinglePtCut = 0.050;
2623  fPtCut = 0.100;
2624  break;
2625  case 10: //a: 0.050 GeV + min gamma pT cut of 150 MeV
2626  fSinglePtCut = 0.050;
2627  fPtCut = 0.150;
2628  break;
2629  case 11: //b: 0.050 GeV + min gamma pT cut of 200 MeV
2630  fSinglePtCut = 0.050;
2631  fPtCut = 0.200;
2632  break;
2633  case 12: //c: 0.060 GeV
2634  fSinglePtCut = 0.060;
2635  break;
2636  case 13: //d: 0.060 GeV + min gamma pT cut of 100 MeV
2637  fSinglePtCut = 0.060;
2638  fPtCut = 0.100;
2639  break;
2640  case 14: //e: 0.060 GeV + min gamma pT cut of 150 MeV
2641  fSinglePtCut = 0.060;
2642  fPtCut = 0.150;
2643  break;
2644  case 15: //f: 0.060 GeV + min gamma pT cut of 200 MeV
2645  fSinglePtCut = 0.060;
2646  fPtCut = 0.200;
2647  break;
2648  case 16: //g: 0.075 GeV + min gamma pT cut of 150 MeV
2649  fSinglePtCut = 0.075;
2650  fPtCut = 0.150;
2651  break;
2652  case 17: //h: 0.100 GeV + min gamma pT cut of 200 MeV
2653  fSinglePtCut = 0.100;
2654  fPtCut = 0.200;
2655  break;
2656  case 18: //i: 0.150 GeV + min gamma pT cut of 300 MeV
2657  fSinglePtCut = 0.150;
2658  fPtCut = 0.300;
2659  break;
2660  case 19: //j: asym: 0.100 GeV and 0.075 GeV
2661  fSinglePtCut = 0.100;
2662  fDoAsymPtCut = kTRUE;
2663  fSinglePtCut2= 0.075;
2664  break;
2665  case 20: //k: asym: 0.150 GeV and 0.075 GeV
2666  fSinglePtCut = 0.150;
2667  fDoAsymPtCut = kTRUE;
2668  fSinglePtCut2= 0.075;
2669  break;
2670  case 21: //l: asym: 0.200 GeV and 0.075 GeV
2671  fSinglePtCut = 0.200;
2672  fDoAsymPtCut = kTRUE;
2673  fSinglePtCut2= 0.075;
2674  break;
2675  case 22: // m: 0.080 GeV + min gamma pT cut of 20 MeV
2676  fSinglePtCut = 0.080;
2677  fPtCut = 0.02;
2678  break;
2679  case 23: // n: 0.090 GeV + min gamma pT cut of 20 MeV
2680  fSinglePtCut = 0.090;
2681  fPtCut = 0.02;
2682  break;
2683  case 24: // o: 0.024 GeV + min gamma pT cut of 20 MeV ; equiv. 0.06 for lowB
2684  fSinglePtCut = 0.024;
2685  fPtCut = 0.01;
2686  break;
2687  case 25: // p: 0.030 GeV + min gamma pT cut of 20 MeV ; equiv. 0.075 for lowB
2688  fSinglePtCut = 0.030;
2689  fPtCut = 0.01;
2690  break;
2691  case 26: // q: 0.032 GeV + min gamma pT cut of 20 MeV ; equiv. 0.08 for lowB
2692  fSinglePtCut = 0.032;
2693  fPtCut = 0.01;
2694  break;
2695  case 27: // r: 0.036 GeV + min gamma pT cut of 20 MeV ; equiv. 0.09 for lowB
2696  fSinglePtCut = 0.036;
2697  fPtCut = 0.01;
2698  break;
2699  case 28: // s: 0.040 GeV + min gamma pT cut of 20 MeV ; equiv. 0.075 for lowB
2700  fSinglePtCut = 0.040;
2701  fPtCut = 0.01;
2702  break;
2703 
2704  default:
2705  AliError(Form("singlePtCut not defined %d",singlePtCut));
2706  return kFALSE;
2707  }
2708  return kTRUE;
2709 }
2710 
2713  switch(clsTPCCut){
2714  case 0: // 0
2715  fMinClsTPC= 0.;
2716  break;
2717  case 1: // 60
2718  fMinClsTPC= 60.;
2719  break;
2720  case 2: // 80
2721  fMinClsTPC= 80.;
2722  break;
2723  case 3: // 100
2724  fMinClsTPC= 100.;
2725  break;
2726  case 4: // 95% of findable clusters
2727  fMinClsTPCToF= 0.95;
2729  break;
2730  case 5: // 0% of findable clusters
2731  fMinClsTPCToF= 0.0;
2733  break;
2734  case 6: // 70% of findable clusters
2735  fMinClsTPCToF= 0.7;
2737  break;
2738  case 7: // 0% of findable clusters
2739  fMinClsTPCToF= 0.35;
2741  break;
2742  case 8:
2743  fMinClsTPCToF= 0.35;
2745  break;
2746  case 9:
2747  fMinClsTPCToF= 0.6;
2749  break;
2750  default:
2751  AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2752  return kFALSE;
2753  }
2754  return kTRUE;
2755 }
2756 
2759  switch(ededxSigmaCut){
2760  case 0: // -10,10
2763  break;
2764  case 1: // -5,5
2767  break;
2768  case 2: // -3,5
2771  break;
2772  case 3: // -4,5
2775  break;
2776  case 4: // -6,7
2779  break;
2780  case 5: // -4,4
2783  break;
2784  case 6: // -2.5,4
2787  break;
2788  case 7: // -2,3.5
2791  break;
2792  case 8: // -2.5,3.
2795  break;
2796  case 9: // -2.5,5.
2799  break;
2800  case 10: //a -3,3.
2803  break;
2804  case 11: //b -3.2,3.2.
2807  break;
2808  case 12: //c -2.8,2.8
2811  break;
2812  case 13: //d -1E9,1E9
2815  break;
2816  case 14: //e -7,1
2819  break;
2820  default:
2821  AliError("TPCdEdxCutElectronLine not defined");
2822  return kFALSE;
2823 
2824  }
2825  return kTRUE;
2826 }
2827 
2830 
2831  switch(pidedxSigmaCut){
2832  case 0: // -10
2835  break;
2836  case 1: // 0
2839  break;
2840  case 2: // 1
2843  break;
2844  case 3: // 1
2847  break;
2848  case 4: // 3.0sigma, 1.0 sigma at high pt
2851  break;
2852  case 5: // 1
2855  break;
2856  case 6: // 1
2859  break;
2860  case 7: // 1
2863  break;
2864  case 8: // 1
2867  break;
2868  case 9:
2869  fPIDnSigmaAbovePionLine=1; // We need a bit less tight cut on dE/dx
2871  break;
2872  case 10: //a
2873  fPIDnSigmaAbovePionLine=-3; // We need a bit less tight cut on dE/dx
2875  break;
2876  default:
2877  AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2878  return kFALSE;
2879  }
2880  return kTRUE;
2881 }
2882 
2885  switch(piMomdedxSigmaCut){
2886  case 0: // 0.5 GeV
2888  break;
2889  case 1: // 1. GeV
2891  break;
2892  case 2: // 1.5 GeV
2894  break;
2895  case 3: // 20.0 GeV
2897  break;
2898  case 4: // 50.0 GeV
2900  break;
2901  case 5: // 0.3 GeV
2903  break;
2904  case 6: // 0.25 GeV
2906  break;
2907  case 7: // 0.4 GeV
2909  break;
2910  case 8: // 0.2 GeV
2912  break;
2913  default:
2914  AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2915  return kFALSE;
2916  }
2917  return kTRUE;
2918 }
2919 
2922  switch(piMaxMomdedxSigmaCut){
2923  case 0: // 100. GeV
2925  break;
2926  case 1: // 5. GeV
2928  break;
2929  case 2: // 4. GeV
2931  break;
2932  case 3: // 3.5 GeV
2934  break;
2935  case 4: // 3. GeV
2937  break;
2938  case 5: // 7. GeV
2940  break;
2941  case 6: // 2. GeV
2943  break;
2944  default:
2945  AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2946  return kFALSE;
2947  }
2948  return kTRUE;
2949 }
2950 
2953  switch(LowPRejectionSigmaCut){
2954  case 0: //
2958  fDoKaonRejectionLowP = kFALSE;
2959  fDoProtonRejectionLowP = kFALSE;
2960  fDoPionRejectionLowP = kFALSE;
2962  break;
2963  case 1: //
2967  fDoKaonRejectionLowP = kTRUE;
2968  fDoProtonRejectionLowP = kTRUE;
2969  fDoPionRejectionLowP = kTRUE;
2971  break;
2972  case 2: //
2976  fDoKaonRejectionLowP = kTRUE;
2977  fDoProtonRejectionLowP = kTRUE;
2978  fDoPionRejectionLowP = kTRUE;
2980  break;
2981  case 3: //
2985  fDoKaonRejectionLowP = kTRUE;
2986  fDoProtonRejectionLowP = kTRUE;
2987  fDoPionRejectionLowP = kTRUE;
2989  break;
2990  case 4: //
2994  fDoKaonRejectionLowP = kFALSE;
2995  fDoProtonRejectionLowP = kFALSE;
2996  fDoPionRejectionLowP = kTRUE;
2998  break;
2999  case 5: //
3003  fDoKaonRejectionLowP = kFALSE;
3004  fDoProtonRejectionLowP = kFALSE;
3005  fDoPionRejectionLowP = kTRUE;
3007  break;
3008  case 6: //
3012  fDoKaonRejectionLowP = kFALSE;
3013  fDoProtonRejectionLowP = kFALSE;
3014  fDoPionRejectionLowP = kTRUE;
3016  break;
3017  case 7: //
3021  fDoKaonRejectionLowP = kFALSE;
3022  fDoProtonRejectionLowP = kFALSE;
3023  fDoPionRejectionLowP = kTRUE;
3025  break;
3026  case 8: //
3030  fDoKaonRejectionLowP = kFALSE;
3031  fDoProtonRejectionLowP = kTRUE;
3032  fDoPionRejectionLowP = kFALSE;
3034  break;
3035  default:
3036  AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
3037  return kFALSE;
3038  }
3039  return kTRUE;
3040 }
3041 
3044  switch(kappaCut){
3045  case 0: // completely open
3046  fKappaMaxCut=200;
3047  fKappaMinCut=-200;
3048  break;
3049  case 1: // mainly pi pi
3050  fKappaMaxCut=-13;
3051  fKappaMinCut=-20;
3052  break;
3053  case 2: // mainly pi e
3054  fKappaMaxCut=-6;
3055  fKappaMinCut=-11;
3056  break;
3057  case 3: // signal
3058  fKappaMaxCut=5;
3059  fKappaMinCut=-3;
3060  break;
3061  case 4: // remaining
3062  fKappaMaxCut=20;
3063  fKappaMinCut=11;
3064  break;
3065  case 5: // -5-10 full signal peak(including background)
3066  fKappaMaxCut=10;
3067  fKappaMinCut=-5;
3068  break;
3069  case 6: //
3070  fKappaMaxCut=10;
3071  fKappaMinCut=-3;
3072  break;
3073  case 7: //
3074  fKappaMaxCut=10;
3075  fKappaMinCut=0;
3076  break;
3077  default:
3078  AliError("KappaTPCCut not defined");
3079  return kFALSE;
3080 
3081  }
3082  return kTRUE;
3083 }
3084 
3085 
3088  // Set Cut
3089  switch(TOFelectronPID){
3090  case 0: // no cut
3091  fUseTOFpid = kFALSE;
3094  break;
3095  case 1: // -7,7
3096  fUseTOFpid = kTRUE;
3099  break;
3100  case 2: // -5,5
3101  fUseTOFpid = kTRUE;
3104  break;
3105  case 3: // -3,5
3106  fUseTOFpid = kTRUE;
3109  break;
3110  case 4: // -2,3
3111  fUseTOFpid = kTRUE;
3114  break;
3115  case 5: // -3,3
3116  fUseTOFpid = kTRUE;
3119  break;
3120  default:
3121  AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
3122  return kFALSE;
3123  }
3124  return kTRUE;
3125 }
3126 
3129  // Set Cut
3130  switch(ITSelectronPID){
3131  case 0: // no cut
3132  fUseITSpid = kFALSE;
3135  fMaxPtPIDITS = 1.5;
3136  break;
3137  case 1: // -3,3
3138  fUseITSpid = kTRUE;
3141  fMaxPtPIDITS = 1.5;
3142  break;
3143  case 2: // -2,2
3144  fUseITSpid = kTRUE;
3147  fMaxPtPIDITS = 1.5;
3148  break;
3149  case 3: // -1,1
3150  fUseITSpid = kTRUE;
3153  fMaxPtPIDITS = 1.5;
3154  break;
3155  case 4: // -3,5
3156  fUseITSpid = kTRUE;
3159  fMaxPtPIDITS = 1.5;
3160  break;
3161  case 5: // -5,5
3162  fUseITSpid = kTRUE;
3165  fMaxPtPIDITS = 1.5;
3166  break;
3167  case 6: // -3,3
3168  fUseITSpid = kTRUE;
3171  fMaxPtPIDITS = 2;
3172  break;
3173  case 7: // -2,2
3174  fUseITSpid = kTRUE;
3177  fMaxPtPIDITS = 2;
3178  break;
3179  case 8: // -1,1
3180  fUseITSpid = kTRUE;
3183  fMaxPtPIDITS = 2;
3184  break;
3185  case 9: // -3,5
3186  fUseITSpid = kTRUE;
3189  fMaxPtPIDITS = 2;
3190  break;
3191  default:
3192  AliError(Form("ITSelectronPID not defined %d",ITSelectronPID));
3193  return kFALSE;
3194  }
3195  return kTRUE;
3196 }
3197 
3200  // Set Cut
3201  switch(TRDelectronPID){
3202  case 0: // no cut
3203  fDoTRDPID = kFALSE;
3204  fTRDPIDBelowCut=-100;
3205  fTRDPIDAboveCut=100;
3206  break;
3207  default:
3208  AliError(Form("TRDelectronPID not defined %d",TRDelectronPID));
3209  return kFALSE;
3210  }
3211  return kTRUE;
3212 }
3213 
3214 
3217  switch(QtMaxCut){
3218  case 0: //
3219  fQtMax=1.;
3220  fDoQtGammaSelection=kFALSE;
3221  fDo2DQt=kFALSE;
3222  break;
3223  case 1:
3224  fQtMax=0.1;
3225  fDo2DQt=kFALSE;
3226  break;
3227  case 2:
3228  fQtMax=0.06;
3229  fDo2DQt=kTRUE;
3230  break;
3231  case 3:
3232  fQtMax=0.05;
3233  fDo2DQt=kFALSE;
3234  break;
3235  case 4:
3236  fQtMax=0.03;
3237  fDo2DQt=kFALSE;
3238  break;
3239  case 5:
3240  fQtMax=0.02;
3241  fDo2DQt=kFALSE;
3242  break;
3243  case 6:
3244  fQtMax=0.02;
3245  fDo2DQt=kTRUE;
3246  break;
3247  case 7:
3248  fQtMax=0.15;
3249  fDo2DQt=kFALSE;
3250  break;
3251  case 8:
3252  fQtMax=0.05;
3253  fDo2DQt=kTRUE;
3254  break;
3255  case 9:
3256  fQtMax=0.03;
3257  fDo2DQt=kTRUE;
3258  break;
3259  default:
3260  AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
3261  return kFALSE;
3262  }
3263  return kTRUE;
3264 }
3265 
3268 
3269  switch(chi2GammaCut){
3270  case 0: // 100
3271  fChi2CutConversion = 100.;
3272  break;
3273  case 1: // 50
3274  fChi2CutConversion = 50.;
3275  break;
3276  case 2: // 30
3277  fChi2CutConversion = 30.;
3278  break;
3279  case 3:
3280  fChi2CutConversion = 200.;
3281  break;
3282  case 4:
3283  if (fIsHeavyIon==1){
3284  fChi2CutConversion = 7.;
3285  } else {
3286  fChi2CutConversion = 500.;
3287  }
3288  break;
3289  case 5:
3290  fChi2CutConversion = 100000.;
3291  break;
3292  case 6:
3293  fChi2CutConversion = 5.;
3294  break;
3295  case 7:
3296  fChi2CutConversion = 10.;
3297  break;
3298  case 8:
3299  fChi2CutConversion = 20.;
3300  break;
3301  case 9:
3302  fChi2CutConversion = 15.;
3303  break;
3304  case 10:
3305  fChi2CutConversion = 25.;
3306  break;
3307  case 11:
3308  fChi2CutConversion = 35.;
3309  break;
3310  case 12:
3311  fChi2CutConversion = 40.;
3312  break;
3313  case 13:
3314  fChi2CutConversion = 45.;
3315  break;
3316  case 14:
3317  fChi2CutConversion = 55.;
3318  break;
3319  default:
3320  AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
3321  return kFALSE;
3322  }
3323  return kTRUE;
3324 }
3325 
3328  switch(psiCut) {
3329  case 0:
3330  fPsiPairCut = 10000; //
3331  break;
3332  case 1:
3333  fPsiPairCut = 0.1; //
3334  break;
3335  case 2:
3336  fPsiPairCut = 0.05; // Standard
3337  break;
3338  case 3:
3339  fPsiPairCut = 0.035; //
3340  break;
3341  case 4:
3342  fPsiPairCut = 0.2; //
3343  break;
3344  case 5:
3345  fPsiPairCut = 0.1; //
3346  fDo2DPsiPairChi2 = kTRUE;
3347  break;
3348  case 6:
3349  fPsiPairCut = 0.05; //
3350  fDo2DPsiPairChi2 = kTRUE;
3351  break;
3352  case 7:
3353  if (fIsHeavyIon==1){
3354  fPsiPairCut = 0.07; //
3355  } else {
3356  fPsiPairCut = 0.035; //
3357  }
3358  fDo2DPsiPairChi2 = kTRUE;
3359  break;
3360  case 8:
3361  fPsiPairCut = 0.2; //
3362  fDo2DPsiPairChi2 = kTRUE; //
3363  break;
3364  case 9:
3365  // if (fIsHeavyIon==1){ //AM 2016-05-13
3366  fPsiPairCut = 0.1; //
3367  fDo2DPsiPairChi2 = kTRUE;
3368  fIncludeRejectedPsiPair = kTRUE;
3369  break;
3370 
3371  case 10:
3372  fPsiPairCut = 0.25; //
3373  fDo2DPsiPairChi2 = kTRUE; //
3374  break;
3375 
3376  case 11:
3377  fPsiPairCut = 0.3; //
3378  fDo2DPsiPairChi2 = kTRUE; //
3379  break;
3380 
3381  case 12:
3382  fPsiPairCut = 0.15; //
3383  fDo2DPsiPairChi2 = kTRUE; //
3384  break;
3385 
3386 
3387  // } else {
3388  // fPsiPairCut = 0.5; //
3389  // break;
3390  // }
3391  default:
3392  AliError(Form("PsiPairCut not defined %d",psiCut));
3393  return kFALSE;
3394  }
3395 
3396  return kTRUE;
3397 }
3398 
3401  // Set Cut
3402  switch(doPhotonAsymmetryCut){
3403  case 0:
3407  break;
3408  case 1:
3411  fMinPhotonAsymmetry=0.04;
3412  break;
3413  case 2:
3416  fMinPhotonAsymmetry=0.06;
3417  break;
3418  case 3:
3421  fMinPhotonAsymmetry=0.05;
3422  break;
3423  case 4:
3426  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3427  fFAsymmetryCut->SetParameter(0,0.3);
3428  fFAsymmetryCut->SetParameter(1,0.66);
3429  fFAsymmetryCut->SetParameter(2,0.7);
3432  break;
3433  case 5:
3436  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3437  fFAsymmetryCut->SetParameter(0,0.14);
3438  fFAsymmetryCut->SetParameter(1,0.66);
3439  fFAsymmetryCut->SetParameter(2,0.5);
3442  break;
3443  case 6:
3446  fMinPhotonAsymmetry=0.05;
3447  break;
3448  case 7:
3451  fMinPhotonAsymmetry=0.05;
3452  break;
3453  case 8:
3456  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3457  fFAsymmetryCut->SetParameter(0,0.5);
3458  fFAsymmetryCut->SetParameter(1,0.46);
3459  fFAsymmetryCut->SetParameter(2,0.7);
3462  break;
3463  default:
3464  AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
3465  return kFALSE;
3466  }
3467  fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
3468  return kTRUE;
3469 }
3470 
3473 
3474  switch(cosCut){
3475  case 0:
3476  fCosPAngleCut = -1;
3477  break;
3478  case 1:
3479  fCosPAngleCut = 0;
3480  break;
3481  case 2:
3482  fCosPAngleCut = 0.5;
3483  break;
3484  case 3:
3485  fCosPAngleCut = 0.75;
3486  break;
3487  case 4:
3488  fCosPAngleCut = 0.85;
3489  break;
3490  case 5:
3491  fCosPAngleCut = 0.88;
3492  break;
3493  case 6:
3494  fCosPAngleCut = 0.9;
3495  break;
3496  case 7:
3497  fCosPAngleCut = 0.95;
3498  break;
3499  case 8:
3500  fCosPAngleCut = 0.98;
3501  break;
3502  case 9:
3503  fCosPAngleCut = 0.99;
3504  break;
3505  case 10://a
3506  fCosPAngleCut = 0.995;
3507  break;
3508  case 11://b
3509  fCosPAngleCut = 0.985;
3510  break;
3511  case 12://c
3512  fCosPAngleCut = 0.996;
3513  break;
3514  case 13://d
3515  fCosPAngleCut = 0.997;
3516  break;
3517  case 14://e
3518  fCosPAngleCut = 0.998;
3519  break;
3520  case 15://f
3521  fCosPAngleCut = 0.999;
3522  break;
3523  default:
3524  AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
3525  return kFALSE;
3526  }
3527 
3528  return kTRUE;
3529 }
3530 
3533 
3534  switch(sharedElec){
3535  case 0:
3536  fDoSharedElecCut = kFALSE;
3539  fPhotonQualityCut = 0;
3540  break;
3541  case 1:
3542  fDoSharedElecCut = kTRUE;
3545  fPhotonQualityCut = 0;
3546  break;
3547  case 2:
3548  fDoSharedElecCut = kFALSE;
3551  fPhotonQualityCut = 1;
3552  break;
3553  case 3:
3554  fDoSharedElecCut = kFALSE;
3557  fPhotonQualityCut = 2;
3558  break;
3559  case 4:
3560  fDoSharedElecCut = kFALSE;
3563  fPhotonQualityCut = 3;
3564  break;
3565  case 5://Cat1 rejection
3566  fDoSharedElecCut = kFALSE;
3569  fPhotonQualityCut = 1;
3570  break;
3571  default:
3572  AliError(Form("Shared Electron Cut not defined %d",sharedElec));
3573  return kFALSE;
3574  }
3575 
3576  return kTRUE;
3577 }
3578 
3581 
3582  switch(toClose){
3583  case 0:
3584  fDoToCloseV0sCut = kFALSE;
3585  fminV0Dist = 250;
3586  break;
3587  case 1:
3588  fDoToCloseV0sCut = kTRUE;
3589  fminV0Dist = 1;
3590  break;
3591  case 2:
3592  fDoToCloseV0sCut = kTRUE;
3593  fminV0Dist = 2;
3594  break;
3595  case 3:
3596  fDoToCloseV0sCut = kTRUE;
3597  fminV0Dist = 3;
3598  break;
3599  case 4:
3600  fDoToCloseV0sCut = kTRUE;
3601  fDoDoubleCountingCut = kTRUE;
3602  fMinRDC=0.;
3603  fDeltaR=6.;
3604  fOpenAngle=0.02;
3605  break;
3606  case 5:
3607  fDoToCloseV0sCut = kTRUE;
3608  fDoDoubleCountingCut = kTRUE;
3609  fMinRDC=0.;
3610  fDeltaR=6.;
3611  fOpenAngle=0.03;
3612  break;
3613  case 6:
3614  fDoToCloseV0sCut = kTRUE;
3615  fDoDoubleCountingCut = kTRUE;
3616  fMinRDC=0.;
3617  fDeltaR=6.;
3618  fOpenAngle=0.04;
3619  break;
3620 
3621  default:
3622  AliError(Form("Shared Electron Cut not defined %d",toClose));
3623  return kFALSE;
3624  }
3625  return kTRUE;
3626 }
3627 
3630  switch(TRDElectronCut){
3631  case 0:
3632  fDoTRDPID=kFALSE;
3633  break;
3634  case 1:
3635  fDoTRDPID=kTRUE;
3636  fPIDTRDEfficiency=0.1;
3637  break;
3638  case 8:
3639  fDoTRDPID=kTRUE;
3640  fPIDTRDEfficiency=0.8;
3641  break;
3642  case 9:
3643  fDoTRDPID=kTRUE;
3644  fPIDTRDEfficiency=0.9;
3645  break;
3646  default:
3647  AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
3648  return kFALSE;
3649  }
3650 
3651  return kTRUE;
3652 }
3653 
3656  // Set Cut
3657  switch(DCAZPhotonPrimVtx){
3658  case 0: //
3659  fDCAZPrimVtxCut = 1000;
3660  break;
3661  case 1: //
3662  fDCAZPrimVtxCut = 10;
3663  break;
3664  case 2: //
3665  fDCAZPrimVtxCut = 5;
3666  break;
3667  case 3: //
3668  fDCAZPrimVtxCut = 4;
3669  break;
3670  case 4: //
3671  fDCAZPrimVtxCut = 3;
3672  break;
3673  case 5: //
3674  fDCAZPrimVtxCut = 2.5;
3675  break;
3676  case 6: //
3677  fDCAZPrimVtxCut = 2;
3678  break;
3679  case 7: //
3680  fDCAZPrimVtxCut = 1.5;
3681  break;
3682  case 8: //
3683  fDCAZPrimVtxCut = 1;
3684  break;
3685  case 9: //
3686  fDCAZPrimVtxCut = 0.5;
3687  break;
3688  default:
3689  cout<<"Warning: DCAZPhotonPrimVtx not defined "<<DCAZPhotonPrimVtx<<endl;
3690  return kFALSE;
3691  }
3692  return kTRUE;
3693 }
3694 
3697  // Set Cut
3698  switch(DCARPhotonPrimVtx){
3699  case 0: //
3700  fDCARPrimVtxCut = 1000;
3701  break;
3702  case 1: //
3703  fDCARPrimVtxCut = 10;
3704  break;
3705  case 2: //
3706  fDCARPrimVtxCut = 5;
3707  break;
3708  case 3: //
3709  fDCARPrimVtxCut = 4;
3710  break;
3711  case 4: //
3712  fDCARPrimVtxCut = 3;
3713  break;
3714  case 5: //
3715  fDCARPrimVtxCut = 2.5;
3716  break;
3717  case 6: //
3718  fDCARPrimVtxCut = 2;
3719  break;
3720  case 7: //
3721  fDCARPrimVtxCut = 1.5;
3722  break;
3723  case 8: //
3724  fDCARPrimVtxCut = 1;
3725  break;
3726  case 9: //
3727  fDCARPrimVtxCut = 0.5;
3728  break;
3729  default:
3730  cout<<"Warning: DCARPhotonPrimVtx not defined "<<DCARPhotonPrimVtx<<endl;
3731  return kFALSE;
3732  }
3733  return kTRUE;
3734 }
3735 
3738  // Set Cut
3739  switch(inOutPlane){
3740  case 0: //
3741  fInPlaneOutOfPlane = 0; // No Event Plane
3742  break;
3743  case 1: //
3744  fInPlaneOutOfPlane = 1; // In-Plane
3745  break;
3746  case 2: //
3747  fInPlaneOutOfPlane = 2; // Out-Of-Plane
3748  break;
3749  default:
3750  cout<<"Warning: In-Plane or Out-Of-Plane not defined "<<inOutPlane<<endl;
3751  return kFALSE;
3752  }
3753  return kTRUE;
3754 }
3755 
3756 
3759  // Get first TPC row
3760  Int_t firstTPCRow = 0;
3761  Double_t radiusI = 84.8;
3762  Double_t radiusO = 134.6;
3763  Double_t radiusOB = 198.;
3764  Double_t rSizeI = 0.75;
3765  Double_t rSizeO = 1.;
3766  Double_t rSizeOB = 1.5;
3767  Int_t nClsI = 63;
3768  Int_t nClsIO = 127;
3769 
3770  if(radius <= radiusI){
3771  return firstTPCRow;
3772  }
3773  if(radius>radiusI && radius<=radiusO){
3774  firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
3775  }
3776  if(radius>radiusO && radius<=radiusOB){
3777  firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
3778  }
3779 
3780  if(radius>radiusOB){
3781  firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
3782  }
3783 
3784  return firstTPCRow;
3785 }
3786 
3790  if(GetCosineOfPointingAngle(photon, event) < fCosPAngleCut){
3791  return kFALSE;
3792  }
3793  return kTRUE;
3794 }
3795 
3798  // calculates the pointing angle of the recalculated V0
3799 
3800  Double_t momV0[3] = {0,0,0};
3801  if(event->IsA()==AliESDEvent::Class()){
3802  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
3803  if(!esdEvent) return -999;
3804  AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
3805  if(!v0) return -999;
3806  v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
3807  }
3808  if(event->IsA()==AliAODEvent::Class()){
3809  momV0[0] = photon->GetPx();
3810  momV0[1] = photon->GetPy();
3811  momV0[2] = photon->GetPz();
3812  }
3813 
3814  //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
3815  Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
3816  photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
3817  photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
3818 
3819  Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
3820  Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
3821 
3822 
3823  Double_t cosinePointingAngle = -999;
3824  if(momV02*PosV02 > 0.0)
3825  cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
3826 
3827  return cosinePointingAngle;
3828 }
3829 
3832 
3833  if (fDo2DPsiPairChi2){
3835  if (TMath::Abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut || (photon->GetPsiPair()) == 4){
3836  return kTRUE;
3837  } else {
3838  return kFALSE;
3839  }
3840 
3841  } else {
3842  if (TMath::Abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut ){
3843  return kTRUE;
3844  } else {
3845  return kFALSE;
3846  }
3847  }
3848  } else {
3850  if(TMath::Abs(photon->GetPsiPair()) > fPsiPairCut || (photon->GetPsiPair()) != 4){
3851  return kFALSE;
3852  } else {
3853  return kTRUE;
3854  }
3855  } else {
3856  if(TMath::Abs(photon->GetPsiPair()) > fPsiPairCut){
3857  return kFALSE;
3858  } else {
3859  return kTRUE;
3860  }
3861  }
3862  }
3863 }
3864 
3867  // returns TString with current cut number
3868  return fCutStringRead;
3869 }
3870 
3873 
3874  Int_t posLabel = photon->GetTrackLabelPositive();
3875  Int_t negLabel = photon->GetTrackLabelNegative();
3876 
3877  fElectronLabelArray[nV0*2] = posLabel;
3878  fElectronLabelArray[(nV0*2)+1] = negLabel;
3879 }
3880 
3883 
3884  Int_t posLabel = photon->GetTrackLabelPositive();
3885  Int_t negLabel = photon->GetTrackLabelNegative();
3886 
3887  for(Int_t i = 0; i<nV0s*2;i++){
3888  if(i==nV0*2) continue;
3889  if(i==(nV0*2)+1) continue;
3890  if(fElectronLabelArray[i] == posLabel){
3891  return kFALSE;}
3892  if(fElectronLabelArray[i] == negLabel){
3893  return kFALSE;}
3894  }
3895 
3896  return kTRUE;
3897 }
3898 
3901 
3902  if (fDoDoubleCountingCut && photon->GetConversionRadius() < fMinRDC) return kTRUE;
3903 
3904  Double_t posX = photon->GetConversionX();
3905  Double_t posY = photon->GetConversionY();
3906  Double_t posZ = photon->GetConversionZ();
3907 
3908  for(Int_t i = 0;i<photons->GetEntries();i++){
3909  if(nV0 == i) continue;
3910  AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
3911  Double_t posCompX = photonComp->GetConversionX();
3912  Double_t posCompY = photonComp->GetConversionY();
3913  Double_t posCompZ = photonComp->GetConversionZ();
3914 
3915  if (!fDoDoubleCountingCut){
3916  Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
3917 
3918  if(dist < fminV0Dist*fminV0Dist){
3919  if(photon->GetChi2perNDF() > photonComp->GetChi2perNDF()) return kFALSE;
3920  }
3921  }else{
3922  TVector3 v1(photon->Px(),photon->Py(),photon->Pz());
3923  TVector3 v2(photonComp->Px(),photonComp->Py(),photonComp->Pz());
3924  Double_t OpeningAngle=v1.Angle(v2);
3925  if( OpeningAngle < fOpenAngle && TMath::Abs(photon->GetConversionRadius()-photonComp->GetConversionRadius()) < fDeltaR){
3926  if(photon->GetChi2perNDF() > photonComp->GetChi2perNDF()) return kFALSE;
3927  }
3928  }
3929 
3930  }
3931  return kTRUE;
3932 }
3933 
3934 
3937  //Create and return standard 2010 PbPb cuts
3938  AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
3939  if(!cuts->InitializeCutsFromCutString("04209297002322000000")){
3940  cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
3941  return cuts;
3942 }
3943 
3946  //Create and return standard 2010 PbPb cuts
3947  AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010pp","StandardCuts2010pp");
3948  if(!cuts->InitializeCutsFromCutString("00209366300380000000")){
3949  cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
3950  return cuts;
3951 }
3952 
3955 
3956  //GetPhotonPhi() 0-2 Pi //eventPlaneAngle -1pi-1pi
3957  eventPlaneAngle=eventPlaneAngle+TMath::Pi();
3958  Double_t gammaToEPAngle = eventPlaneAngle-photonPhi;
3959  if(gammaToEPAngle < 0) gammaToEPAngle=gammaToEPAngle+2*TMath::Pi();
3960  gammaToEPAngle = gammaToEPAngle-TMath::Pi(); // angle from -pi +pi
3961 
3962  if(!fInPlaneOutOfPlane){
3963  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3964  return kTRUE;
3965  }
3966  else if(fInPlaneOutOfPlane == 1){
3967  if(TMath::Abs(gammaToEPAngle)<=0.25*TMath::Pi() || TMath::Abs(gammaToEPAngle)>=0.75*TMath::Pi()){
3968  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3969  return kTRUE;
3970  }
3971  else return kFALSE;
3972  }
3973  else if(fInPlaneOutOfPlane == 2){
3974  if(TMath::Abs(gammaToEPAngle)>0.25*TMath::Pi() && TMath::Abs(gammaToEPAngle)<0.75*TMath::Pi()){
3975  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3976  return kTRUE;
3977  }
3978  else return kFALSE;
3979  }
3980  return kFALSE;
3981 }
3982 
3985 
3986  AliAODTrack * negTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelNegative()));
3987  AliAODTrack * posTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelPositive()));
3988 
3989  if(!negTrack || !posTrack) {
3990  return 0;
3991  }
3992  if(negTrack->Charge() == posTrack->Charge()){
3993  return 0;
3994  }
3995  Int_t nClusterITSneg = negTrack->GetITSNcls();
3996  Int_t nClusterITSpos = posTrack->GetITSNcls();
3997  // cout << nClusterITSneg << "\t" << nClusterITSpos <<endl;
3998 
3999  if (nClusterITSneg > 1 && nClusterITSpos > 1){
4000  return 3;
4001  } else if (nClusterITSneg > 1 || nClusterITSpos > 1){
4002  return 2;
4003  } else {
4004  return 1;
4005  }
4006  return 0;
4007 }
4008 
4011 
4012  TString nameProfile;
4013  if (flag==1){
4014  nameProfile = "profileContainingMaterialBudgetWeights_fewRadialBins";}
4015  else if (flag==2){
4016  nameProfile = "profileContainingMaterialBudgetWeights_manyRadialBins";}
4017  else {
4018  AliError(Form("%d not a valid flag for InitMaterialBudgetWeightingOfPi0Candidates()",flag));
4019  return kFALSE;
4020  }
4021  TFile* file = TFile::Open(filename.Data());
4022  if (!file) {
4023  AliError(Form("File %s for materialbudgetweights not found",filename.Data()));
4024  return kFALSE;
4025  }
4026  fProfileContainingMaterialBudgetWeights = (TProfile*)file->Get(nameProfile.Data());
4028  AliError(Form("Histogram %s not found in file",nameProfile.Data()));
4029  return kFALSE;
4030  }
4031  fProfileContainingMaterialBudgetWeights->SetDirectory(0);
4032  file->Close();
4033  delete file;
4034 
4036  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()));
4037  return kTRUE;
4038 }
4039 
4042 
4043  Float_t weight = 1.0;
4044  Float_t gammaConversionRadius = gamma->GetConversionRadius();
4045  Int_t bin = fProfileContainingMaterialBudgetWeights->FindBin(gammaConversionRadius);
4046  if (bin > 0 && bin <= fProfileContainingMaterialBudgetWeights->GetNbinsX()){
4047  weight = fProfileContainingMaterialBudgetWeights->GetBinContent(bin);
4048  }
4049  return weight;
4050 }
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