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