AliPhysics  df4bbdf (df4bbdf)
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());
1678  if(fHistoTPCdEdxSigafter)fHistoTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1679  if(fHistoTPCdEdxafter)fHistoTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1680 
1681  return kTRUE;
1682 }
1683 
1686  // abort if Kappa selection not enabled
1687  if (!fSwitchToKappa) return kTRUE;
1688 
1689  Float_t kappa = GetKappaTPC(photon, event);
1690  if (kappa < fKappaMinCut) return kFALSE;
1691  if (kappa > fKappaMaxCut) return kFALSE;
1692  return kTRUE;
1693 }
1694 
1697  // Cut on Energy Asymmetry
1698 
1699  for(Int_t ii=0;ii<2;ii++){
1700 
1701  AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1702 
1704  Double_t trackNegAsy=0;
1705  if (photon->GetPhotonP()!=0.){
1706  trackNegAsy= track->P()/photon->GetPhotonP();
1707  }
1708 
1709  if( trackNegAsy > fFAsymmetryCut->Eval(photon->GetPhotonP()) || trackNegAsy < 1.-fFAsymmetryCut->Eval(photon->GetPhotonP()) ){
1710  return kFALSE;
1711  }
1712 
1713  } else {
1714  if( track->P() > fMinPPhotonAsymmetryCut ){
1715  Double_t trackNegAsy=0;
1716  if (photon->GetPhotonP()!=0.){
1717  trackNegAsy= track->P()/photon->GetPhotonP();
1718  }
1719 
1720  if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1721  return kFALSE;
1722  }
1723  }
1724  }
1725 
1726  }
1727  return kTRUE;
1728 }
1729 
1731 AliVTrack *AliConversionPhotonCuts::GetTrack(AliVEvent * event, Int_t label){
1732  //Returns pointer to the track with given ESD label
1733  //(Important for AOD implementation, since Track array in AOD data is different
1734  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1735 
1736  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1737  if(esdEvent) {
1738  if(label > event->GetNumberOfTracks() ) return NULL;
1739  AliESDtrack * track = esdEvent->GetTrack(label);
1740  return track;
1741 
1742  } else {
1743  if(label == -999999) return NULL; // if AOD relabelling goes wrong, immediately return NULL
1744  AliVTrack * track = 0x0;
1745  if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->AreAODsRelabeled()){
1746  if(event->GetTrack(label)) track = dynamic_cast<AliVTrack*>(event->GetTrack(label));
1747  return track;
1748  }
1749  else{
1750  for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1751  if(event->GetTrack(ii)) track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1752  if(track){
1753  if(track->GetID() == label) {
1754  return track;
1755  }
1756  }
1757  }
1758  }
1759  }
1760  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1761  return NULL;
1762 }
1763 
1766  //Returns pointer to the track with given ESD label
1767  //(Important for AOD implementation, since Track array in AOD data is different
1768  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1769 
1770  if(event) {
1771  if(label > event->GetNumberOfTracks() ) return NULL;
1772  AliESDtrack * track = event->GetTrack(label);
1773  return track;
1774  }
1775  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1776  return NULL;
1777 }
1778 
1779 
1780 
1783  // Cut on Electron Probability for Photon Reconstruction
1784 
1785  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1786 
1787  if(esdEvent){
1788 
1789  Bool_t iResult=kFALSE;
1790 
1791  Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1792  Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1793 
1794  AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1795  AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1796 
1797  if(negProbArray && posProbArray){
1798 
1799  negTrack->GetTPCpid(negProbArray);
1800  posTrack->GetTPCpid(posProbArray);
1801 
1802  if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1803  iResult=kTRUE;
1804  }
1805  }
1806 
1807  delete [] posProbArray;
1808  delete [] negProbArray;
1809  return iResult;
1810 
1811  } else {
1813  return kTRUE;
1814  }
1815 }
1816 
1817 
1819 Bool_t AliConversionPhotonCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1820  // MC Acceptance Cuts
1821  //(Certain areas were excluded for photon reconstruction)
1822 
1823  if(particle->R()>fMaxR){
1824  return kFALSE;}
1825 
1826  if(ePos->R()>fMaxR){
1827  return kFALSE;
1828  }
1829 
1830  if(ePos->R()<fMinR){
1831  return kFALSE;
1832  }
1833 
1834  if( ePos->R() <= ((TMath::Abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1835  return kFALSE;
1836  }
1837  else if (fUseEtaMinCut && ePos->R() >= ((TMath::Abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1838  return kFALSE;
1839  }
1840 
1841  if(TMath::Abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1842  return kFALSE;
1843  }
1844 
1845  if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1846  return kFALSE;
1847  }
1848 
1849  if(TMath::Abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1850  return kFALSE;
1851  }
1852 
1853 
1854  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) ){
1855  return kFALSE;
1856  }
1857  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ){
1858  return kFALSE;
1859  }
1860  if( eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) ){
1861  return kFALSE;
1862  }
1863  if(fEtaCutMin>-0.1){
1864  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) ){
1865  return kFALSE;
1866  }
1867  if( ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin) ){
1868  return kFALSE;
1869  }
1870  if( eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin) ){
1871  return kFALSE;
1872  }
1873  }
1874 
1875  if(fDoAsymPtCut){
1876  if((ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut2) && (ePos->Pt()<fSinglePtCut2 || eNeg->Pt()<fSinglePtCut) ){
1877  return kFALSE;
1878  }
1879  } else {
1880  if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
1881  return kFALSE;
1882  }
1883  }
1884 
1885  if(particle->Pt()<fPtCut){
1886  return kFALSE;
1887  }
1888 
1889  return kTRUE;
1890 }
1894 
1895  if(fCutString && fCutString->GetString().Length() == kNCuts) {
1896  fCutString->SetString(GetCutNumber());
1897  } else {
1898  return kFALSE;
1899  }
1900  return kTRUE;
1901 }
1902 
1903 
1906  fCutStringRead = Form("%s",analysisCutSelection.Data());
1907 
1908  // Initialize Cuts from a given Cut string
1909  AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1910  if(analysisCutSelection.Length()!=kNCuts) {
1911  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1912  return kFALSE;
1913  }
1914  if(!analysisCutSelection.IsAlnum()){
1915  AliError("Cut selection is not alphanumeric");
1916  return kFALSE;
1917  }
1918 
1919  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
1920  analysisCutSelectionLowerCase.ToLower();
1921  const char *cutSelection = analysisCutSelectionLowerCase.Data();
1922  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
1923  for(Int_t ii=0;ii<kNCuts;ii++){
1924  ASSIGNARRAY(ii);
1925  }
1926 
1927  // Set Individual Cuts
1928  for(Int_t ii=0;ii<kNCuts;ii++){
1929  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1930  }
1931 
1933 
1934  return kTRUE;
1935 }
1939 
1940  switch (cutID) {
1941 
1942  case kv0FinderType:
1943  if( SetV0Finder(value)) {
1944  fCuts[kv0FinderType] = value;
1945  UpdateCutString();
1946  return kTRUE;
1947  } else return kFALSE;
1948 
1949  case ketaCut:
1950  if( SetEtaCut(value)) {
1951  fCuts[ketaCut] = value;
1952  UpdateCutString();
1953  return kTRUE;
1954  } else return kFALSE;
1955 
1956  case kRCut:
1957  if( SetRCut(value)) {
1958  fCuts[kRCut] = value;
1959  UpdateCutString();
1960  return kTRUE;
1961  } else return kFALSE;
1962 
1963  case kEtaForPhiSector:
1964  if( SetEtaForPhiCut(value)) {
1965  fCuts[kEtaForPhiSector] = value;
1966  UpdateCutString();
1967  return kTRUE;
1968  } else return kFALSE;
1969  case kMinPhiSector:
1970  if( SetMinPhiSectorCut(value)) {
1971  fCuts[kMinPhiSector] = value;
1972  UpdateCutString();
1973  return kTRUE;
1974  } else return kFALSE;
1975  case kMaxPhiSector:
1976  if( SetMaxPhiSectorCut(value)) {
1977  fCuts[kMaxPhiSector] = value;
1978  UpdateCutString();
1979  return kTRUE;
1980  } else return kFALSE;
1981 
1982  case ksinglePtCut:
1983  if( SetSinglePtCut(value)) {
1984  fCuts[ksinglePtCut] = value;
1985  UpdateCutString();
1986  return kTRUE;
1987  } else return kFALSE;
1988 
1989  case kclsTPCCut:
1990  if( SetTPCClusterCut(value)) {
1991  fCuts[kclsTPCCut] = value;
1992  UpdateCutString();
1993  return kTRUE;
1994  } else return kFALSE;
1995 
1996  case kededxSigmaCut:
1997  if (!fSwitchToKappa){
1998  if( SetTPCdEdxCutElectronLine(value)) {
1999  fCuts[kededxSigmaCut] = value;
2000  UpdateCutString();
2001  return kTRUE;
2002  } else return kFALSE;
2003  } else {
2004  if( SetKappaTPCCut(value)) {
2005  fCuts[kededxSigmaCut] = value;
2006  UpdateCutString();
2007  return kTRUE;
2008  } else return kFALSE;
2009  }
2010  case kpidedxSigmaCut:
2011  if (!fSwitchToKappa){
2012  if( SetTPCdEdxCutPionLine(value)) {
2013  fCuts[kpidedxSigmaCut] = value;
2014  UpdateCutString();
2015  return kTRUE;
2016  } else return kFALSE;
2017  } else {
2018  fCuts[kpidedxSigmaCut] = 0;
2019  return kTRUE;
2020  }
2021  case kpiMomdedxSigmaCut:
2022  if (!fSwitchToKappa){
2023  if( SetMinMomPiondEdxCut(value)) {
2024  fCuts[kpiMomdedxSigmaCut] = value;
2025  UpdateCutString();
2026  return kTRUE;
2027  } else return kFALSE;
2028  } else {
2030  return kTRUE;
2031  }
2032  case kpiMaxMomdedxSigmaCut:
2033  if (!fSwitchToKappa){
2034  if( SetMaxMomPiondEdxCut(value)) {
2035  fCuts[kpiMaxMomdedxSigmaCut] = value;
2036  UpdateCutString();
2037  return kTRUE;
2038  } else return kFALSE;
2039  } else {
2041  return kTRUE;
2042  }
2044  if (!fSwitchToKappa){
2045  if( SetLowPRejectionCuts(value)) {
2046  fCuts[kLowPRejectionSigmaCut] = value;
2047  UpdateCutString();
2048  return kTRUE;
2049  } else return kFALSE;
2050  } else {
2052  return kTRUE;
2053  }
2054  case kTOFelectronPID:
2055  if( SetTOFElectronPIDCut(value)) {
2056  fCuts[kTOFelectronPID] = value;
2057  UpdateCutString();
2058  return kTRUE;
2059  } else return kFALSE;
2060 
2061  case kQtMaxCut:
2062  if( SetQtMaxCut(value)) {
2063  fCuts[kQtMaxCut] = value;
2064  UpdateCutString();
2065  return kTRUE;
2066  } else return kFALSE;
2067 
2068 
2069  case kchi2GammaCut:
2070  if( SetChi2GammaCut(value)) {
2071  fCuts[kchi2GammaCut] = value;
2072  UpdateCutString();
2073  return kTRUE;
2074  } else return kFALSE;
2075 
2076  case kPsiPair:
2077  if( SetPsiPairCut(value)) {
2078  fCuts[kPsiPair] = value;
2079  UpdateCutString();
2080  return kTRUE;
2081  } else return kFALSE;
2082 
2083  case kdoPhotonAsymmetryCut:
2084  if( SetPhotonAsymmetryCut(value)) {
2085  fCuts[kdoPhotonAsymmetryCut] = value;
2086  UpdateCutString();
2087  return kTRUE;
2088  } else return kFALSE;
2089 
2090  case kCosPAngle:
2091  if( SetCosPAngleCut(value)) {
2092  fCuts[kCosPAngle] = value;
2093  UpdateCutString();
2094  return kTRUE;
2095  } else return kFALSE;
2096 
2097  case kElecShare:
2098  if( SetSharedElectronCut(value)) {
2099  fCuts[kElecShare] = value;
2100  UpdateCutString();
2101  return kTRUE;
2102  } else return kFALSE;
2103 
2104  case kToCloseV0s:
2105  if( SetToCloseV0sCut(value)) {
2106  fCuts[kToCloseV0s] = value;
2107  UpdateCutString();
2108  return kTRUE;
2109  } else return kFALSE;
2110 
2111  case kDcaRPrimVtx:
2112  if( SetDCARPhotonPrimVtxCut(value)) {
2113  fCuts[kDcaRPrimVtx] = value;
2114  UpdateCutString();
2115  return kTRUE;
2116  } else return kFALSE;
2117 
2118  case kDcaZPrimVtx:
2119  if( SetDCAZPhotonPrimVtxCut(value)) {
2120  fCuts[kDcaZPrimVtx] = value;
2121  UpdateCutString();
2122  return kTRUE;
2123  } else return kFALSE;
2124 
2125  case kInPlaneOutOfPlane:
2126  if( SetInPlaneOutOfPlane(value)) {
2127  fCuts[kInPlaneOutOfPlane] = value;
2128  UpdateCutString();
2129  return kTRUE;
2130  } else return kFALSE;
2131 
2132  case kITSelectronPID:
2133  if( SetITSElectronPIDCut(value)) {
2134  fCuts[kITSelectronPID] = value;
2135  UpdateCutString();
2136  return kTRUE;
2137  } else return kFALSE;
2138 
2139  case kTRDelectronPID:
2140  if( SetTRDElectronPIDCut(value)) {
2141  fCuts[kTRDelectronPID] = value;
2142  UpdateCutString();
2143  return kTRUE;
2144  } else return kFALSE;
2145 
2146  case kNCuts:
2147  AliError("Cut id out of range");
2148  return kFALSE;
2149  }
2150 
2151  AliError("Cut id %d not recognized");
2152  return kFALSE;
2153 }
2156  // Print out current Cut Selection
2157  for(Int_t ic = 0; ic < kNCuts; ic++) {
2158  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
2159  }
2160 }
2161 
2163  // Print out current Cut Selection with value
2164  printf("\nConversion cutnumber \n");
2165  for(Int_t ic = 0; ic < kNCuts; ic++) {
2166  printf("%d",fCuts[ic]);
2167  }
2168  printf("\n\n");
2169  printf("Electron cuts & Secondary Track Cuts - only track from secondaries enter analysis: \n");
2170  printf("\t no like sign pairs from V0s \n");
2171  if (!fUseCorrectedTPCClsInfo) printf("\t # TPC clusters > %3.2f \n", fMinClsTPC);
2172  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{e} < %3.2f\n", fEtaCutMin, fEtaCut );
2173  else printf("\t eta_{e} < %3.2f\n", fEtaCut );
2174  printf("\t reject: %3.2f < phi < %3.2f with %3.2f < eta < %3.2f \n", fMinPhiCut, fMaxPhiCut, fEtaForPhiCutMin, fEtaForPhiCutMax);
2175  if(fDoAsymPtCut)
2176  printf("\t Asymmetric cut: p_{T,e1} > %3.2f and p_{T,e2} > %3.2f\n", fSinglePtCut, fSinglePtCut2 );
2177  else
2178  printf("\t p_{T,e} > %3.2f\n", fSinglePtCut );
2179  printf("\t TPC refit \n");
2180  printf("\t no kinks \n");
2181  if (!fSwitchToKappa){
2182  printf("\t accept: %3.2f < n sigma_{e,TPC} < %3.2f\n", fPIDnSigmaBelowElectronLine, fPIDnSigmaAboveElectronLine );
2183  printf("\t reject: %3.2f < p_{e,T} < %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMinPnSigmaAbovePionLine, fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLine );
2184  printf("\t reject: p_{e,T} > %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLineHighPt );
2185  if (fDoPionRejectionLowP) printf("\t reject: p_{e,T} < %3.2f, -%3.2f < n sigma_{pi,TPC} < %3.2f\n", fPIDMinPPionRejectionLowP, fPIDnSigmaAtLowPAroundPionLine, fPIDnSigmaAtLowPAroundPionLine );
2186  if (fDoKaonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{K,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundKaonLine, fPIDnSigmaAtLowPAroundKaonLine );
2187  if (fDoProtonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{p,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundProtonLine, fPIDnSigmaAtLowPAroundProtonLine );
2188  } else {
2189  printf("\t accept: %3.2f <= Kappa_{TPC} < %3.2f\n", fKappaMinCut, fKappaMaxCut );
2190  }
2191  if (fUseTOFpid) printf("\t accept: %3.2f < n sigma_{e,TOF} < %3.2f\n", fTofPIDnSigmaBelowElectronLine, fTofPIDnSigmaAboveElectronLine);
2192  if (fUseITSpid) printf("\t accept: %3.2f < n sigma_{e,ITS} < %3.2f\n -- up to pT %3.2f", fITSPIDnSigmaBelowElectronLine, fITSPIDnSigmaAboveElectronLine, fMaxPtPIDITS);
2193 
2194  printf("Photon cuts: \n");
2195  if (fUseOnFlyV0Finder) printf("\t using Onfly V0 finder \n");
2196  else printf("\t using Offline V0 finder \n");
2197  if (fDo2DQt){
2198  printf("\t 2 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2199  } else {
2200  printf("\t 1 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2201  }
2202  if (fDo2DPsiPairChi2){
2203  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 );
2204  } else {
2205  printf("\t chi^{2} max cut chi^{2} < %3.2f \n", fChi2CutConversion );
2206  printf("\t psi_{pair} max cut |psi_{pair}| < %3.2f \n", fPsiPairCut );
2207  }
2208  printf("\t %3.2f < R_{conv} < %3.2f\n", fMinR, fMaxR );
2209  printf("\t Z_{conv} < %3.2f\n", fMaxZ );
2210  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{conv} < %3.2f\n", fEtaCutMin, fEtaCut );
2211  else printf("\t eta_{conv} < %3.2f\n", fEtaCut );
2212  if (fDoPhotonAsymmetryCut) printf("\t for p_{T,track} > %3.2f, A_{gamma} < %3.2f \n", fMinPPhotonAsymmetryCut, fMinPhotonAsymmetry );
2213  if (fDoPhotonPDependentAsymCut && fDoPhotonAsymmetryCut) printf("\t p-dependent asymmetry cut \n");
2214  if (fUseCorrectedTPCClsInfo) printf("\t #cluster TPC/ #findable clusters TPC (corrected for radius) > %3.2f\n", fMinClsTPCToF );
2215  printf("\t p_{T,gamma} > %3.2f\n", fPtCut );
2216  printf("\t cos(Theta_{point}) > %3.2f \n", fCosPAngleCut );
2217  printf("\t dca_{R} < %3.2f \n", fDCARPrimVtxCut );
2218  printf("\t dca_{Z} < %3.2f \n", fDCAZPrimVtxCut );
2219  if (fDoPhotonQualitySelectionCut) printf("\t selection based on photon quality with quality %d \n", fPhotonQualityCut );
2220  if (fDoDoubleCountingCut) printf("\t Reject doubly counted photons with R > %3.2f, DeltaR < %3.2f, OpenAngle < %3.2f \n", fMinRDC, fDeltaR,fOpenAngle );
2221 
2222 }
2223 
2226  switch (v0FinderType){
2227  case 0: // on fly V0 finder
2228  cout << "have chosen onfly V0" << endl;
2229  fUseOnFlyV0Finder=kTRUE;
2231  break;
2232  case 1: // offline V0 finder
2233  cout << "have chosen offline V0" << endl;
2234  fUseOnFlyV0Finder=kFALSE;
2236  break;
2237  case 2: // on fly V0 finder with same signs
2238  cout << "have chosen onfly V0 same sign pairing" << endl;
2239  fUseOnFlyV0Finder=kTRUE;
2241  break;
2242  case 3: // on fly V0 finder with unlike signs and same signs
2243  cout << "have chosen onfly V0 unlike sign and same signs pairing" << endl;
2244  fUseOnFlyV0Finder=kTRUE;
2246  break;
2247  default:
2248  AliError(Form(" v0FinderType not defined %d",v0FinderType));
2249  return kFALSE;
2250  }
2251  return kTRUE;
2252 }
2253 
2256 
2257  //Set Standard LineCutZValues
2258  fLineCutZValueMin = -2;
2259  fLineCutZValue = 7.;
2260 
2261  switch(etaCut){
2262  case 0: // 0.9
2263  fEtaCut = 0.9;
2264  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2265  fEtaCutMin = -0.1;
2266  fLineCutZRSlopeMin = 0.;
2267  break;
2268  case 1: // 0.6 // changed from 1.2 to 0.6 on 2013.06.10
2269  fEtaCut = 0.6;
2270  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2271  fEtaCutMin = -0.1;
2272  fLineCutZRSlopeMin = 0.;
2273  break;
2274  case 2: // 1.4
2275  fEtaCut = 1.4;
2276  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2277  fEtaCutMin = -0.1;
2278  fLineCutZRSlopeMin = 0.;
2279  break;
2280  case 3: // 0.65
2281  fEtaCut = 0.65;
2282  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2283  fEtaCutMin = -0.1;
2284  fLineCutZRSlopeMin = 0.;
2285  break;
2286  case 4: // 0.75
2287  fEtaCut = 0.75;
2288  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2289  fEtaCutMin = -0.1;
2290  fLineCutZRSlopeMin = 0.;
2291  break;
2292  case 5: // 0.5
2293  fEtaCut = 0.5;
2294  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2295  fEtaCutMin = -0.1;
2296  fLineCutZRSlopeMin = 0.;
2297  break;
2298  case 6: // 5.
2299  fEtaCut = 5.;
2300  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2301  fEtaCutMin = -0.1;
2302  fLineCutZRSlopeMin = 0.;
2303  break;
2304  case 7:
2305  if (fIsHeavyIon==1){
2306  fEtaCut = 0.7;
2307  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2308  fEtaCutMin = -0.1;
2309  fLineCutZRSlopeMin = 0.;
2310  break;
2311  } else {
2312  fEtaCut = 0.3;
2313  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2314  fEtaCutMin = -0.1;
2315  fLineCutZRSlopeMin = 0.;
2316  break;
2317  }
2318  // case 8: // 0.1 - 0.8
2319  // fEtaCut = 0.9;
2320  // fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2321  // fEtaCutMin = 0.1;
2322  // fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2323  // break;
2324  case 8: // 0.4
2325  fEtaCut = 0.4;
2326  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2327  fEtaCutMin = -0.1;
2328  fLineCutZRSlopeMin = 0.;
2329  break;
2330  case 9: // 10
2331  fEtaCut = 10;
2332  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2333  fEtaCutMin = -0.1;
2334  fLineCutZRSlopeMin = 0.;
2335  break;
2336  case 10: // 0.2-0.9
2337  fEtaCut = 0.9;
2338  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2339  fEtaCutMin = 0.2;
2340  fLineCutZRSlopeMin = 0.;
2341  break;
2342  case 11: // 0.2-0.9
2343  fEtaCut = 0.9;
2344  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2345  fEtaCutMin = 0.2;
2346  fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2347  break;
2348  case 12: // 0.85
2349  fEtaCut = 0.85;
2350  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2351  fEtaCutMin = -0.1;
2352  fLineCutZRSlopeMin = 0.;
2353  break;
2354  case 13: // 0.8
2355  fEtaCut = 0.8;
2356  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2357  fEtaCutMin = -0.1;
2358  fLineCutZRSlopeMin = 0.;
2359  break;
2360  default:
2361  AliError(Form(" EtaCut not defined %d",etaCut));
2362  return kFALSE;
2363  }
2364  return kTRUE;
2365 }
2366 
2369  // Set Cut
2370  switch(RCut){
2371  case 0:
2372  fMinR=0;
2373  fMaxR = 180.;
2374  break;
2375  case 1:
2376  fMinR=2.8;
2377  fMaxR = 180.;
2378  break;
2379  case 2:
2380  fMinR=5.;
2381  fMaxR = 180.;
2382  break;
2383  case 3:
2384  fMaxR = 70.;
2385  fMinR = 10.;
2386  break;
2387  case 4:
2388  fMaxR = 70.;
2389  fMinR = 5.;
2390  break;
2391  case 5:
2392  fMaxR = 180.;
2393  fMinR = 10.;
2394  break;
2395  case 6:
2396  fMaxR = 180.;
2397  fMinR = 20.;
2398  break;
2399  case 7:
2400  fMaxR = 180.;
2401  fMinR = 35.; //old 26.
2402  break;
2403  case 8:
2404  fMaxR = 180.;
2405  fMinR = 12.5;
2406  break;
2407  case 9:
2408  fMaxR = 180.;
2409  fMinR = 7.5;
2410  break;
2411  case 10:
2412  fMaxR = 33.5;
2413  fMinR = 5.;
2414  break;
2415  case 11:
2416  fMaxR = 72.;
2417  fMinR = 33.5;
2418  break;
2419  case 12:
2420  fMaxR = 180.;
2421  fMinR = 72.;
2422  break;
2423  case 13:
2424  fMaxR = 55.;
2425  fMinR = 5.;
2426  break;
2427  case 14:
2428  fMaxR = 180.;
2429  fMinR = 55.;
2430  break;
2431  case 15:
2432  fMaxR = 72.;
2433  fMinR = 5.;
2434  break;
2435  case 16:
2436  fMaxR = 180.;
2437  fMinR = 95.;
2438  break;
2439 
2440  default:
2441  AliError("RCut not defined");
2442  return kFALSE;
2443  }
2444  return kTRUE;
2445 }
2446 
2449 
2450  switch(etaPhiCut) {
2451  case 0: //no specific eta range selected, full eta range
2454  break;
2455  case 1: //eta < 0 only
2458  fEtaForPhiCutMax = 0.;
2459  break;
2460  case 2://eta > 0 only
2462  fEtaForPhiCutMin = 0.;
2464  break;
2465  default:
2466  AliError(Form("EtaForPhiCut not defined %d",etaPhiCut));
2467  return kFALSE;
2468  }
2469 
2470  return kTRUE;
2471 }
2472 
2474 // This are exclusion cuts, everything between fMinPhiCut & fMaxPhiCut will be excluded
2476 
2477  switch(minPhiCut) {
2478  case 0:
2479  fDoShrinkTPCAcceptance = kFALSE;
2480  fMinPhiCut = 0;
2481  break;
2482  case 1:
2484  fMinPhiCut = 1.7; //OROC C08 large cut
2485  break;
2486  case 2:
2488  fMinPhiCut = 4.4; //EMCal
2489  break;
2490  case 3:
2492  fMinPhiCut = 1.0; //PHOS
2493  break;
2494  case 4:
2496  fMinPhiCut = 3.4; //EMCal tight
2497  break;
2498  case 5:
2500  fMinPhiCut = 2.0; //OROC C08 medium cut
2501  break;
2502  case 6:
2504  fMinPhiCut = 2.2; //OROC C08 small cut
2505  break;
2506  case 7:
2508  fMinPhiCut = 2.4; //OROC C08 tightest cut
2509  break;
2510  case 8:
2512  fMinPhiCut = 4.54; //PHOS phi
2513  break;
2514  default:
2515  AliError(Form("MinPhiCut not defined %d",minPhiCut));
2516  return kFALSE;
2517  }
2518 
2519  return kTRUE;
2520 }
2521 
2523 // This are exclusion cuts, everything between fMinPhiCut & fMaxPhiCut will be excluded
2525 
2526  switch(maxPhiCut) {
2527  case 0:
2529  fMaxPhiCut = 2*TMath::Pi()+0.00001;
2530  break;
2531  case 1:
2533  fMaxPhiCut = 4.3; //OROC C08 large cut
2534  break;
2535  case 2:
2537  fMaxPhiCut = 5.8; //EMCal
2538  break;
2539  case 3:
2541  fMaxPhiCut = 3.0; //PHOS
2542  break;
2543  case 4:
2545  fMaxPhiCut = 1.; //EMCal
2546  break;
2547  case 5:
2549  fMaxPhiCut = 4.0; //OROC C08 medium cut
2550  break;
2551  case 6:
2553  fMaxPhiCut = 3.8; //OROC C08 small cut
2554  break;
2555  case 7:
2557  fMaxPhiCut = 3.6; //OROC C08 tighest cut
2558  break;
2559  case 8:
2561  fMaxPhiCut = 5.59; //PHOS phi
2562  break;
2563  default:
2564  AliError(Form("MaxPhiCut not defined %d",maxPhiCut));
2565  return kFALSE;
2566  }
2567 
2568  return kTRUE;
2569 }
2570 
2571 
2574  switch(singlePtCut){
2575  case 0: // 0.050 GeV + min gamma pT cut of 20 MeV
2576  fSinglePtCut = 0.050;
2577  fPtCut = 0.02;
2578  break;
2579  case 1: // 0.100 GeV + min gamma pT cut of 20 MeV
2580  fSinglePtCut = 0.100;
2581  fPtCut = 0.02;
2582  break;
2583  case 2: // 0.150 GeV + min gamma pT cut of 20 MeV
2584  fSinglePtCut = 0.150;
2585  fPtCut = 0.02;
2586  break;
2587  case 3: // 0.200 GeV + min gamma pT cut of 20 MeV
2588  fSinglePtCut = 0.200;
2589  fPtCut = 0.02;
2590  break;
2591  case 4: // 0.075 GeV + min gamma pT cut of 20 MeV
2592  fSinglePtCut = 0.075;
2593  fPtCut = 0.02;
2594  break;
2595  case 5: // 0.125 GeV + min gamma pT cut of 20 MeV
2596  fSinglePtCut = 0.125;
2597  fPtCut = 0.02;
2598  break;
2599  case 6: // 0.04 GeV + min gamma pT cut of 10 MeV
2600  fSinglePtCut = 0.040;
2601  fPtCut = 0.01;
2602  break;
2603  case 7: // 0.0 GeV + min gamma pT cut of 0 MeV
2604  fSinglePtCut = 0.0;
2605  fPtCut = 0.0;
2606  break;
2607  case 8: // 0.02 GeV + min gamma pT cut of 20 MeV, equivalent to .05 for the low B field runs
2608  fSinglePtCut = 0.02;
2609  fPtCut = 0.01;
2610  break;
2611  case 9: // 0.050 GeV + min gamma pT cut of 100 MeV
2612  fSinglePtCut = 0.050;
2613  fPtCut = 0.100;
2614  break;
2615  case 10: //a: 0.050 GeV + min gamma pT cut of 150 MeV
2616  fSinglePtCut = 0.050;
2617  fPtCut = 0.150;
2618  break;
2619  case 11: //b: 0.050 GeV + min gamma pT cut of 200 MeV
2620  fSinglePtCut = 0.050;
2621  fPtCut = 0.200;
2622  break;
2623  case 12: //c: 0.060 GeV
2624  fSinglePtCut = 0.060;
2625  break;
2626  case 13: //d: 0.060 GeV + min gamma pT cut of 100 MeV
2627  fSinglePtCut = 0.060;
2628  fPtCut = 0.100;
2629  break;
2630  case 14: //e: 0.060 GeV + min gamma pT cut of 150 MeV
2631  fSinglePtCut = 0.060;
2632  fPtCut = 0.150;
2633  break;
2634  case 15: //f: 0.060 GeV + min gamma pT cut of 200 MeV
2635  fSinglePtCut = 0.060;
2636  fPtCut = 0.200;
2637  break;
2638  case 16: //g: 0.075 GeV + min gamma pT cut of 150 MeV
2639  fSinglePtCut = 0.075;
2640  fPtCut = 0.150;
2641  break;
2642  case 17: //h: 0.100 GeV + min gamma pT cut of 200 MeV
2643  fSinglePtCut = 0.100;
2644  fPtCut = 0.200;
2645  break;
2646  case 18: //i: 0.150 GeV + min gamma pT cut of 300 MeV
2647  fSinglePtCut = 0.150;
2648  fPtCut = 0.300;
2649  break;
2650  case 19: //j: asym: 0.100 GeV and 0.075 GeV
2651  fSinglePtCut = 0.100;
2652  fDoAsymPtCut = kTRUE;
2653  fSinglePtCut2= 0.075;
2654  break;
2655  case 20: //k: asym: 0.150 GeV and 0.075 GeV
2656  fSinglePtCut = 0.150;
2657  fDoAsymPtCut = kTRUE;
2658  fSinglePtCut2= 0.075;
2659  break;
2660  case 21: //l: asym: 0.200 GeV and 0.075 GeV
2661  fSinglePtCut = 0.200;
2662  fDoAsymPtCut = kTRUE;
2663  fSinglePtCut2= 0.075;
2664  break;
2665  case 22: // m: 0.080 GeV + min gamma pT cut of 20 MeV
2666  fSinglePtCut = 0.080;
2667  fPtCut = 0.02;
2668  break;
2669  case 23: // n: 0.090 GeV + min gamma pT cut of 20 MeV
2670  fSinglePtCut = 0.090;
2671  fPtCut = 0.02;
2672  break;
2673  case 24: // o: 0.024 GeV + min gamma pT cut of 20 MeV ; equiv. 0.06 for lowB
2674  fSinglePtCut = 0.024;
2675  fPtCut = 0.01;
2676  break;
2677  case 25: // p: 0.030 GeV + min gamma pT cut of 20 MeV ; equiv. 0.075 for lowB
2678  fSinglePtCut = 0.030;
2679  fPtCut = 0.01;
2680  break;
2681  case 26: // q: 0.032 GeV + min gamma pT cut of 20 MeV ; equiv. 0.08 for lowB
2682  fSinglePtCut = 0.032;
2683  fPtCut = 0.01;
2684  break;
2685  case 27: // r: 0.036 GeV + min gamma pT cut of 20 MeV ; equiv. 0.09 for lowB
2686  fSinglePtCut = 0.036;
2687  fPtCut = 0.01;
2688  break;
2689  case 28: // s: 0.040 GeV + min gamma pT cut of 20 MeV ; equiv. 0.075 for lowB
2690  fSinglePtCut = 0.040;
2691  fPtCut = 0.01;
2692  break;
2693 
2694  default:
2695  AliError(Form("singlePtCut not defined %d",singlePtCut));
2696  return kFALSE;
2697  }
2698  return kTRUE;
2699 }
2700 
2703  switch(clsTPCCut){
2704  case 0: // 0
2705  fMinClsTPC= 0.;
2706  break;
2707  case 1: // 60
2708  fMinClsTPC= 60.;
2709  break;
2710  case 2: // 80
2711  fMinClsTPC= 80.;
2712  break;
2713  case 3: // 100
2714  fMinClsTPC= 100.;
2715  break;
2716  case 4: // 95% of findable clusters
2717  fMinClsTPCToF= 0.95;
2719  break;
2720  case 5: // 0% of findable clusters
2721  fMinClsTPCToF= 0.0;
2723  break;
2724  case 6: // 70% of findable clusters
2725  fMinClsTPCToF= 0.7;
2727  break;
2728  case 7: // 0% of findable clusters
2729  fMinClsTPCToF= 0.35;
2731  break;
2732  case 8:
2733  fMinClsTPCToF= 0.35;
2735  break;
2736  case 9:
2737  fMinClsTPCToF= 0.6;
2739  break;
2740  default:
2741  AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2742  return kFALSE;
2743  }
2744  return kTRUE;
2745 }
2746 
2749  switch(ededxSigmaCut){
2750  case 0: // -10,10
2753  break;
2754  case 1: // -5,5
2757  break;
2758  case 2: // -3,5
2761  break;
2762  case 3: // -4,5
2765  break;
2766  case 4: // -6,7
2769  break;
2770  case 5: // -4,4
2773  break;
2774  case 6: // -2.5,4
2777  break;
2778  case 7: // -2,3.5
2781  break;
2782  case 8: // -2.5,3.
2785  break;
2786  case 9: // -2.5,5.
2789  break;
2790  default:
2791  AliError("TPCdEdxCutElectronLine not defined");
2792  return kFALSE;
2793 
2794  }
2795  return kTRUE;
2796 }
2797 
2800 
2801  switch(pidedxSigmaCut){
2802  case 0: // -10
2805  break;
2806  case 1: // 0
2809  break;
2810  case 2: // 1
2813  break;
2814  case 3: // 1
2817  break;
2818  case 4: // 3.0sigma, 1.0 sigma at high pt
2821  break;
2822  case 5: // 1
2825  break;
2826  case 6: // 1
2829  break;
2830  case 7: // 1
2833  break;
2834  case 8: // 1
2837  break;
2838  case 9:
2839  fPIDnSigmaAbovePionLine=1; // We need a bit less tight cut on dE/dx
2841  break;
2842  default:
2843  AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2844  return kFALSE;
2845  }
2846  return kTRUE;
2847 }
2848 
2851  switch(piMomdedxSigmaCut){
2852  case 0: // 0.5 GeV
2854  break;
2855  case 1: // 1. GeV
2857  break;
2858  case 2: // 1.5 GeV
2860  break;
2861  case 3: // 20.0 GeV
2863  break;
2864  case 4: // 50.0 GeV
2866  break;
2867  case 5: // 0.3 GeV
2869  break;
2870  case 6: // 0.25 GeV
2872  break;
2873  case 7: // 0.4 GeV
2875  break;
2876  case 8: // 0.2 GeV
2878  break;
2879  default:
2880  AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2881  return kFALSE;
2882  }
2883  return kTRUE;
2884 }
2885 
2888  switch(piMaxMomdedxSigmaCut){
2889  case 0: // 100. GeV
2891  break;
2892  case 1: // 5. GeV
2894  break;
2895  case 2: // 4. GeV
2897  break;
2898  case 3: // 3.5 GeV
2900  break;
2901  case 4: // 3. GeV
2903  break;
2904  case 5: // 7. GeV
2906  break;
2907  case 6: // 2. GeV
2909  break;
2910  default:
2911  AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2912  return kFALSE;
2913  }
2914  return kTRUE;
2915 }
2916 
2919  switch(LowPRejectionSigmaCut){
2920  case 0: //
2924  fDoKaonRejectionLowP = kFALSE;
2925  fDoProtonRejectionLowP = kFALSE;
2926  fDoPionRejectionLowP = kFALSE;
2928  break;
2929  case 1: //
2933  fDoKaonRejectionLowP = kTRUE;
2934  fDoProtonRejectionLowP = kTRUE;
2935  fDoPionRejectionLowP = kTRUE;
2937  break;
2938  case 2: //
2942  fDoKaonRejectionLowP = kTRUE;
2943  fDoProtonRejectionLowP = kTRUE;
2944  fDoPionRejectionLowP = kTRUE;
2946  break;
2947  case 3: //
2951  fDoKaonRejectionLowP = kTRUE;
2952  fDoProtonRejectionLowP = kTRUE;
2953  fDoPionRejectionLowP = kTRUE;
2955  break;
2956  case 4: //
2960  fDoKaonRejectionLowP = kFALSE;
2961  fDoProtonRejectionLowP = kFALSE;
2962  fDoPionRejectionLowP = kTRUE;
2964  break;
2965  case 5: //
2969  fDoKaonRejectionLowP = kFALSE;
2970  fDoProtonRejectionLowP = kFALSE;
2971  fDoPionRejectionLowP = kTRUE;
2973  break;
2974  case 6: //
2978  fDoKaonRejectionLowP = kFALSE;
2979  fDoProtonRejectionLowP = kFALSE;
2980  fDoPionRejectionLowP = kTRUE;
2982  break;
2983  case 7: //
2987  fDoKaonRejectionLowP = kFALSE;
2988  fDoProtonRejectionLowP = kFALSE;
2989  fDoPionRejectionLowP = kTRUE;
2991  break;
2992  case 8: //
2996  fDoKaonRejectionLowP = kFALSE;
2997  fDoProtonRejectionLowP = kTRUE;
2998  fDoPionRejectionLowP = kFALSE;
3000  break;
3001  default:
3002  AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
3003  return kFALSE;
3004  }
3005  return kTRUE;
3006 }
3007 
3010  switch(kappaCut){
3011  case 0: // completely open
3012  fKappaMaxCut=200;
3013  fKappaMinCut=-200;
3014  break;
3015  case 1: // mainly pi pi
3016  fKappaMaxCut=-13;
3017  fKappaMinCut=-20;
3018  break;
3019  case 2: // mainly pi e
3020  fKappaMaxCut=-6;
3021  fKappaMinCut=-11;
3022  break;
3023  case 3: // signal
3024  fKappaMaxCut=5;
3025  fKappaMinCut=-3;
3026  break;
3027  case 4: // remaining
3028  fKappaMaxCut=20;
3029  fKappaMinCut=11;
3030  break;
3031  case 5: // -5-10 full signal peak(including background)
3032  fKappaMaxCut=10;
3033  fKappaMinCut=-5;
3034  break;
3035  case 6: //
3036  fKappaMaxCut=10;
3037  fKappaMinCut=-3;
3038  break;
3039  case 7: //
3040  fKappaMaxCut=10;
3041  fKappaMinCut=0;
3042  break;
3043  default:
3044  AliError("KappaTPCCut not defined");
3045  return kFALSE;
3046 
3047  }
3048  return kTRUE;
3049 }
3050 
3051 
3054  // Set Cut
3055  switch(TOFelectronPID){
3056  case 0: // no cut
3057  fUseTOFpid = kFALSE;
3060  break;
3061  case 1: // -7,7
3062  fUseTOFpid = kTRUE;
3065  break;
3066  case 2: // -5,5
3067  fUseTOFpid = kTRUE;
3070  break;
3071  case 3: // -3,5
3072  fUseTOFpid = kTRUE;
3075  break;
3076  case 4: // -2,3
3077  fUseTOFpid = kTRUE;
3080  break;
3081  case 5: // -3,3
3082  fUseTOFpid = kTRUE;
3085  break;
3086  default:
3087  AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
3088  return kFALSE;
3089  }
3090  return kTRUE;
3091 }
3092 
3095  // Set Cut
3096  switch(ITSelectronPID){
3097  case 0: // no cut
3098  fUseITSpid = kFALSE;
3101  fMaxPtPIDITS = 1.5;
3102  break;
3103  case 1: // -3,3
3104  fUseITSpid = kTRUE;
3107  fMaxPtPIDITS = 1.5;
3108  break;
3109  case 2: // -2,2
3110  fUseITSpid = kTRUE;
3113  fMaxPtPIDITS = 1.5;
3114  break;
3115  case 3: // -1,1
3116  fUseITSpid = kTRUE;
3119  fMaxPtPIDITS = 1.5;
3120  break;
3121  case 4: // -3,5
3122  fUseITSpid = kTRUE;
3125  fMaxPtPIDITS = 1.5;
3126  break;
3127  case 5: // -5,5
3128  fUseITSpid = kTRUE;
3131  fMaxPtPIDITS = 1.5;
3132  break;
3133  case 6: // -3,3
3134  fUseITSpid = kTRUE;
3137  fMaxPtPIDITS = 2;
3138  break;
3139  case 7: // -2,2
3140  fUseITSpid = kTRUE;
3143  fMaxPtPIDITS = 2;
3144  break;
3145  case 8: // -1,1
3146  fUseITSpid = kTRUE;
3149  fMaxPtPIDITS = 2;
3150  break;
3151  case 9: // -3,5
3152  fUseITSpid = kTRUE;
3155  fMaxPtPIDITS = 2;
3156  break;
3157  default:
3158  AliError(Form("ITSelectronPID not defined %d",ITSelectronPID));
3159  return kFALSE;
3160  }
3161  return kTRUE;
3162 }
3163 
3166  // Set Cut
3167  switch(TRDelectronPID){
3168  case 0: // no cut
3169  fDoTRDPID = kFALSE;
3170  fTRDPIDBelowCut=-100;
3171  fTRDPIDAboveCut=100;
3172  break;
3173  default:
3174  AliError(Form("TRDelectronPID not defined %d",TRDelectronPID));
3175  return kFALSE;
3176  }
3177  return kTRUE;
3178 }
3179 
3180 
3183  switch(QtMaxCut){
3184  case 0: //
3185  fQtMax=1.;
3186  fDoQtGammaSelection=kFALSE;
3187  fDo2DQt=kFALSE;
3188  break;
3189  case 1:
3190  fQtMax=0.1;
3191  fDo2DQt=kFALSE;
3192  break;
3193  case 2:
3194  fQtMax=0.06;
3195  fDo2DQt=kTRUE;
3196  break;
3197  case 3:
3198  fQtMax=0.05;
3199  fDo2DQt=kFALSE;
3200  break;
3201  case 4:
3202  fQtMax=0.03;
3203  fDo2DQt=kFALSE;
3204  break;
3205  case 5:
3206  fQtMax=0.02;
3207  fDo2DQt=kFALSE;
3208  break;
3209  case 6:
3210  fQtMax=0.02;
3211  fDo2DQt=kTRUE;
3212  break;
3213  case 7:
3214  fQtMax=0.15;
3215  fDo2DQt=kFALSE;
3216  break;
3217  case 8:
3218  fQtMax=0.05;
3219  fDo2DQt=kTRUE;
3220  break;
3221  case 9:
3222  fQtMax=0.03;
3223  fDo2DQt=kTRUE;
3224  break;
3225  default:
3226  AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
3227  return kFALSE;
3228  }
3229  return kTRUE;
3230 }
3231 
3234 
3235  switch(chi2GammaCut){
3236  case 0: // 100
3237  fChi2CutConversion = 100.;
3238  break;
3239  case 1: // 50
3240  fChi2CutConversion = 50.;
3241  break;
3242  case 2: // 30
3243  fChi2CutConversion = 30.;
3244  break;
3245  case 3:
3246  fChi2CutConversion = 200.;
3247  break;
3248  case 4:
3249  if (fIsHeavyIon==1){
3250  fChi2CutConversion = 7.;
3251  } else {
3252  fChi2CutConversion = 500.;
3253  }
3254  break;
3255  case 5:
3256  fChi2CutConversion = 100000.;
3257  break;
3258  case 6:
3259  fChi2CutConversion = 5.;
3260  break;
3261  case 7:
3262  fChi2CutConversion = 10.;
3263  break;
3264  case 8:
3265  fChi2CutConversion = 20.;
3266  break;
3267  case 9:
3268  fChi2CutConversion = 15.;
3269  break;
3270  case 10:
3271  fChi2CutConversion = 25.;
3272  break;
3273  default:
3274  AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
3275  return kFALSE;
3276  }
3277  return kTRUE;
3278 }
3279 
3282  switch(psiCut) {
3283  case 0:
3284  fPsiPairCut = 10000; //
3285  break;
3286  case 1:
3287  fPsiPairCut = 0.1; //
3288  break;
3289  case 2:
3290  fPsiPairCut = 0.05; // Standard
3291  break;
3292  case 3:
3293  fPsiPairCut = 0.035; //
3294  break;
3295  case 4:
3296  fPsiPairCut = 0.2; //
3297  break;
3298  case 5:
3299  fPsiPairCut = 0.1; //
3300  fDo2DPsiPairChi2 = kTRUE;
3301  break;
3302  case 6:
3303  fPsiPairCut = 0.05; //
3304  fDo2DPsiPairChi2 = kTRUE;
3305  break;
3306  case 7:
3307  if (fIsHeavyIon==1){
3308  fPsiPairCut = 0.07; //
3309  } else {
3310  fPsiPairCut = 0.035; //
3311  }
3312  fDo2DPsiPairChi2 = kTRUE;
3313  break;
3314  case 8:
3315  fPsiPairCut = 0.2; //
3316  fDo2DPsiPairChi2 = kTRUE; //
3317  break;
3318  case 9:
3319  // if (fIsHeavyIon==1){ //AM 2016-05-13
3320  fPsiPairCut = 0.1; //
3321  fDo2DPsiPairChi2 = kTRUE;
3322  fIncludeRejectedPsiPair = kTRUE;
3323  break;
3324  // } else {
3325  // fPsiPairCut = 0.5; //
3326  // break;
3327  // }
3328  default:
3329  AliError(Form("PsiPairCut not defined %d",psiCut));
3330  return kFALSE;
3331  }
3332 
3333  return kTRUE;
3334 }
3335 
3338  // Set Cut
3339  switch(doPhotonAsymmetryCut){
3340  case 0:
3344  break;
3345  case 1:
3348  fMinPhotonAsymmetry=0.04;
3349  break;
3350  case 2:
3353  fMinPhotonAsymmetry=0.06;
3354  break;
3355  case 3:
3358  fMinPhotonAsymmetry=0.05;
3359  break;
3360  case 4:
3363  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3364  fFAsymmetryCut->SetParameter(0,0.3);
3365  fFAsymmetryCut->SetParameter(1,0.66);
3366  fFAsymmetryCut->SetParameter(2,0.7);
3369  break;
3370  case 5:
3373  fFAsymmetryCut = new TF1("fFAsymmetryCut","[0] + [1]*tanh(2*TMath::Power(x,[2]))",0.,100.);
3374  fFAsymmetryCut->SetParameter(0,0.14);
3375  fFAsymmetryCut->SetParameter(1,0.66);
3376  fFAsymmetryCut->SetParameter(2,0.5);
3379  break;
3380  case 6:
3383  fMinPhotonAsymmetry=0.05;
3384  break;
3385  case 7:
3388  fMinPhotonAsymmetry=0.05;
3389  break;
3390  default:
3391  AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
3392  return kFALSE;
3393  }
3394  fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
3395  return kTRUE;
3396 }
3397 
3400 
3401  switch(cosCut){
3402  case 0:
3403  fCosPAngleCut = -1;
3404  break;
3405  case 1:
3406  fCosPAngleCut = 0;
3407  break;
3408  case 2:
3409  fCosPAngleCut = 0.5;
3410  break;
3411  case 3:
3412  fCosPAngleCut = 0.75;
3413  break;
3414  case 4:
3415  fCosPAngleCut = 0.85;
3416  break;
3417  case 5:
3418  fCosPAngleCut = 0.88;
3419  break;
3420  case 6:
3421  fCosPAngleCut = 0.9;
3422  break;
3423  case 7:
3424  fCosPAngleCut = 0.95;
3425  break;
3426  case 8:
3427  fCosPAngleCut = 0.98;
3428  break;
3429  case 9:
3430  fCosPAngleCut = 0.99;
3431  break;
3432  case 10:
3433  fCosPAngleCut = 0.995;
3434  break;
3435  default:
3436  AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
3437  return kFALSE;
3438  }
3439 
3440  return kTRUE;
3441 }
3442 
3445 
3446  switch(sharedElec){
3447  case 0:
3448  fDoSharedElecCut = kFALSE;
3450  fPhotonQualityCut = 0;
3451  break;
3452  case 1:
3453  fDoSharedElecCut = kTRUE;
3455  fPhotonQualityCut = 0;
3456  break;
3457  case 2:
3458  fDoSharedElecCut = kFALSE;
3460  fPhotonQualityCut = 1;
3461  break;
3462  case 3:
3463  fDoSharedElecCut = kFALSE;
3465  fPhotonQualityCut = 2;
3466  break;
3467  case 4:
3468  fDoSharedElecCut = kFALSE;
3470  fPhotonQualityCut = 3;
3471  break;
3472  default:
3473  AliError(Form("Shared Electron Cut not defined %d",sharedElec));
3474  return kFALSE;
3475  }
3476 
3477  return kTRUE;
3478 }
3479 
3482 
3483  switch(toClose){
3484  case 0:
3485  fDoToCloseV0sCut = kFALSE;
3486  fminV0Dist = 250;
3487  break;
3488  case 1:
3489  fDoToCloseV0sCut = kTRUE;
3490  fminV0Dist = 1;
3491  break;
3492  case 2:
3493  fDoToCloseV0sCut = kTRUE;
3494  fminV0Dist = 2;
3495  break;
3496  case 3:
3497  fDoToCloseV0sCut = kTRUE;
3498  fminV0Dist = 3;
3499  break;
3500  case 4:
3501  fDoToCloseV0sCut = kTRUE;
3502  fDoDoubleCountingCut = kTRUE;
3503  fMinRDC=0.;
3504  fDeltaR=6.;
3505  fOpenAngle=0.02;
3506  break;
3507  case 5:
3508  fDoToCloseV0sCut = kTRUE;
3509  fDoDoubleCountingCut = kTRUE;
3510  fMinRDC=0.;
3511  fDeltaR=6.;
3512  fOpenAngle=0.03;
3513  break;
3514  case 6:
3515  fDoToCloseV0sCut = kTRUE;
3516  fDoDoubleCountingCut = kTRUE;
3517  fMinRDC=0.;
3518  fDeltaR=6.;
3519  fOpenAngle=0.04;
3520  break;
3521 
3522  default:
3523  AliError(Form("Shared Electron Cut not defined %d",toClose));
3524  return kFALSE;
3525  }
3526  return kTRUE;
3527 }
3528 
3531  switch(TRDElectronCut){
3532  case 0:
3533  fDoTRDPID=kFALSE;
3534  break;
3535  case 1:
3536  fDoTRDPID=kTRUE;
3537  fPIDTRDEfficiency=0.1;
3538  break;
3539  case 8:
3540  fDoTRDPID=kTRUE;
3541  fPIDTRDEfficiency=0.8;
3542  break;
3543  case 9:
3544  fDoTRDPID=kTRUE;
3545  fPIDTRDEfficiency=0.9;
3546  break;
3547  default:
3548  AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
3549  return kFALSE;
3550  }
3551 
3552  return kTRUE;
3553 }
3554 
3557  // Set Cut
3558  switch(DCAZPhotonPrimVtx){
3559  case 0: //
3560  fDCAZPrimVtxCut = 1000;
3561  break;
3562  case 1: //
3563  fDCAZPrimVtxCut = 10;
3564  break;
3565  case 2: //
3566  fDCAZPrimVtxCut = 5;
3567  break;
3568  case 3: //
3569  fDCAZPrimVtxCut = 4;
3570  break;
3571  case 4: //
3572  fDCAZPrimVtxCut = 3;
3573  break;
3574  case 5: //
3575  fDCAZPrimVtxCut = 2.5;
3576  break;
3577  case 6: //
3578  fDCAZPrimVtxCut = 2;
3579  break;
3580  case 7: //
3581  fDCAZPrimVtxCut = 1.5;
3582  break;
3583  case 8: //
3584  fDCAZPrimVtxCut = 1;
3585  break;
3586  case 9: //
3587  fDCAZPrimVtxCut = 0.5;
3588  break;
3589  default:
3590  cout<<"Warning: DCAZPhotonPrimVtx not defined "<<DCAZPhotonPrimVtx<<endl;
3591  return kFALSE;
3592  }
3593  return kTRUE;
3594 }
3595 
3598  // Set Cut
3599  switch(DCARPhotonPrimVtx){
3600  case 0: //
3601  fDCARPrimVtxCut = 1000;
3602  break;
3603  case 1: //
3604  fDCARPrimVtxCut = 10;
3605  break;
3606  case 2: //
3607  fDCARPrimVtxCut = 5;
3608  break;
3609  case 3: //
3610  fDCARPrimVtxCut = 4;
3611  break;
3612  case 4: //
3613  fDCARPrimVtxCut = 3;
3614  break;
3615  case 5: //
3616  fDCARPrimVtxCut = 2.5;
3617  break;
3618  case 6: //
3619  fDCARPrimVtxCut = 2;
3620  break;
3621  case 7: //
3622  fDCARPrimVtxCut = 1.5;
3623  break;
3624  case 8: //
3625  fDCARPrimVtxCut = 1;
3626  break;
3627  case 9: //
3628  fDCARPrimVtxCut = 0.5;
3629  break;
3630  default:
3631  cout<<"Warning: DCARPhotonPrimVtx not defined "<<DCARPhotonPrimVtx<<endl;
3632  return kFALSE;
3633  }
3634  return kTRUE;
3635 }
3636 
3639  // Set Cut
3640  switch(inOutPlane){
3641  case 0: //
3642  fInPlaneOutOfPlane = 0; // No Event Plane
3643  break;
3644  case 1: //
3645  fInPlaneOutOfPlane = 1; // In-Plane
3646  break;
3647  case 2: //
3648  fInPlaneOutOfPlane = 2; // Out-Of-Plane
3649  break;
3650  default:
3651  cout<<"Warning: In-Plane or Out-Of-Plane not defined "<<inOutPlane<<endl;
3652  return kFALSE;
3653  }
3654  return kTRUE;
3655 }
3656 
3657 
3660  // Get first TPC row
3661  Int_t firstTPCRow = 0;
3662  Double_t radiusI = 84.8;
3663  Double_t radiusO = 134.6;
3664  Double_t radiusOB = 198.;
3665  Double_t rSizeI = 0.75;
3666  Double_t rSizeO = 1.;
3667  Double_t rSizeOB = 1.5;
3668  Int_t nClsI = 63;
3669  Int_t nClsIO = 127;
3670 
3671  if(radius <= radiusI){
3672  return firstTPCRow;
3673  }
3674  if(radius>radiusI && radius<=radiusO){
3675  firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
3676  }
3677  if(radius>radiusO && radius<=radiusOB){
3678  firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
3679  }
3680 
3681  if(radius>radiusOB){
3682  firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
3683  }
3684 
3685  return firstTPCRow;
3686 }
3687 
3691  if(GetCosineOfPointingAngle(photon, event) < fCosPAngleCut){
3692  return kFALSE;
3693  }
3694  return kTRUE;
3695 }
3696 
3699  // calculates the pointing angle of the recalculated V0
3700 
3701  Double_t momV0[3] = {0,0,0};
3702  if(event->IsA()==AliESDEvent::Class()){
3703  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
3704  if(!esdEvent) return -999;
3705  AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
3706  if(!v0) return -999;
3707  v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
3708  }
3709  if(event->IsA()==AliAODEvent::Class()){
3710  momV0[0] = photon->GetPx();
3711  momV0[1] = photon->GetPy();
3712  momV0[2] = photon->GetPz();
3713  }
3714 
3715  //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
3716  Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
3717  photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
3718  photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
3719 
3720  Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
3721  Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
3722 
3723 
3724  Double_t cosinePointingAngle = -999;
3725  if(momV02*PosV02 > 0.0)
3726  cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
3727 
3728  return cosinePointingAngle;
3729 }
3730 
3733 
3734  if (fDo2DPsiPairChi2){
3736  if (TMath::Abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut || (photon->GetPsiPair()) == 4){
3737  return kTRUE;
3738  } else {
3739  return kFALSE;
3740  }
3741 
3742  } else {
3743  if (TMath::Abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut ){
3744  return kTRUE;
3745  } else {
3746  return kFALSE;
3747  }
3748  }
3749  } else {
3751  if(TMath::Abs(photon->GetPsiPair()) > fPsiPairCut || (photon->GetPsiPair()) != 4){
3752  return kFALSE;
3753  } else {
3754  return kTRUE;
3755  }
3756  } else {
3757  if(TMath::Abs(photon->GetPsiPair()) > fPsiPairCut){
3758  return kFALSE;
3759  } else {
3760  return kTRUE;
3761  }
3762  }
3763  }
3764 }
3765 
3768  // returns TString with current cut number
3769  return fCutStringRead;
3770 }
3771 
3774 
3775  Int_t posLabel = photon->GetTrackLabelPositive();
3776  Int_t negLabel = photon->GetTrackLabelNegative();
3777 
3778  fElectronLabelArray[nV0*2] = posLabel;
3779  fElectronLabelArray[(nV0*2)+1] = negLabel;
3780 }
3781 
3784 
3785  Int_t posLabel = photon->GetTrackLabelPositive();
3786  Int_t negLabel = photon->GetTrackLabelNegative();
3787 
3788  for(Int_t i = 0; i<nV0s*2;i++){
3789  if(i==nV0*2) continue;
3790  if(i==(nV0*2)+1) continue;
3791  if(fElectronLabelArray[i] == posLabel){
3792  return kFALSE;}
3793  if(fElectronLabelArray[i] == negLabel){
3794  return kFALSE;}
3795  }
3796 
3797  return kTRUE;
3798 }
3799 
3802 
3803  if (fDoDoubleCountingCut && photon->GetConversionRadius() < fMinRDC) return kTRUE;
3804 
3805  Double_t posX = photon->GetConversionX();
3806  Double_t posY = photon->GetConversionY();
3807  Double_t posZ = photon->GetConversionZ();
3808 
3809  for(Int_t i = 0;i<photons->GetEntries();i++){
3810  if(nV0 == i) continue;
3811  AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
3812  Double_t posCompX = photonComp->GetConversionX();
3813  Double_t posCompY = photonComp->GetConversionY();
3814  Double_t posCompZ = photonComp->GetConversionZ();
3815 
3816  if (!fDoDoubleCountingCut){
3817  Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
3818 
3819  if(dist < fminV0Dist*fminV0Dist){
3820  if(photon->GetChi2perNDF() > photonComp->GetChi2perNDF()) return kFALSE;
3821  }
3822  }else{
3823  TVector3 v1(photon->Px(),photon->Py(),photon->Pz());
3824  TVector3 v2(photonComp->Px(),photonComp->Py(),photonComp->Pz());
3825  Double_t OpeningAngle=v1.Angle(v2);
3826  if( OpeningAngle < fOpenAngle && TMath::Abs(photon->GetConversionRadius()-photonComp->GetConversionRadius()) < fDeltaR){
3827  if(photon->GetChi2perNDF() > photonComp->GetChi2perNDF()) return kFALSE;
3828  }
3829  }
3830 
3831  }
3832  return kTRUE;
3833 }
3834 
3835 
3838  //Create and return standard 2010 PbPb cuts
3839  AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
3840  if(!cuts->InitializeCutsFromCutString("04209297002322000000")){
3841  cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
3842  return cuts;
3843 }
3844 
3847  //Create and return standard 2010 PbPb cuts
3848  AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010pp","StandardCuts2010pp");
3849  if(!cuts->InitializeCutsFromCutString("00209366300380000000")){
3850  cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
3851  return cuts;
3852 }
3853 
3856 
3857  //GetPhotonPhi() 0-2 Pi //eventPlaneAngle -1pi-1pi
3858  eventPlaneAngle=eventPlaneAngle+TMath::Pi();
3859  Double_t gammaToEPAngle = eventPlaneAngle-photonPhi;
3860  if(gammaToEPAngle < 0) gammaToEPAngle=gammaToEPAngle+2*TMath::Pi();
3861  gammaToEPAngle = gammaToEPAngle-TMath::Pi(); // angle from -pi +pi
3862 
3863  if(!fInPlaneOutOfPlane){
3864  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3865  return kTRUE;
3866  }
3867  else if(fInPlaneOutOfPlane == 1){
3868  if(TMath::Abs(gammaToEPAngle)<=0.25*TMath::Pi() || TMath::Abs(gammaToEPAngle)>=0.75*TMath::Pi()){
3869  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3870  return kTRUE;
3871  }
3872  else return kFALSE;
3873  }
3874  else if(fInPlaneOutOfPlane == 2){
3875  if(TMath::Abs(gammaToEPAngle)>0.25*TMath::Pi() && TMath::Abs(gammaToEPAngle)<0.75*TMath::Pi()){
3876  if(fill&&fHistoEventPlanePhi)fHistoEventPlanePhi->Fill(gammaToEPAngle);
3877  return kTRUE;
3878  }
3879  else return kFALSE;
3880  }
3881  return kFALSE;
3882 }
3883 
3886 
3887  AliAODTrack * negTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelNegative()));
3888  AliAODTrack * posTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelPositive()));
3889 
3890  if(!negTrack || !posTrack) {
3891  return 0;
3892  }
3893  if(negTrack->Charge() == posTrack->Charge()){
3894  return 0;
3895  }
3896  Int_t nClusterITSneg = negTrack->GetITSNcls();
3897  Int_t nClusterITSpos = posTrack->GetITSNcls();
3898  // cout << nClusterITSneg << "\t" << nClusterITSpos <<endl;
3899 
3900  if (nClusterITSneg > 1 && nClusterITSpos > 1){
3901  return 3;
3902  } else if (nClusterITSneg > 1 || nClusterITSpos > 1){
3903  return 2;
3904  } else {
3905  return 1;
3906  }
3907  return 0;
3908 }
3909 
3912 
3913  TString nameProfile;
3914  if (flag==1){
3915  nameProfile = "profileContainingMaterialBudgetWeights_fewRadialBins";}
3916  else if (flag==2){
3917  nameProfile = "profileContainingMaterialBudgetWeights_manyRadialBins";}
3918  else {
3919  AliError(Form("%d not a valid flag for InitMaterialBudgetWeightingOfPi0Candidates()",flag));
3920  return kFALSE;
3921  }
3922  TFile* file = TFile::Open(filename.Data());
3923  if (!file) {
3924  AliError(Form("File %s for materialbudgetweights not found",filename.Data()));
3925  return kFALSE;
3926  }
3927  fProfileContainingMaterialBudgetWeights = (TProfile*)file->Get(nameProfile.Data());
3929  AliError(Form("Histogram %s not found in file",nameProfile.Data()));
3930  return kFALSE;
3931  }
3932  fProfileContainingMaterialBudgetWeights->SetDirectory(0);
3933  file->Close();
3934  delete file;
3935 
3937  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()));
3938  return kTRUE;
3939 }
3940 
3943 
3944  Float_t weight = 1.0;
3945  Float_t gammaConversionRadius = gamma->GetConversionRadius();
3946  Int_t bin = fProfileContainingMaterialBudgetWeights->FindBin(gammaConversionRadius);
3947  if (bin > 0 && bin <= fProfileContainingMaterialBudgetWeights->GetNbinsX()){
3948  weight = fProfileContainingMaterialBudgetWeights->GetBinContent(bin);
3949  }
3950  return weight;
3951 }
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