AliPhysics  32e057f (32e057f)
AliConversionCuts.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Authors: Svein Lindal, Daniel Lohner *
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 all kinds of selection cuts for
19 // Gamma Conversion analysis
20 //---------------------------------------------
22 
23 //***********************************************************************************
24 //***********************************************************************************
25 //***********************************************************************************
26 //***********************************************************************************
27 //***********************************************************************************
28 // WARNING: this class is no longer supported,
29 // please use AliConversionPhotonCuts and AliConvEventCuts
30 //***********************************************************************************
31 //***********************************************************************************
32 //***********************************************************************************
33 //***********************************************************************************
34 //***********************************************************************************
35 #include "AliConversionCuts.h"
36 
37 #include "AliKFVertex.h"
38 #include "AliAODTrack.h"
39 #include "AliESDtrack.h"
40 #include "AliAnalysisManager.h"
41 #include "AliInputEventHandler.h"
42 #include "AliMCEventHandler.h"
43 #include "AliAODHandler.h"
44 #include "AliPIDResponse.h"
45 #include "TH1.h"
46 #include "TH2.h"
47 #include "TF1.h"
48 #include "AliMCEvent.h"
49 #include "AliAODConversionMother.h"
50 #include "TObjString.h"
51 #include "AliAODEvent.h"
52 #include "AliESDEvent.h"
53 #include "AliCentrality.h"
54 #include "AliMultSelection.h"
55 #include "TList.h"
56 #include "TFile.h"
57 #include "AliLog.h"
58 #include "AliGenCocktailEventHeader.h"
59 #include "AliGenDPMjetEventHeader.h"
60 #include "AliGenPythiaEventHeader.h"
61 #include "AliGenHijingEventHeader.h"
62 #include "AliTriggerAnalysis.h"
63 #include "AliV0ReaderV1.h"
64 #include "AliAODMCParticle.h"
65 #include "AliAODMCHeader.h"
66 #include "AliTRDTriggerAnalysis.h"
67 
68 class iostream;
69 
70 using namespace std;
71 
72 ClassImp(AliConversionCuts)
73 
74 //***********************************************************************************
75 //***********************************************************************************
76 //***********************************************************************************
77 //***********************************************************************************
78 //***********************************************************************************
79 // WARNING: this class is no longer supported,
80 // please use AliConversionPhotonCuts and AliConvEventCuts
81 //***********************************************************************************
82 //***********************************************************************************
83 //***********************************************************************************
84 //***********************************************************************************
85 //***********************************************************************************
86 
87 const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
88  "HeavyIon",//0
89  "CentralityMin",//1
90  "CentralityMax",//2
91  "SelectSpecialTrigger",//3
92  "SelectSpecialSubTriggerClass",//4
93  "RemovePileUp",//5
94  "RejectExtraSignals",//6
95  "V0FinderType",//7
96  "EtaCut",//8
97  "MinRCut",//9
98  "SinglePtCut",//10
99  "ClsTPCCut", //11
100  "ededxSigmaCut",//12
101  "pidedxSigmaCut",//13
102  "piMomdedxSigmaCut",//14
103  "piMaxMomdedxSigmaCut",//15
104  "LowPRejectionSigmaCut",//16
105  "TOFelectronPID",//17
106  "QtMaxCut",//18
107  "Chi2GammaCut", //19
108  "PsiPair", //20
109  "DoPhotonAsymmetryCut",//21
110  "CosinePointingAngle", //22
111  "SharedElectronCuts", //23
112  "RejectToCloseV0s", //24
113  "DcaRPrimVtx", //25
114  "DcaZPrimVtx", //26
115  "EvetPlane" //27
116 };
117 
118 
119 //________________________________________________________________________
120 AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
121  AliAnalysisCuts(name,title),
122  fHistograms(NULL),
123  fHeaderList(NULL),
124  fPIDResponse(NULL),
125  fEventQuality(-1),
126  fMaxR(200),
127  fMinR(0),
128  fEtaCut(0.9),
129  fEtaCutMin(-0.1),
130  fPtCut(0.02),
131  fSinglePtCut(0),
132  fMaxZ(1000),
133  fMinClsTPC(0.),
134  fMinClsTPCToF(0.),
135  fLineCutZRSlope(0.),
136  fLineCutZValue(0),
137  fLineCutZRSlopeMin(0.),
138  fLineCutZValueMin(0),
139  fChi2CutConversion(1000),
140  fPIDProbabilityCutNegativeParticle(0),
141  fPIDProbabilityCutPositiveParticle(0),
142  fDodEdxSigmaCut(kTRUE),
143  fDoTOFsigmaCut(kFALSE),
144  fPIDTRDEfficiency(1),
145  fDoTRDPID(kFALSE),
146  fPIDnSigmaAboveElectronLine(100),
147  fPIDnSigmaBelowElectronLine(-100),
148  fTofPIDnSigmaAboveElectronLine(100),
149  fTofPIDnSigmaBelowElectronLine(-100),
150  fPIDnSigmaAbovePionLine(0),
151  fPIDnSigmaAbovePionLineHighPt(-100),
152  fPIDMinPnSigmaAbovePionLine(0),
153  fPIDMaxPnSigmaAbovePionLine(0),
154  fDoKaonRejectionLowP(kFALSE),
155  fDoProtonRejectionLowP(kFALSE),
156  fDoPionRejectionLowP(kFALSE),
157  fPIDnSigmaAtLowPAroundKaonLine(0),
158  fPIDnSigmaAtLowPAroundProtonLine(0),
159  fPIDnSigmaAtLowPAroundPionLine(0),
160  fPIDMinPKaonRejectionLowP(1.5),
161  fPIDMinPProtonRejectionLowP(2),
162  fPIDMinPPionRejectionLowP(0),
163  fDoQtGammaSelection(kTRUE),
164  fDo2DQt(kFALSE),
165  fQtMax(100),
166  fXVertexCut(0.),
167  fYVertexCut(0.),
168  fZVertexCut(0.),
169  fNSigmaMass(0.),
170  fUseEtaMinCut(kFALSE),
171  fUseOnFlyV0Finder(kTRUE),
172  fDoPhotonAsymmetryCut(kTRUE),
173  fMinPPhotonAsymmetryCut(100.),
174  fMinPhotonAsymmetry(0.),
175  fIsHeavyIon(0),
176  fDetectorCentrality(0),
177  fModCentralityClass(0),
178  fMaxVertexZ(10),
179  fCentralityMin(0),
180  fCentralityMax(0),
181  fUseCorrectedTPCClsInfo(kFALSE),
182  fUseTOFpid(kFALSE),
183  fMultiplicityMethod(0),
184  fSpecialTrigger(0),
185  fSpecialSubTrigger(0),
186  fRemovePileUp(kFALSE),
187  fOpeningAngle(0.005),
188  fPsiPairCut(10000),
189  fDo2DPsiPairChi2(kFALSE),
190  fCosPAngleCut(10000),
191  fDoToCloseV0sCut(kFALSE),
192  fRejectExtraSignals(0),
193  fminV0Dist(200.),
194  fDoSharedElecCut(kFALSE),
195  fDoPhotonQualitySelectionCut(kFALSE),
196  fPhotonQualityCut(0),
197  fOfflineTriggerMask(0),
198  fHasV0AND(kTRUE),
199  fIsSDDFired(kTRUE),
200  fRandom(0),
201  fElectronArraySize(500),
202  fElectronLabelArray(NULL),
203  fDCAZPrimVtxCut(1000),
204  fDCARPrimVtxCut(1000),
205  fInPlaneOutOfPlane(0),
206  fConversionPointXArray(0.0),
207  fConversionPointYArray(0.0),
208  fConversionPointZArray(0.0),
209  fnHeaders(0),
210  fNotRejectedStart(NULL),
211  fNotRejectedEnd(NULL),
212  fGeneratorNames(NULL),
213  fCutString(NULL),
214  fCutStringRead(""),
215  fUtils(NULL),
216  fEtaShift(0.0),
217  fDoEtaShift(kFALSE),
218  fDoReweightHistoMCPi0(kFALSE),
219  fDoReweightHistoMCEta(kFALSE),
220  fDoReweightHistoMCK0s(kFALSE),
221  fPathTrFReweighting(""),
222  fNameHistoReweightingPi0(""),
223  fNameHistoReweightingEta(""),
224  fNameHistoReweightingK0s(""),
225  fNameFitDataPi0(""),
226  fNameFitDataEta(""),
227  fNameFitDataK0s(""),
228  hEtaDistV0s(NULL),
229  hEtaDistV0sAfterdEdxCuts(NULL),
230  hdEdxCuts(NULL),
231  hTPCdEdxbefore(NULL),
232  hTPCdEdxafter(NULL),
233  hTPCdEdxSigbefore(NULL),
234  hTPCdEdxSigafter(NULL),
235  hTOFbefore(NULL),
236  hTOFSigbefore(NULL),
237  hTOFSigafter(NULL),
238  hPsiPairDeltaPhiafter(NULL),
239  hTrackCuts(NULL),
240  hPhotonCuts(NULL),
241  hInvMassbefore(NULL),
242  hArmenterosbefore(NULL),
243  hInvMassafter(NULL),
244  hArmenterosafter(NULL),
245  hAcceptanceCuts(NULL),
246  hCutIndex(NULL),
247  hV0EventCuts(NULL),
248  hCentrality(NULL),
249  hCentralityVsNumberOfPrimaryTracks(NULL),
250  hVertexZ(NULL),
251  hEventPlanePhi(NULL),
252  hTriggerClass(NULL),
253  hTriggerClassSelected(NULL),
254  hReweightMCHistPi0(NULL),
255  hReweightMCHistEta(NULL),
256  hReweightMCHistK0s(NULL),
257  fFitDataPi0(NULL),
258  fFitDataEta(NULL),
259  fFitDataK0s(NULL),
260  fAddedSignalPDGCode(0),
261  fPreSelCut(kFALSE),
262  fTriggerSelectedManually(kFALSE),
263  fSpecialTriggerName(""),
264  fSpecialSubTriggerName(""),
265  fNSpecialSubTriggerOptions(0)
266 
267 {
268  InitPIDResponse();
269  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
270  fCutString=new TObjString((GetCutNumber()).Data());
271 
273  fUtils = new AliAnalysisUtils();
274  //if you do not want to apply the cut on the distance between the SPD and TRK vertex:
275  //fUtils->SetCutOnZVertexSPD(kFALSE);
276 
277 
278 }
279 
280 //________________________________________________________________________
282  AliAnalysisCuts(ref),
283  fHistograms(NULL),
285  fPIDResponse(NULL),
287  fMaxR(ref.fMaxR),
288  fMinR(ref.fMinR),
289  fEtaCut(ref.fEtaCut),
290  fEtaCutMin(ref.fEtaCutMin),
291  fPtCut(ref.fPtCut),
293  fMaxZ(ref.fMaxZ),
294  fMinClsTPC(ref.fMinClsTPC),
306  fDoTRDPID(ref.fDoTRDPID),
325  fDo2DQt(ref.fDo2DQt),
326  fQtMax(ref.fQtMax),
343  fUseTOFpid(ref.fUseTOFpid),
354  fminV0Dist(ref.fminV0Dist),
359  fHasV0AND(ref.fHasV0AND),
361  fRandom(ref.fRandom),
363  fElectronLabelArray(NULL),
370  fnHeaders(ref.fnHeaders),
371  fNotRejectedStart(NULL),
372  fNotRejectedEnd(NULL),
374  fCutString(NULL),
375  fCutStringRead(""),
376  fUtils(NULL),
377  fEtaShift(ref.fEtaShift),
389  hEtaDistV0s(NULL),
391  hdEdxCuts(NULL),
392  hTPCdEdxbefore(NULL),
393  hTPCdEdxafter(NULL),
394  hTPCdEdxSigbefore(NULL),
395  hTPCdEdxSigafter(NULL),
396  hTOFbefore(NULL),
397  hTOFSigbefore(NULL),
398  hTOFSigafter(NULL),
399  hPsiPairDeltaPhiafter(NULL),
400  hTrackCuts(NULL),
401  hPhotonCuts(NULL),
402  hInvMassbefore(NULL),
403  hArmenterosbefore(NULL),
404  hInvMassafter(NULL),
405  hArmenterosafter(NULL),
406  hAcceptanceCuts(NULL),
407  hCutIndex(NULL),
408  hV0EventCuts(NULL),
409  hCentrality(NULL),
411  hVertexZ(NULL),
412  hEventPlanePhi(NULL),
413  hTriggerClass(NULL),
414  hTriggerClassSelected(NULL),
422  fPreSelCut(ref.fPreSelCut),
427 {
428  // Copy Constructor
429  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
430  fCutString=new TObjString((GetCutNumber()).Data());
432  fUtils = new AliAnalysisUtils();
433  // dont copy histograms (if you like histograms, call InitCutHistograms())
434 
435 }
436 
437 
438 //________________________________________________________________________
440  // Destructor
441  //Deleting fHistograms leads to seg fault it it's added to output collection of a task
442  // if(fHistograms)
443  // delete fHistograms;
444  // fHistograms = NULL;
445  if(fCutString != NULL){
446  delete fCutString;
447  fCutString = NULL;
448  }
450  delete fElectronLabelArray;
451  fElectronLabelArray = NULL;
452  }
453  if(fNotRejectedStart){
454  delete[] fNotRejectedStart;
455  fNotRejectedStart = NULL;
456  }
457  if(fNotRejectedEnd){
458  delete[] fNotRejectedEnd;
459  fNotRejectedEnd = NULL;
460  }
461  if(fGeneratorNames){
462  delete[] fGeneratorNames;
463  fGeneratorNames = NULL;
464  }
465  if(fUtils){
466  delete fUtils;
467  fUtils = NULL;
468  }
469 
470 }
471 
472 //________________________________________________________________________
474 
475  // Initialize Cut Histograms for QA (only initialized and filled if function is called)
476  TH1::AddDirectory(kFALSE);
477 
478  if(fHistograms != NULL){
479  delete fHistograms;
480  fHistograms=NULL;
481  }
482  if(fHistograms==NULL){
483  fHistograms=new TList();
484  fHistograms->SetOwner(kTRUE);
485  if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
486  else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
487  }
488 
489  if (hReweightMCHistPi0){
490  hReweightMCHistPi0->SetName("MCInputForWeightingPi0");
492  }
493  if (hReweightMCHistEta){
494  hReweightMCHistEta->SetName("MCInputForWeightingEta");
496  }
497  if (hReweightMCHistK0s){
498  hReweightMCHistK0s->SetName("MCInputForWeightingK0s");
500  }
501 // if (fFitDataPi0){
502 // fFitDataPi0->SetName("DataFitForWeightingPi0");
503 // fHistograms->Add(fFitDataPi0);
504 // }
505 // if (fFitDataEta){
506 // fFitDataEta->SetName("DataFitForWeightingEta");
507 // fHistograms->Add(fFitDataEta);
508 // }
509 // if (fFitDataK0s){
510 // fFitDataK0s->SetName("DataFitForWeightingK0s");
511 // fHistograms->Add(fFitDataK0s);
512 // }
513  // IsPhotonSelected
514  hCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",11,-0.5,10.5);
515  hCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
516  hCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
517  hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
518  hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
519  hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
520  hCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
521  hCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
522  hCutIndex->GetXaxis()->SetBinLabel(kEventPlane+1,"EventPlane");
523  hCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
524  fHistograms->Add(hCutIndex);
525 
526  // Track Cuts
527  hTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
528  hTrackCuts->GetXaxis()->SetBinLabel(1,"in");
529  hTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
530  hTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
531  hTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
532  hTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
533  hTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
534  hTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
535  hTrackCuts->GetXaxis()->SetBinLabel(8,"out");
536  fHistograms->Add(hTrackCuts);
537 
538  // Photon Cuts
539  hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",15,-0.5,14.5);
540  hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
541  hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
542  hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
543  hPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
544  hPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
545  hPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
546  hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
547  hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
548  hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
549  hPhotonCuts->GetXaxis()->SetBinLabel(10,"DCA R");
550  hPhotonCuts->GetXaxis()->SetBinLabel(11,"DCA Z");
551  hPhotonCuts->GetXaxis()->SetBinLabel(12,"Photon Quality");
552  hPhotonCuts->GetXaxis()->SetBinLabel(13,"out");
553  fHistograms->Add(hPhotonCuts);
554 
555  if(preCut){
556  hInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
558  hArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
560  hEtaDistV0s = new TH1F(Form("Eta_before %s",GetCutNumber().Data()),"Eta_before",2000,-2,2);
561  fHistograms->Add(hEtaDistV0s);
562 
563  }
564  hInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
566  hArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
568 
569  hAcceptanceCuts=new TH1F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts",10,-0.5,9.5);
570  hAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
571  hAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
572  hAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
573  hAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
574  hAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
575  hAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
576  hAcceptanceCuts->GetXaxis()->SetBinLabel(7,"minpt");
577  hAcceptanceCuts->GetXaxis()->SetBinLabel(8,"out");
579 
580  // dEdx Cuts
581  hdEdxCuts=new TH1F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts",10,-0.5,9.5);
582  hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
583  hdEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
584  hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
585  hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
586  hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
587  hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
588  hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
589  hdEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
590  hdEdxCuts->GetXaxis()->SetBinLabel(9,"TRDelectron");
591  hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
592  fHistograms->Add(hdEdxCuts);
593 
594  TAxis *AxisBeforedEdx = NULL;
595  TAxis *AxisBeforedEdxSig = NULL;
596  TAxis *AxisBeforeTOF = NULL;
597  TAxis *AxisBeforeTOFSig = NULL;
598  if(preCut){
599  hTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
601  AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
602  hTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
604  AxisBeforedEdxSig = hTPCdEdxSigbefore->GetXaxis();
605 
606  hTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
607  fHistograms->Add(hTOFbefore);
608  AxisBeforeTOF = hTOFbefore->GetXaxis();
609  hTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
611  AxisBeforeTOFSig = hTOFSigbefore->GetXaxis();
612 
613  }
614  hTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
616 
617  hTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
619 
620  hTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
622 
623  hEtaDistV0sAfterdEdxCuts = new TH1F(Form("Eta_afterdEdx %s",GetCutNumber().Data()),"Eta_afterdEdx",2000,-2,2);
625 
626  hPsiPairDeltaPhiafter=new TH2F(Form("Gamma_PsiPairDeltaPhi_after %s",GetCutNumber().Data()),"Psi Pair vs Delta Phi Gamma after" ,200,-2,2,200,-2,2);
628 
629  TAxis *AxisAfter = hTPCdEdxSigafter->GetXaxis();
630  Int_t bins = AxisAfter->GetNbins();
631  Double_t from = AxisAfter->GetXmin();
632  Double_t to = AxisAfter->GetXmax();
633  Double_t *newBins = new Double_t[bins+1];
634  newBins[0] = from;
635  Double_t factor = TMath::Power(to/from, 1./bins);
636  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
637  AxisAfter->Set(bins, newBins);
638  AxisAfter = hTOFSigafter->GetXaxis();
639  AxisAfter->Set(bins, newBins);
640  AxisAfter = hTPCdEdxafter->GetXaxis();
641  AxisAfter->Set(bins, newBins);
642  if(preCut){
643  AxisBeforedEdx->Set(bins, newBins);
644  AxisBeforeTOF->Set(bins, newBins);
645  AxisBeforedEdxSig->Set(bins, newBins);
646  AxisBeforeTOFSig->Set(bins, newBins);
647  }
648  delete [] newBins;
649 
650  hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",100,0,100);
651  fHistograms->Add(hCentrality);
652  hCentralityVsNumberOfPrimaryTracks=new TH2F(Form("Centrality vs Primary Tracks %s",GetCutNumber().Data()),"Centrality vs Primary Tracks ",100,0,100,4000,0,4000);
654 
655  // Event Cuts and Info
656  if(preCut){
657  hV0EventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",7,-0.5,6.5);
658  hV0EventCuts->GetXaxis()->SetBinLabel(1,"in");
659  hV0EventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
660  hV0EventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
661  hV0EventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
662  hV0EventCuts->GetXaxis()->SetBinLabel(5,"pileup");
663  hV0EventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
664  hV0EventCuts->GetXaxis()->SetBinLabel(7,"out");
666 
667  hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
668  fHistograms->Add(hVertexZ);
669 
670  hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",35,-0.5,34.5);
671  hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
672  hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
673  hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
674  hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
675  hTriggerClass->GetXaxis()->SetBinLabel( 5,"kKEMC1");
676  hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
677  hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
678  hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
679  hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
680  hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
681  hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
682  hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
683  hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
684  hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
685  hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
686  hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
687  hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
688  hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
689  hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
690  hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
691  hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
692  hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
693  hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
694  hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
695  hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
696  hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
697  hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
698  hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
699  hTriggerClass->GetXaxis()->SetBinLabel(29,"kTRD");
700  hTriggerClass->GetXaxis()->SetBinLabel(30,"kFastOnly");
701  hTriggerClass->GetXaxis()->SetBinLabel(31,"kAnyINT");
702  hTriggerClass->GetXaxis()->SetBinLabel(32,"kAny");
703  hTriggerClass->GetXaxis()->SetBinLabel(33,"V0AND");
704  hTriggerClass->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
705  hTriggerClass->GetXaxis()->SetBinLabel(35,"failed Physics Selection");
707  }
708  if(!preCut){
709  hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",34,-0.5,33.5);
710  hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB");
711  hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7");
712  hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON");
713  hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult");
714  hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kKEMC1");
715  hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5");
716  hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
717  hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
718  hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
719  hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
720  hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
721  hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7");
722  hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1");
723  hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
724  hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE");
725  hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA");
726  hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral");
727  hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral");
728  hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5");
729  hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED");
730  hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
731  hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8");
732  hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
733  hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
734  hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
735  hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
736  hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
737  hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined");
738  hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kTRD");
739  hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kFastOnly");
740  hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAnyINT");
741  hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"kAny");
742  hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"V0AND");
743  hTriggerClassSelected->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
745 
746  hEventPlanePhi=new TH1F(Form("EventPlaneMinusPhotonAngle %s",GetCutNumber().Data()),"EventPlaneMinusPhotonAngle",360,-TMath::Pi(),TMath::Pi());
748 
749 
750  }
751  TH1::AddDirectory(kTRUE);
752 }
753 
754 //________________________________________________________________________
756  // Set Pointer to AliPIDResponse
757 
758  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
759  if(man) {
760  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
761  fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
762  if(fPIDResponse)return kTRUE;
763 
764  }
765 
766 
767  return kFALSE;
768 }
770 Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliMCEvent *fMCEvent){
771  // Process Event Selection
772 
773  Int_t cutindex=0;
774  if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
775  cutindex++;
776 
777  // Check for MC event
778  if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
779  // Check if MC event is correctly loaded
780  AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
781  if (!mcHandler){
782  fEventQuality = 2;
783  return kFALSE;
784  }
785  if (!mcHandler->InitOk() ){
786  fEventQuality = 2;
787  return kFALSE;
788  }
789  if (!mcHandler->TreeK() ){
790  fEventQuality = 2;
791  return kFALSE;
792  }
793  if (!mcHandler->TreeTR() ) {
794  fEventQuality = 2;
795  return kFALSE;
796  }
797  }
798 
799  // Event Trigger
800 // cout << "before event trigger" << endl;
801  if(!IsTriggerSelected(fInputEvent)){
802  if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
803  fEventQuality = 3;
804  return kFALSE;
805  }
806  cutindex++;
807 
808  if(fInputEvent->IsA()==AliESDEvent::Class()){
809  AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
810  fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
811  if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(32);
812  }
813 // cout << "event number " << ((AliESDEvent*)fInputEvent)->GetEventNumberInFile() << " entered"<< endl;
814 
815 
816  // Number of Contributors Cut
817  if(GetNumberOfContributorsVtx(fInputEvent)<=0) {
818  if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
819  fEventQuality = 5;
820  return kFALSE;
821  }
822  cutindex++;
823 
824  // Z Vertex Position Cut
825  if(!VertexZCut(fInputEvent)){
826  if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
827  fEventQuality = 4;
828  return kFALSE;
829  }
830  cutindex++;
831 
832  // Pile Up Rejection
833 
834  if(fRemovePileUp){
835  if(fInputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
836  if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
837  fEventQuality = 6;
838  return kFALSE;
839  }
840  }
841  cutindex++;
842 
843  // Centrality Selection
844  if(!IsCentralitySelected(fInputEvent,fMCEvent)){
845  if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
846  fEventQuality = 1;
847  return kFALSE;
848  }
849  cutindex++;
850 
851  // Fill Event Histograms
852  if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
853  if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
854  if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent));
857  ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
858  ->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks());
859  fEventQuality = 0;
860  return kTRUE;
861 }
862 
864 Bool_t AliConversionCuts::PhotonIsSelectedMC(TParticle *particle,AliMCEvent *mcEvent,Bool_t checkForConvertedGamma){
865  // MonteCarlo Photon Selection
866 
867  if(!mcEvent)return kFALSE;
868 
869  if (particle->GetPdgCode() == 22){
870 
871 
872  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
873  return kFALSE;
874  if(fEtaCutMin>-0.1){
875  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
876  return kFALSE;
877  }
878 
879  if(particle->GetMother(0) >-1 && mcEvent->Particle(particle->GetMother(0))->GetPdgCode() == 22){
880  return kFALSE; // no photon as mothers!
881  }
882 
883  if(particle->GetMother(0) >= mcEvent->GetNumberOfPrimaries()){
884  return kFALSE; // the gamma has a mother, and it is not a primary particle
885  }
886 
887  if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
888 
889  // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
890  TParticle* ePos = NULL;
891  TParticle* eNeg = NULL;
892 
893  if(particle->GetNDaughters() >= 2){
894  for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
895  TParticle *tmpDaughter = mcEvent->Particle(daughterIndex);
896  if(tmpDaughter->GetUniqueID() == 5){
897  if(tmpDaughter->GetPdgCode() == 11){
898  eNeg = tmpDaughter;
899  } else if(tmpDaughter->GetPdgCode() == -11){
900  ePos = tmpDaughter;
901  }
902  }
903  }
904  }
905 
906  if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
907  return kFALSE;
908  }
909 
910  if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
911  return kFALSE; // no reconstruction below the Pt cut
912  }
913 
914  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
915  eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
916  return kFALSE;
917 
918  if(fEtaCutMin > -0.1){
919  if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
920  (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
921  return kFALSE;
922  }
923 
924  if(ePos->R()>fMaxR){
925  return kFALSE; // cuts on distance from collision point
926  }
927 
928  if(TMath::Abs(ePos->Vz()) > fMaxZ){
929  return kFALSE; // outside material
930  }
931  if(TMath::Abs(eNeg->Vz()) > fMaxZ){
932  return kFALSE; // outside material
933  }
934 
935  if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
936  return kFALSE; // line cut to exclude regions where we do not reconstruct
937  } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((TMath::Abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
938  return kFALSE;
939  }
940 
941  if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
942  return kFALSE; // line cut to exclude regions where we do not reconstruct
943  } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((TMath::Abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
944  return kFALSE;
945  }
946 
947  return kTRUE;
948  //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
949  }
950  return kFALSE;
951 }
953 Bool_t AliConversionCuts::PhotonIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){
954  // MonteCarlo Photon Selection
955 
956  if(!aodmcArray)return kFALSE;
957 
958  if (particle->GetPdgCode() == 22){
959  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
960  return kFALSE;
961  if(fEtaCutMin>-0.1){
962  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
963  return kFALSE;
964  }
965 
966  if(particle->GetMother() > -1){
967  if((static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
968  return kFALSE; // no photon as mothers!
969  }
970  if(!(static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother()))->IsPrimary())){
971  return kFALSE; // the gamma has a mother, and it is not a primary particle
972  }
973  }
974 
975  if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
976 
977  // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
978  AliAODMCParticle* ePos = NULL;
979  AliAODMCParticle* eNeg = NULL;
980 
981  if(particle->GetNDaughters() >= 2){
982  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
983  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(aodmcArray->At(daughterIndex));
984  if(!tmpDaughter) continue;
985  if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
986  if(tmpDaughter->GetPdgCode() == 11){
987  eNeg = tmpDaughter;
988  } else if(tmpDaughter->GetPdgCode() == -11){
989  ePos = tmpDaughter;
990  }
991  }
992  }
993  }
994 
995  if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
996  return kFALSE;
997  }
998 
999  if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
1000  return kFALSE; // no reconstruction below the Pt cut
1001  }
1002 
1003  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
1004  eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
1005  return kFALSE;
1006 
1007  if(fEtaCutMin > -0.1){
1008  if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
1009  (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
1010  return kFALSE;
1011  }
1012 
1013  Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) );
1014  Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) );
1015 
1016  if(rPos>fMaxR){
1017  return kFALSE; // cuts on distance from collision point
1018  }
1019  if(TMath::Abs(ePos->Zv()) > fMaxZ){
1020  return kFALSE; // outside material
1021  }
1022  if(TMath::Abs(eNeg->Zv()) > fMaxZ){
1023  return kFALSE; // outside material
1024  }
1025 
1026  if( rPos <= ((TMath::Abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
1027  return kFALSE; // line cut to exclude regions where we do not reconstruct
1028  } else if ( fEtaCutMin != -0.1 && rPos >= ((TMath::Abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
1029  return kFALSE;
1030  }
1031 
1032  if( rNeg <= ((TMath::Abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
1033  return kFALSE; // line cut to exclude regions where we do not reconstruct
1034  } else if ( fEtaCutMin != -0.1 && rNeg >= ((TMath::Abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
1035  return kFALSE;
1036  }
1037 
1038  return kTRUE;
1039  //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
1040  }
1041  return kFALSE;
1042 }
1045 { // Specific Photon Cuts
1046 
1047  Int_t cutIndex = 0;
1048  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex);
1049  cutIndex++;
1050 
1051  // Fill Histos before Cuts
1052  if(hInvMassbefore)hInvMassbefore->Fill(photon->GetMass());
1054 
1055  // Gamma selection based on QT from Armenteros
1056  if(fDoQtGammaSelection == kTRUE){
1057  if(!ArmenterosQtCut(photon)){
1058  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //1
1059  return kFALSE;
1060  }
1061  }
1062  cutIndex++; //2
1063 
1064  // Chi Cut
1065  if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
1066  {
1067  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //2
1068  return kFALSE;
1069  }
1070  }
1071  cutIndex++;//3
1072 
1073  // Reconstruction Acceptance Cuts
1074  if(!AcceptanceCuts(photon)){
1075  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //3
1076  return kFALSE;
1077  }
1078 
1079  cutIndex++; //4
1080  // Asymmetry Cut
1081  if(fDoPhotonAsymmetryCut == kTRUE){
1082  if(!AsymmetryCut(photon,event)){
1083  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //4
1084  return kFALSE;
1085  }
1086  }
1087 
1088  //Check the pid probability
1089  cutIndex++; //5
1090  if(!PIDProbabilityCut(photon, event)) {
1091  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //5
1092  return kFALSE;
1093  }
1094 
1095  cutIndex++; //6
1096  if(!CorrectedTPCClusterCut(photon, event)) {
1097  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //6
1098  return kFALSE;
1099  }
1100 
1101  Double_t magField = event->GetMagneticField();
1102  if( magField < 0.0 ){
1103  magField = 1.0;
1104  } else {
1105  magField = -1.0;
1106  }
1107 
1108  AliVTrack * electronCandidate = GetTrack(event,photon->GetTrackLabelNegative() );
1109  AliVTrack * positronCandidate = GetTrack(event,photon->GetTrackLabelPositive() );
1110  Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->Phi()-positronCandidate->Phi());
1111 
1112  cutIndex++; //7
1113  if(!PsiPairCut(photon)) {
1114  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //7
1115  return kFALSE;
1116  }
1117 
1118  cutIndex++; //8
1119  if(!CosinePAngleCut(photon, event)) {
1120  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //8
1121  return kFALSE;
1122  }
1123 
1124  AliAODConversionPhoton* photonAOD = dynamic_cast<AliAODConversionPhoton*>(photon);
1125  if (photonAOD){
1126  photonAOD->CalculateDistanceOfClossetApproachToPrimVtx(event->GetPrimaryVertex());
1127 
1128  cutIndex++; //9
1129  if(photonAOD->GetDCArToPrimVtx() > fDCARPrimVtxCut) { //DCA R cut of photon to primary vertex
1130  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
1131  return kFALSE;
1132  }
1133 
1134  cutIndex++; //10
1135  if(TMath::Abs(photonAOD->GetDCAzToPrimVtx()) > fDCAZPrimVtxCut) { //DCA Z cut of photon to primary vertex
1136  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //10
1137  return kFALSE;
1138  }
1139  } else {
1140  cutIndex++; //9
1141  cutIndex++; //10
1142  }
1143  cutIndex++; //11
1144 
1145  if (photonAOD){
1146  UChar_t photonQuality = 0;
1147  AliAODEvent * aodEvent = dynamic_cast<AliAODEvent*>(event);
1148  if(aodEvent) {
1149  photonQuality = DeterminePhotonQualityAOD(photonAOD, event);
1150  } else {
1151  photonQuality = photonAOD->GetPhotonQuality();
1152  }
1153  if (fDoPhotonQualitySelectionCut && photonQuality != fPhotonQualityCut){
1154  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //11
1155  return kFALSE;
1156  }
1157  }
1158  cutIndex++; //12
1159  if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //11
1160 
1161  // Histos after Cuts
1162  if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
1164  if(hPsiPairDeltaPhiafter)hPsiPairDeltaPhiafter->Fill(deltaPhi,photon->GetPsiPair());
1165  return kTRUE;
1166 
1167 }
1168 
1171 { //Cut on corrected TPC Cluster Info
1172 
1173  AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1174  AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1175 
1176  if(!negTrack||!posTrack)return kFALSE;
1177 
1178  Double_t negclsToF=0;
1179 
1180  if (!fUseCorrectedTPCClsInfo ){
1181  if(negTrack->GetTPCNclsF()!=0){
1182  negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
1183  }
1184  else {
1185  negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1186  }
1187 
1188  Double_t posclsToF = 0.;
1189  if (!fUseCorrectedTPCClsInfo ){
1190  if(posTrack->GetTPCNclsF()!=0){
1191  posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
1192  }
1193  }else{
1194  posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1195  }
1196 
1197  if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
1198  return kFALSE;
1199  }
1200 
1201  return kTRUE;
1202 }
1203 
1206 {
1207  //Selection of Reconstructed Photons
1208 
1210 
1211  if(event->IsA()==AliESDEvent::Class()) {
1212  if(!SelectV0Finder( ( ((AliESDEvent*)event)->GetV0(photon->GetV0Index()))->GetOnFlyStatus() ) ){
1214  return kFALSE;
1215  }
1216  }
1217  // else if(event->IsA()==AliAODEvent::Class()) {
1218  // if(!SelectV0Finder( ( ((AliAODEvent*)event)->GetV0(photon->GetV0Index())) ) ){
1219  // FillPhotonCutIndex(kOnFly);
1220  // return kFALSE;
1221  // }
1222  // }
1223 
1224  // Get Tracks
1225  AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1226  AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1227 
1228  if(!negTrack || !posTrack) {
1230  return kFALSE;
1231  }
1232  photon->DeterminePhotonQuality(negTrack,posTrack);
1233  // Track Cuts
1234  if(!TracksAreSelected(negTrack, posTrack)){
1236  return kFALSE;
1237  }
1238  if (hEtaDistV0s)hEtaDistV0s->Fill(photon->GetPhotonEta());
1239  // dEdx Cuts
1240  if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
1242  return kFALSE;
1243  }
1245  // Photon Cuts
1246  if(!PhotonCuts(photon,event)){
1248  return kFALSE;
1249  }
1250 
1251  // Photon passed cuts
1253  return kTRUE;
1254 }
1255 
1258 { // Armenteros Qt Cut
1259  if(fDo2DQt){
1260  if ( !(TMath::Power(photon->GetArmenterosAlpha()/0.95,2)+TMath::Power(photon->GetArmenterosQt()/fQtMax,2) < 1) ){
1261  return kFALSE;
1262  }
1263  } else {
1264  if(photon->GetArmenterosQt()>fQtMax){
1265  return kFALSE;
1266  }
1267  }
1268  return kTRUE;
1269 }
1270 
1271 
1274  // Exclude certain areas for photon reconstruction
1275 
1276  Int_t cutIndex=0;
1277  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1278  cutIndex++;
1279 
1280  if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
1281  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1282  return kFALSE;
1283  }
1284  cutIndex++;
1285 
1286  if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
1287  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1288  return kFALSE;
1289  }
1290  cutIndex++;
1291 
1292  if(photon->GetConversionRadius() <= ((TMath::Abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
1293  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1294  return kFALSE;
1295  }
1296  else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((TMath::Abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1297  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1298  return kFALSE;
1299  }
1300  cutIndex++;
1301 
1302  if(TMath::Abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1303  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1304  return kFALSE;
1305  }
1306  cutIndex++;
1307 
1308 
1309  if( photon->GetPhotonEta() > (fEtaCut) || photon->GetPhotonEta() < (-fEtaCut) ){
1310  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1311  return kFALSE;
1312  }
1313  if(fEtaCutMin>-0.1){
1314  if( photon->GetPhotonEta() < (fEtaCutMin) && photon->GetPhotonEta() > (-fEtaCutMin) ){
1315  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1316  return kFALSE;
1317  }
1318  }
1319  cutIndex++;
1320 
1321  if(photon->GetPhotonPt()<fPtCut){
1322  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1323  return kFALSE;
1324  }
1325  cutIndex++;
1326 
1327  if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1328 
1329  return kTRUE;
1330 }
1331 
1332 
1334 Bool_t AliConversionCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
1335  // Track Cuts which require AOD/ESD specific implementation
1336 
1337  if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1338  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1339  return kFALSE;
1340  }
1341  cutIndex++;
1342 
1343  AliAODVertex * NegVtxType=negTrack->GetProdVertex();
1344  AliAODVertex * PosVtxType=posTrack->GetProdVertex();
1345  if( (NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
1346  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1347  return kFALSE;
1348  }
1349  return kTRUE;
1350 
1351 }
1352 
1353 
1355 Bool_t AliConversionCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
1356  // Track Cuts which require AOD/ESD specific implementation
1357 
1358  if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1359  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1360  return kFALSE;
1361  }
1362  cutIndex++;
1363 
1364  if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
1365  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1366  return kFALSE;
1367  }
1368  return kTRUE;
1369 }
1370 
1371 
1372 
1374 Bool_t AliConversionCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1375  // Track Selection for Photon Reconstruction
1376 
1377  Int_t cutIndex=0;
1378  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1379  cutIndex++;
1380 
1381  // avoid like sign
1382  if(negTrack->Charge() == posTrack->Charge()) {
1383  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1384  return kFALSE;
1385  }
1386  cutIndex++;
1387 
1388  // Number of TPC Clusters
1389 
1390 
1391  if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1392  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1393  return kFALSE;
1394  }
1395  cutIndex++;
1396 
1397  // Acceptance
1398  if( posTrack->Eta() > (fEtaCut) || posTrack->Eta() < (-fEtaCut) ||
1399  negTrack->Eta() > (fEtaCut) || negTrack->Eta() < (-fEtaCut) ){
1400  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1401  return kFALSE;
1402  }
1403  if(fEtaCutMin>-0.1){
1404  if( (posTrack->Eta() < (fEtaCutMin) && posTrack->Eta() > (-fEtaCutMin)) ||
1405  (negTrack->Eta() < (fEtaCutMin) && negTrack->Eta() > (-fEtaCutMin)) ){
1406  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1407  return kFALSE;
1408  }
1409  }
1410  cutIndex++;
1411 
1412  // Single Pt Cut
1413  if( negTrack->Pt()< fSinglePtCut || posTrack->Pt()< fSinglePtCut){
1414  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1415  return kFALSE;
1416  }
1417  cutIndex++;
1418 
1419  // AOD ESD specific cuts
1420  Bool_t passCuts = kTRUE;
1421 
1422  if(negTrack->IsA()==AliAODTrack::Class()) {
1423  passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1424  } else {
1425  passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1426  }
1427 
1428  if(!passCuts){
1429  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1430  return kFALSE;
1431  }
1432  cutIndex++;
1433 
1434  if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1435 
1436  return kTRUE;
1437 
1438 }
1439 
1441 Bool_t AliConversionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
1442  // Electron Identification Cuts for Photon reconstruction
1443  if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1444  if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1445 
1446  Int_t cutIndex=0;
1447  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1448  if(hTPCdEdxSigbefore)hTPCdEdxSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1449  if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1450  cutIndex++;
1451 
1452  if(fDodEdxSigmaCut == kTRUE){
1453  // TPC Electron Line
1454  if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1455  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
1456 
1457  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1458  return kFALSE;
1459  }
1460  cutIndex++;
1461 
1462  // TPC Pion Line
1463  if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1464  if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1465  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1466  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1467 
1468  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1469  return kFALSE;
1470  }
1471  }
1472  cutIndex++;
1473 
1474  // High Pt Pion rej
1475  if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1476  if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1477  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine &&
1478  fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1479 
1480  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1481  return kFALSE;
1482  }
1483  }
1484  cutIndex++;
1485  }
1486  else{cutIndex+=3;}
1487 
1488  if(fDoKaonRejectionLowP == kTRUE){
1489  if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1490  if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1491 
1492  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1493  return kFALSE;
1494  }
1495  }
1496  }
1497  cutIndex++;
1498  if(fDoProtonRejectionLowP == kTRUE){
1499  if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1500  if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1501 
1502  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1503  return kFALSE;
1504  }
1505  }
1506  }
1507  cutIndex++;
1508 
1509  if(fDoPionRejectionLowP == kTRUE){
1510  if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1511  if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1512 
1513  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1514  return kFALSE;
1515  }
1516  }
1517  }
1518  cutIndex++;
1519 
1520 
1521  // cout<<"Start"<<endl;
1522  // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1523 
1524  // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1525  // {cout<<"TOF DA"<<endl;}
1526  // if(status == AliPIDResponse::kDetPidOk){
1527  // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1528  // cout<<"--> "<<probMis<<endl;
1529  // if(probMis > 0.01){
1530 
1531  // }
1532  // }
1533 
1534  if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1535  if(hTOFbefore){
1536  Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1537  Double_t times[AliPID::kSPECIESC];
1538  fCurrentTrack->GetIntegratedTimes(times,AliPID::kSPECIESC);
1539  Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1540  Double_t dT = TOFsignal - t0 - times[0];
1541  hTOFbefore->Fill(fCurrentTrack->P(),dT);
1542  }
1543  if(hTOFSigbefore) hTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1544  if(fUseTOFpid){
1545  if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1546  fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1547  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1548  return kFALSE;
1549  }
1550  }
1551  if(hTOFSigafter)hTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1552  }
1553  cutIndex++;
1554  // Apply TRD PID
1555  if(fDoTRDPID){
1556  if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1557  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1558  return kFALSE;
1559  }
1560  }
1561  cutIndex++;
1562 
1563  if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1564  if(hTPCdEdxSigafter)hTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1565  if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1566 
1567  return kTRUE;
1568 }
1569 
1572  // Cut on Energy Assymetry
1573 
1574  for(Int_t ii=0;ii<2;ii++){
1575 
1576  AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1577 
1578  if( track->P() > fMinPPhotonAsymmetryCut ){
1579  Double_t trackNegAsy=0;
1580  if (photon->GetPhotonP()!=0.){
1581  trackNegAsy= track->P()/photon->GetPhotonP();
1582  }
1583 
1584  if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1585  return kFALSE;
1586  }
1587  }
1588 
1589  }
1590  return kTRUE;
1591 }
1592 
1594 AliVTrack *AliConversionCuts::GetTrack(AliVEvent * event, Int_t label){
1595  //Returns pointer to the track with given ESD label
1596  //(Important for AOD implementation, since Track array in AOD data is different
1597  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1598 
1599  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1600  if(esdEvent) {
1601  if(label > event->GetNumberOfTracks() ) return NULL;
1602  AliESDtrack * track = esdEvent->GetTrack(label);
1603  return track;
1604 
1605  } else {
1606  AliVTrack * track = 0x0;
1607  if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->AreAODsRelabeled()){
1608  track = dynamic_cast<AliVTrack*>(event->GetTrack(label));
1609  return track;
1610  }
1611  else{
1612  for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1613  track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1614  if(track){
1615  if(track->GetID() == label) {
1616  return track;
1617  }
1618  }
1619  }
1620  }
1621  }
1622  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1623  return NULL;
1624 }
1625 
1627 AliESDtrack *AliConversionCuts::GetESDTrack(AliESDEvent * event, Int_t label){
1628  //Returns pointer to the track with given ESD label
1629  //(Important for AOD implementation, since Track array in AOD data is different
1630  //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1631 
1632  if(event) {
1633  if(label > event->GetNumberOfTracks() ) return NULL;
1634  AliESDtrack * track = event->GetTrack(label);
1635  return track;
1636  }
1637  //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1638  return NULL;
1639 }
1640 
1641 
1642 
1645  // Cut on Electron Probability for Photon Reconstruction
1646 
1647  AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1648 
1649  if(esdEvent){
1650 
1651  Bool_t iResult=kFALSE;
1652 
1653  Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1654  Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1655 
1656  AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1657  AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1658 
1659  if(negProbArray && posProbArray){
1660 
1661  negTrack->GetTPCpid(negProbArray);
1662  posTrack->GetTPCpid(posProbArray);
1663 
1664  if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1665  iResult=kTRUE;
1666  }
1667  }
1668 
1669  delete [] posProbArray;
1670  delete [] negProbArray;
1671  return iResult;
1672 
1673  } else {
1675  return kTRUE;
1676  }
1677 
1678 
1679 
1680 
1681 }
1682 
1683 
1685 Bool_t AliConversionCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1686  // MC Acceptance Cuts
1687  //(Certain areas were excluded for photon reconstruction)
1688 
1689  if(particle->R()>fMaxR){
1690  return kFALSE;}
1691 
1692  if(ePos->R()>fMaxR){
1693  return kFALSE;
1694  }
1695 
1696  if(ePos->R()<fMinR){
1697  return kFALSE;
1698  }
1699 
1700  if( ePos->R() <= ((TMath::Abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1701  return kFALSE;
1702  }
1703  else if (fUseEtaMinCut && ePos->R() >= ((TMath::Abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1704  return kFALSE;
1705  }
1706 
1707  if(TMath::Abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1708  return kFALSE;
1709  }
1710 
1711  if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1712  return kFALSE;
1713  }
1714 
1715  if(TMath::Abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1716  return kFALSE;
1717  }
1718 
1719 
1720  if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) ){
1721  return kFALSE;
1722  }
1723  if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ){
1724  return kFALSE;
1725  }
1726  if( eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) ){
1727  return kFALSE;
1728  }
1729  if(fEtaCutMin>-0.1){
1730  if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) ){
1731  return kFALSE;
1732  }
1733  if( ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin) ){
1734  return kFALSE;
1735  }
1736  if( eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin) ){
1737  return kFALSE;
1738  }
1739  }
1740 
1741  if( ePos->Pt()< fSinglePtCut || eNeg->Pt()< fSinglePtCut){
1742  return kFALSE;
1743  }
1744 
1745  if(particle->Pt()<fPtCut){
1746  return kFALSE;
1747  }
1748 
1749  return kTRUE;
1750 }
1754 
1755  if(fCutString && fCutString->GetString().Length() == kNCuts) {
1756  fCutString->SetString(GetCutNumber());
1757  } else {
1758  return kFALSE;
1759  }
1760  return kTRUE;
1761 }
1764 
1765  AliInfo("Entering loading of histograms for weighting");
1766  TFile *f = TFile::Open(fPathTrFReweighting.Data());
1767  if(!f){
1768  AliError(Form("file for weighting %s not found",fPathTrFReweighting.Data()));
1769  return;
1770  }
1771  if (fNameHistoReweightingPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
1772  cout << "I have to find: " << fNameHistoReweightingPi0.Data() << endl;
1773  TH1D *hReweightMCHistPi0temp = (TH1D*)f->Get(fNameHistoReweightingPi0.Data());
1774  hReweightMCHistPi0 = new TH1D(*hReweightMCHistPi0temp);
1775  if (hReweightMCHistPi0) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingPi0.Data(),fPathTrFReweighting.Data() ));
1776  else AliWarning(Form("%s not found in %s", fNameHistoReweightingPi0.Data() ,fPathTrFReweighting.Data()));
1777  hReweightMCHistPi0->SetDirectory(0);
1778  }
1779  if (fNameFitDataPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
1780  cout << "I have to find: " << fNameFitDataPi0.Data() << endl;
1781  TF1 *fFitDataPi0temp = (TF1*)f->Get(fNameFitDataPi0.Data());
1782  fFitDataPi0 = new TF1(*fFitDataPi0temp);
1783  if (fFitDataPi0) AliInfo(Form("%s has been loaded from %s", fNameFitDataPi0.Data(),fPathTrFReweighting.Data() ));
1784  else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameFitDataPi0.Data() ));
1785  }
1786 
1787  if (fNameHistoReweightingEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
1788  cout << "I have to find: " << fNameHistoReweightingEta.Data() << endl;
1789  TH1D *hReweightMCHistEtatemp = (TH1D*)f->Get(fNameHistoReweightingEta.Data());
1790  hReweightMCHistEta = new TH1D(*hReweightMCHistEtatemp);
1791  if (hReweightMCHistEta) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
1792  else AliWarning(Form("%s not found in %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
1793  hReweightMCHistEta->SetDirectory(0);
1794  }
1795 
1796  if (fNameFitDataEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
1797  cout << "I have to find: " << fNameFitDataEta.Data() << endl;
1798  TF1 *fFitDataEtatemp = (TF1*)f->Get(fNameFitDataEta.Data());
1799  fFitDataEta = new TF1(*fFitDataEtatemp);
1800  if (fFitDataEta) AliInfo(Form("%s has been loaded from %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
1801  else AliWarning(Form("%s not found in %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
1802 
1803  }
1804  if (fNameHistoReweightingK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
1805  cout << "I have to find: " << fNameHistoReweightingK0s.Data() << endl;
1806  TH1D *hReweightMCHistK0stemp = (TH1D*)f->Get(fNameHistoReweightingK0s.Data());
1807  hReweightMCHistK0s = new TH1D(*hReweightMCHistK0stemp);
1808  if (hReweightMCHistK0s) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
1809  else AliWarning(Form("%s not found in %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
1810  hReweightMCHistK0s->SetDirectory(0);
1811  }
1812 
1813  if (fNameFitDataK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
1814  cout << "I have to find: " << fNameFitDataK0s.Data() << endl;
1815  TF1 *fFitDataK0stemp = (TF1*)f->Get(fNameFitDataK0s.Data());
1816  fFitDataK0s = new TF1(*fFitDataK0stemp);
1817  if (fFitDataK0s) AliInfo(Form("%s has been loaded from %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
1818  else AliWarning(Form("%s not found in %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
1819  }
1820  f->Close();
1821  delete f;
1822 
1823 }
1824 
1825 
1828  fCutStringRead = Form("%s",analysisCutSelection.Data());
1829 
1830  // Initialize Cuts from a given Cut string
1832  AliInfo("Weighting was enabled");
1834  }
1835 
1836  AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1837  if(analysisCutSelection.Length()!=kNCuts) {
1838  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1839  return kFALSE;
1840  }
1841  if(!analysisCutSelection.IsAlnum()){
1842  AliError("Cut selection is not alphanumeric");
1843  return kFALSE;
1844  }
1845 
1846  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
1847  analysisCutSelectionLowerCase.ToLower();
1848  const char *cutSelection = analysisCutSelectionLowerCase.Data();
1849  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
1850  for(Int_t ii=0;ii<kNCuts;ii++){
1851  ASSIGNARRAY(ii);
1852  }
1853 
1854  // Set Individual Cuts
1855  for(Int_t ii=0;ii<kNCuts;ii++){
1856  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1857  }
1858 
1860 
1861  return kTRUE;
1862 }
1866 
1867  switch (cutID) {
1868 
1869  case kv0FinderType:
1870  if( SetV0Finder(value)) {
1871  fCuts[kv0FinderType] = value;
1872  UpdateCutString();
1873  return kTRUE;
1874  } else return kFALSE;
1875 
1876  case kededxSigmaCut:
1877  if( SetTPCdEdxCutElectronLine(value)) {
1878  fCuts[kededxSigmaCut] = value;
1879  UpdateCutString();
1880  return kTRUE;
1881  } else return kFALSE;
1882 
1883  case kpidedxSigmaCut:
1884  if( SetTPCdEdxCutPionLine(value)) {
1885  fCuts[kpidedxSigmaCut] = value;
1886  UpdateCutString();
1887  return kTRUE;
1888  } else return kFALSE;
1889 
1890  case kpiMomdedxSigmaCut:
1891  if( SetMinMomPiondEdxCut(value)) {
1892  fCuts[kpiMomdedxSigmaCut] = value;
1893  UpdateCutString();
1894  return kTRUE;
1895  } else return kFALSE;
1896 
1897  case kchi2GammaCut:
1898  if( SetChi2GammaCut(value)) {
1899  fCuts[kchi2GammaCut] = value;
1900  UpdateCutString();
1901  return kTRUE;
1902  } else return kFALSE;
1903 
1904  case ksinglePtCut:
1905  if( SetSinglePtCut(value)) {
1906  fCuts[ksinglePtCut] = value;
1907  UpdateCutString();
1908  return kTRUE;
1909  } else return kFALSE;
1910 
1911  case kclsTPCCut:
1912  if( SetTPCClusterCut(value)) {
1913  fCuts[kclsTPCCut] = value;
1914  UpdateCutString();
1915  return kTRUE;
1916  } else return kFALSE;
1917 
1918  case ketaCut:
1919  if( SetEtaCut(value)) {
1920  fCuts[ketaCut] = value;
1921  UpdateCutString();
1922  return kTRUE;
1923  } else return kFALSE;
1924 
1926  if( SetLowPRejectionCuts(value)) {
1927  fCuts[kLowPRejectionSigmaCut] = value;
1928  UpdateCutString();
1929  return kTRUE;
1930  } else return kFALSE;
1931 
1932  case kQtMaxCut:
1933  if( SetQtMaxCut(value)) {
1934  fCuts[kQtMaxCut] = value;
1935  UpdateCutString();
1936  return kTRUE;
1937  } else return kFALSE;
1938 
1939  case kpiMaxMomdedxSigmaCut:
1940  if( SetMaxMomPiondEdxCut(value)) {
1941  fCuts[kpiMaxMomdedxSigmaCut] = value;
1942  UpdateCutString();
1943  return kTRUE;
1944  } else return kFALSE;
1945 
1946  case kRCut:
1947  if( SetRCut(value)) {
1948  fCuts[kRCut] = value;
1949  UpdateCutString();
1950  return kTRUE;
1951  } else return kFALSE;
1952 
1953  case kremovePileUp:
1954  if( SetRemovePileUp(value)) {
1955  fCuts[kremovePileUp] = value;
1956  UpdateCutString();
1957  return kTRUE;
1958  } else return kFALSE;
1959 
1961  if( SetSelectSpecialTrigger(value)) {
1963  UpdateCutString();
1964  return kTRUE;
1965  } else return kFALSE;
1966 
1968  if( SetSelectSubTriggerClass(value)) {
1969  fCuts[kSelectSubTriggerClass] = value;
1970  UpdateCutString();
1971  return kTRUE;
1972  } else return kFALSE;
1973 
1974  case kisHeavyIon:
1975  if( SetIsHeavyIon(value)) {
1976  fCuts[kisHeavyIon] = value;
1977  UpdateCutString();
1978  return kTRUE;
1979  } else return kFALSE;
1980 
1981  case kCentralityMin:
1982  if( SetCentralityMin(value)) {
1983  fCuts[kCentralityMin] = value;
1984  UpdateCutString();
1985  return kTRUE;
1986  } else return kFALSE;
1987 
1988  case kCentralityMax:
1989  if( SetCentralityMax(value)) {
1990  fCuts[kCentralityMax] = value;
1991  UpdateCutString();
1992  return kTRUE;
1993  } else return kFALSE;
1994 
1995  case kTOFelectronPID:
1996  if( SetTOFElectronPIDCut(value)) {
1997  fCuts[kTOFelectronPID] = value;
1998  UpdateCutString();
1999  return kTRUE;
2000  } else return kFALSE;
2001 
2002  case kdoPhotonAsymmetryCut:
2003  if( SetPhotonAsymmetryCut(value)) {
2004  fCuts[kdoPhotonAsymmetryCut] = value;
2005  UpdateCutString();
2006  return kTRUE;
2007  } else return kFALSE;
2008 
2009  case kPsiPair:
2010  if( SetPsiPairCut(value)) {
2011  fCuts[kPsiPair] = value;
2012  UpdateCutString();
2013  return kTRUE;
2014  } else return kFALSE;
2015 
2016  case kCosPAngle:
2017  if( SetCosPAngleCut(value)) {
2018  fCuts[kCosPAngle] = value;
2019  UpdateCutString();
2020  return kTRUE;
2021  } else return kFALSE;
2022 
2023 
2024  case kElecShare:
2025  if( SetSharedElectronCut(value)) {
2026  fCuts[kElecShare] = value;
2027  UpdateCutString();
2028  return kTRUE;
2029  } else return kFALSE;
2030 
2031  case kToCloseV0s:
2032  if( SetToCloseV0sCut(value)) {
2033  fCuts[kToCloseV0s] = value;
2034  UpdateCutString();
2035  return kTRUE;
2036  } else return kFALSE;
2037 
2038  case kExtraSignals:
2039  if( SetRejectExtraSignalsCut(value)) {
2040  fCuts[kExtraSignals] = value;
2041  UpdateCutString();
2042  return kTRUE;
2043  } else return kFALSE;
2044 
2045  case kDcaRPrimVtx:
2046  if( SetDCARPhotonPrimVtxCut(value)) {
2047  fCuts[kDcaRPrimVtx] = value;
2048  UpdateCutString();
2049  return kTRUE;
2050  } else return kFALSE;
2051 
2052  case kDcaZPrimVtx:
2053  if( SetDCAZPhotonPrimVtxCut(value)) {
2054  fCuts[kDcaZPrimVtx] = value;
2055  UpdateCutString();
2056  return kTRUE;
2057  } else return kFALSE;
2058 
2059  case kInPlaneOutOfPlane:
2060  if( SetInPlaneOutOfPlane(value)) {
2061  fCuts[kInPlaneOutOfPlane] = value;
2062  UpdateCutString();
2063  return kTRUE;
2064  } else return kFALSE;
2065 
2066 
2067 
2068 
2069  case kNCuts:
2070  AliError("Cut id out of range");
2071  return kFALSE;
2072  }
2073 
2074  AliError("Cut id %d not recognized");
2075  return kFALSE;
2076 
2077 
2078 }
2081  // Print out current Cut Selection
2082  for(Int_t ic = 0; ic < kNCuts; ic++) {
2083  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
2084  }
2085 }
2086 
2088  // Print out current Cut Selection with value
2089  printf("\nConversion cutnumber \n");
2090  for(Int_t ic = 0; ic < kNCuts; ic++) {
2091  printf("%d",fCuts[ic]);
2092  }
2093  printf("\n\n");
2094 
2095 
2096  if (fIsHeavyIon == 0) {
2097  printf("Running in pp mode \n");
2098  if (fSpecialTrigger == 0){
2099  printf("\t only events triggered by V0OR will be analysed \n");
2100  } else if (fSpecialTrigger == 1){
2101  printf("\t only events triggered by V0AND will be analysed \n");
2102  } else if (fSpecialTrigger == 2){
2103  printf("\t only events where SDD was present will be analysed \n");
2104  } else if (fSpecialTrigger == 3){
2105  printf("\t only events where SDD was present will be analysed and triggered by VOAND\n");
2106  } else if (fSpecialTrigger > 3){
2107  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
2108  }
2109  } else if (fIsHeavyIon == 1){
2110  printf("Running in PbPb mode \n");
2111  if (fDetectorCentrality == 0){
2112  printf("\t centrality selection based on V0M \n");
2113  } else if (fDetectorCentrality == 1){
2114  printf("\t centrality selection based on Cl1 \n");
2115  }
2116  if (fModCentralityClass == 0){
2117  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
2118  } else if ( fModCentralityClass == 1){
2119  printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5);
2120  } else if ( fModCentralityClass == 2){
2121  printf("\t %d - %d \n", fCentralityMin*5+45, fCentralityMax*5+45);
2122  } else if (fModCentralityClass == 3){
2123  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10);
2124  } else if ( fModCentralityClass == 4){
2125  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5);
2126  } else if ( fModCentralityClass == 5){
2127  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5+45, fCentralityMax*5+45);
2128  }
2129  if (fSpecialTrigger == 0){
2130  printf("\t only events triggered by kMB, kCentral, kSemiCentral will be analysed \n");
2131  } else if (fSpecialTrigger > 4){
2132  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
2133  }
2134  } else if (fIsHeavyIon == 2){
2135  printf("Running in pPb mode \n");
2136  if (fDetectorCentrality == 0){
2137  printf("\t centrality selection based on V0A \n");
2138  } else if (fDetectorCentrality == 1){
2139  printf("\t centrality selection based on Cl1 \n");
2140  }
2141  if (fModCentralityClass == 0){
2142  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
2143  }
2144  if (fSpecialTrigger == 0){
2145  printf("\t only events triggered by kINT7 will be analysed \n");
2146  } else if (fSpecialTrigger > 4){
2147  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
2148  }
2149  }
2150  printf("MC event cuts: \n");
2151  if (fRejectExtraSignals == 0) printf("\t no rejection was applied \n");
2152  else if (fRejectExtraSignals == 1) printf("\t only MB header will be inspected \n");
2153  else if (fRejectExtraSignals > 1) printf("\t special header have been selected \n");
2154 
2155  printf("Electron cuts & Secondary Track Cuts - only track from secondaries enter analysis: \n");
2156  printf("\t no like sign pairs from V0s \n");
2157  if (!fUseCorrectedTPCClsInfo) printf("\t # TPC clusters > %3.2f \n", fMinClsTPC);
2158  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{e} < %3.2f\n", fEtaCutMin, fEtaCut );
2159  else printf("\t eta_{e} < %3.2f\n", fEtaCut );
2160  printf("\t p_{T,e} > %3.2f\n", fSinglePtCut );
2161  printf("\t TPC refit \n");
2162  printf("\t no kinks \n");
2163  printf("\t accept: %3.2f < n sigma_{e,TPC} < %3.2f\n", fPIDnSigmaBelowElectronLine, fPIDnSigmaAboveElectronLine );
2164  printf("\t reject: %3.2f < p_{e,T} < %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMinPnSigmaAbovePionLine, fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLine );
2165  printf("\t reject: p_{e,T} > %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLineHighPt );
2166  if (fDoPionRejectionLowP) printf("\t reject: p_{e,T} < %3.2f, -%3.2f < n sigma_{pi,TPC} < %3.2f\n", fPIDMinPPionRejectionLowP, fPIDnSigmaAtLowPAroundPionLine, fPIDnSigmaAtLowPAroundPionLine );
2167  if (fDoKaonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{K,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundKaonLine, fPIDnSigmaAtLowPAroundKaonLine );
2168  if (fDoProtonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{K,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundProtonLine, fPIDnSigmaAtLowPAroundProtonLine );
2169  if (fUseTOFpid) printf("\t accept: %3.2f < n sigma_{e,TOF} < %3.2f\n", fTofPIDnSigmaBelowElectronLine, fTofPIDnSigmaAboveElectronLine);
2170 
2171  printf("Photon cuts: \n");
2172  if (fUseOnFlyV0Finder) printf("\t using Onfly V0 finder \n");
2173  else printf("\t using Offline V0 finder \n");
2174  if (fDo2DQt){
2175  printf("\t 2 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2176  } else {
2177  printf("\t 1 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
2178  }
2179  if (fDo2DPsiPairChi2){
2180  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 );
2181  } else {
2182  printf("\t chi^{2} max cut chi^{2} < %3.2f \n", fChi2CutConversion );
2183  printf("\t psi_{pair} max cut |psi_{pair}| < %3.2f \n", fPsiPairCut );
2184  }
2185  printf("\t %3.2f < R_{conv} < %3.2f\n", fMinR, fMaxR );
2186  printf("\t Z_{conv} < %3.2f\n", fMaxZ );
2187  if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{conv} < %3.2f\n", fEtaCutMin, fEtaCut );
2188  else printf("\t eta_{conv} < %3.2f\n", fEtaCut );
2189  if (fDoPhotonAsymmetryCut) printf("\t for p_{T,track} > %3.2f, A_{gamma} < %3.2f \n", fMinPPhotonAsymmetryCut, fMinPhotonAsymmetry );
2190  if (fUseCorrectedTPCClsInfo) printf("\t #cluster TPC/ #findable clusters TPC (corrected for radius) > %3.2f\n", fMinClsTPCToF );
2191  printf("\t p_{T,gamma} > %3.2f\n", fPtCut );
2192  printf("\t cos(Theta_{point}) > %3.2f \n", fCosPAngleCut );
2193  printf("\t dca_{R} < %3.2f \n", fDCARPrimVtxCut );
2194  printf("\t dca_{Z} < %3.2f \n", fDCAZPrimVtxCut );
2195  if (fDoPhotonQualitySelectionCut) printf("\t selection based on photon quality with quality %d \n", fPhotonQualityCut );
2196 }
2197 
2200 { // Set Cut
2201  switch(isHeavyIon){
2202  case 0:
2203  fIsHeavyIon=0;
2204  break;
2205  case 1:
2206  fIsHeavyIon=1;
2208  break;
2209  case 2:
2210  fIsHeavyIon=1;
2212  break;
2213  case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
2214  fIsHeavyIon=1;
2217  break;
2218  case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
2219  fIsHeavyIon=1;
2222  break;
2223  case 5: //strict cut on v0 tracks for MC
2224  fIsHeavyIon=1;
2227  break;
2228  case 6: //allows to select centrality 0-45% in steps of 5% for track mult
2229  //strict cut on v0 tracks for MC
2230  fIsHeavyIon=1;
2233  break;
2234  case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
2235  //strict cut on v0 tracks for MC
2236  fIsHeavyIon=1;
2239  break;
2240  case 8:
2241  fIsHeavyIon=2;
2243  break;
2244  case 9:
2245  fIsHeavyIon=2;
2247  break;
2248  default:
2249  AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
2250  return kFALSE;
2251  }
2252  return kTRUE;
2253 }
2254 
2255 //___________________________________________________________________
2257 {
2258  // Set Cut
2259  if(minCentrality<0||minCentrality>9){
2260  AliError(Form("minCentrality not defined %d",minCentrality));
2261  return kFALSE;
2262  }
2263 
2264  fCentralityMin=minCentrality;
2265  return kTRUE;
2266 }
2267 //___________________________________________________________________
2269 {
2270  // Set Cut
2271  if(maxCentrality<0||maxCentrality>9){
2272  AliError(Form("maxCentrality not defined %d",maxCentrality));
2273  return kFALSE;
2274  }
2275  fCentralityMax=maxCentrality;
2276  return kTRUE;
2277 }
2280 {// Set Cut
2281 
2282  switch(selectSpecialTrigger){
2283  case 0:
2284  fSpecialTrigger=0; // dont care
2285  break;
2286  case 1:
2287  fSpecialTrigger=1; // V0AND
2288  break;
2289  case 2:
2290  fSpecialTrigger=2; // with SDD requested
2291  break;
2292  case 3:
2293  fSpecialTrigger=3; // V0AND plus with SDD requested
2294  break;
2295  // allows to run MB & 6 other different trigger classes in parallel with the same photon cut
2296  case 4:
2297  fSpecialTrigger=4; // trigger alias kTRD
2298  fOfflineTriggerMask=AliVEvent::kTRD;
2299  fTriggerSelectedManually = kTRUE;
2300  fSpecialTriggerName="AliVEvent::kTRD";
2301  break;
2302  case 5:
2303  fSpecialTrigger=5; // trigger alias kEMC
2304  fOfflineTriggerMask=AliVEvent::kEMC7 | AliVEvent::kEMC8 | AliVEvent::kEMC1 ;
2305  fTriggerSelectedManually = kTRUE;
2306  fSpecialTriggerName="AliVEvent::kEMC7/kEMC8/kEMC1";
2307  break;
2308  case 6:
2309  fSpecialTrigger=6; // trigger alias kPHI
2310  fOfflineTriggerMask=AliVEvent::kPHI7 | AliVEvent::kPHI1 | AliVEvent::kPHI8 | AliVEvent::kPHOSPb;
2311  fTriggerSelectedManually = kTRUE;
2312  fSpecialTriggerName="AliVEvent::kPHI7/kPHI1/kPHI8/kPHOSPb";
2313  break;
2314  case 7:
2315  fSpecialTrigger=7; // trigger alias kHighMult
2316  fOfflineTriggerMask=AliVEvent::kHighMult;
2317  fTriggerSelectedManually = kTRUE;
2318  fSpecialTriggerName="AliVEvent::kHighMult";
2319  break;
2320  case 8:
2321  fSpecialTrigger=8; // trigger alias kEMCEGA
2322  fOfflineTriggerMask=AliVEvent::kEMCEGA;
2323  fTriggerSelectedManually = kTRUE;
2324  fSpecialTriggerName="AliVEvent::kEMCEGA";
2325  break;
2326  case 9:
2327  fSpecialTrigger=9; // trigger alias kEMCEJE
2328  fOfflineTriggerMask=AliVEvent::kEMCEJE;
2329  fTriggerSelectedManually = kTRUE;
2330  fSpecialTriggerName="AliVEvent::kEMCEJE";
2331  break;
2332  default:
2333  AliError("Warning: Special Trigger Not known");
2334  return 0;
2335  }
2336  return 1;
2337 }
2338 
2341 {// Set Cut
2342 
2343  if (fSpecialTrigger == 1){ //V0AND with different detectors
2344  switch(selectSpecialSubTriggerClass){
2345  case 0: //with VZERO
2346  fSpecialTrigger=1;
2347  fSpecialSubTrigger=0;
2348 // AliInfo("Info: Nothing to be done");
2349  break;
2350  case 1: //with TZERO
2351  fSpecialTrigger=0;
2352  fSpecialSubTrigger=0;
2353  fOfflineTriggerMask=AliVEvent::kINT8;
2354  fTriggerSelectedManually = kTRUE;
2355  fSpecialTriggerName="AliVEvent::kINT8";
2356  break;
2357  default:
2358  AliError("Warning: Special Subtrigger Class Not known");
2359  return 0;
2360  }
2361 
2362  } else if (fSpecialTrigger == 4){ // Subdivision of TRD trigger classes
2363  switch(selectSpecialSubTriggerClass){
2364  case 0: // all together
2365  fSpecialSubTrigger=0;
2367 // AliInfo("Info: Nothing to be done");
2368  break;
2369  case 1: // 7WUHSH - V0AND with single electron in TRD & EMCAL
2370  fSpecialSubTrigger=1;
2372  fSpecialSubTriggerName="7WUHEE";
2373  break;
2374  case 2: // 8WUHSH - T0AND with single electron in TRD & EMCAL
2375  fSpecialSubTrigger=1;
2377  fSpecialSubTriggerName="8WUHEE";
2378  break;
2379  case 3: // 7WUHSE - V0AND with single high pt electron in TRD
2380  fSpecialSubTrigger=1;
2382  fSpecialSubTriggerName="7WUHSE";
2383  break;
2384  case 4: // 8WUHSE - T0AND with single high pt electron in TRD
2385  fSpecialSubTrigger=1;
2387  fSpecialSubTriggerName="8WUHSE";
2388  break;
2389  case 5: // 7WUHJE - V0AND with jet in TRD
2390  fSpecialSubTrigger=1;
2392  fSpecialSubTriggerName="7WUHJT";
2393  break;
2394  case 6: // 8WUHJE - T0AND with jet in TRD
2395  fSpecialSubTrigger=1;
2397  fSpecialSubTriggerName="8WUHJT";
2398  break;
2399  case 7: // 7WUHQU - V0AND with dielectron pair in TRD
2400  fSpecialSubTrigger=1;
2402  fSpecialSubTriggerName="7WUHQU";
2403  break;
2404  case 8: // 8WUHQU - T0AND with dielectron pair in TRD
2405  fSpecialSubTrigger=1;
2407  fSpecialSubTriggerName="8WUHQU";
2408  break;
2409  default:
2410  AliError("Warning: Special Subtrigger Class Not known");
2411  return 0;
2412  }
2413  } else if (fSpecialTrigger == 5){ // Subdivision of kEMC trigger classes
2414  switch(selectSpecialSubTriggerClass){
2415  case 0: // all together
2416  fSpecialSubTrigger=0;
2418 // AliInfo("Info: Nothing to be done");
2419  break;
2420  case 1: // CEMC1 - V0OR and EMCAL fired
2421  fOfflineTriggerMask=AliVEvent::kEMC1;
2422  fSpecialTriggerName="AliVEvent::kEMC1";
2423  fSpecialSubTrigger=1;
2425  fSpecialSubTriggerName="CEMC1";
2426  break;
2427  case 2: // CEMC7 - V0AND and EMCAL fired
2428  fSpecialSubTrigger=1;
2429  fOfflineTriggerMask=AliVEvent::kEMC7;
2430  fSpecialTriggerName="AliVEvent::kEMC7";
2432  fSpecialSubTriggerName="CEMC7";
2433  break;
2434  case 3: // CEMC8 - T0OR and EMCAL fired
2435  fOfflineTriggerMask=AliVEvent::kEMC8;
2436  fSpecialTriggerName="AliVEvent::kEMC8";
2437  fSpecialSubTrigger=1;
2439  fSpecialSubTriggerName="CEMC8";
2440  break;
2441  default:
2442  AliError("Warning: Special Subtrigger Class Not known");
2443  return 0;
2444  }
2445  } else if (fSpecialTrigger == 6){ // Subdivision of kPHI trigger classes
2446  switch(selectSpecialSubTriggerClass){
2447  case 0: // all together
2448  fSpecialSubTrigger=0;
2450 // AliInfo("Info: Nothing to be done");
2451  break;
2452  case 1: // CEMC1 - V0OR and EMCAL fired
2453  fOfflineTriggerMask=AliVEvent::kPHI1;
2454  fSpecialTriggerName="AliVEvent::kPHI1";
2455  fSpecialSubTrigger=1;
2457  fSpecialSubTriggerName="CPHI1";
2458  break;
2459  case 2: // CEMC7 - V0AND and EMCAL fired
2460  fSpecialSubTrigger=1;
2461  fOfflineTriggerMask=AliVEvent::kPHI7;
2462  fSpecialTriggerName="AliVEvent::kPHI7";
2464  fSpecialSubTriggerName="CPHI7";
2465  break;
2466  case 3: // CEMC8 - T0OR and EMCAL fired
2467  fOfflineTriggerMask=AliVEvent::kPHI8;
2468  fSpecialTriggerName="AliVEvent::kPHI8";
2469  fSpecialSubTrigger=1;
2471  fSpecialSubTriggerName="CPHI8";
2472  break;
2473  default:
2474  AliError("Warning: Special Subtrigger Class Not known");
2475  return 0;
2476  }
2477  } else if (fSpecialTrigger == 7){ // Subdivision of kHighMult trigger classes
2478  switch(selectSpecialSubTriggerClass){
2479  case 0: // all together
2480  fSpecialSubTrigger=0;
2482 // AliInfo("Info: Nothing to be done");
2483  break;
2484  case 1: // CSHM1 - V0OR and high mult fired
2485  fSpecialSubTrigger=1;
2487  fSpecialSubTriggerName="CSHM1";
2488  break;
2489  case 2: // CSHM7 - V0AND and high mult fired
2490  fSpecialSubTrigger=1;
2492  fSpecialSubTriggerName="CSHM7";
2493  break;
2494  case 3: // CSHM8 - T0OR and high mult fired
2495  fSpecialSubTrigger=1;
2497  fSpecialSubTriggerName="CSHM8";
2498  break;
2499  default:
2500  AliError("Warning: Special Subtrigger Class Not known");
2501  return 0;
2502  }
2503  } else if (fSpecialTrigger == 8){ // Subdivision of kEMCEGA trigger classes
2504  switch(selectSpecialSubTriggerClass){
2505  case 0: // all together
2506  fSpecialSubTrigger=0;
2508 // AliInfo("Info: Nothing to be done");
2509  break;
2510  case 1: // 7EGA - CINT7 EGA
2511  fSpecialSubTrigger=1;
2513  fSpecialSubTriggerName="7EGA";
2514  break;
2515  case 2: // 8EGA - CINT8 EGA
2516  fSpecialSubTrigger=1;
2518  fSpecialSubTriggerName="8EGA";
2519  break;
2520  case 3: // 7EG1 - CINT7 EG1
2521  fSpecialSubTrigger=1;
2523  fSpecialSubTriggerName="7EG1";
2524  break;
2525  case 4: // 8EG1 - CINT8 EG1
2526  fSpecialSubTrigger=1;
2528  fSpecialSubTriggerName="8EG1";
2529  break;
2530  case 5: // 7EG2 - CINT7 EG2
2531  fSpecialSubTrigger=1;
2533  fSpecialSubTriggerName="7EG2";
2534  break;
2535  case 6: // 8EG2 - CINT8 EG2
2536  fSpecialSubTrigger=1;
2538  fSpecialSubTriggerName="8EG2";
2539  break;
2540  default:
2541  AliError("Warning: Special Subtrigger Class Not known");
2542  return 0;
2543  }
2544  } else if (fSpecialTrigger == 9){ // Subdivision of kEMCEGA trigger classes
2545  switch(selectSpecialSubTriggerClass){
2546  case 0: // all together
2547  fSpecialSubTrigger=0;
2549 // AliInfo("Info: Nothing to be done");
2550  break;
2551  case 1: // 7EJE - CINT7 EJE
2552  fSpecialSubTrigger=1;
2554  fSpecialSubTriggerName="7EJE";
2555  break;
2556  case 2: // 8EJE - CINT8 EJE
2557  fSpecialSubTrigger=1;
2559  fSpecialSubTriggerName="8EJE";
2560  break;
2561  case 3: // 7EJ1 - CINT7 EJ1
2562  fSpecialSubTrigger=1;
2564  fSpecialSubTriggerName="7EJ1";
2565  break;
2566  case 4: // 8EJ1 - CINT8 EJ1
2567  fSpecialSubTrigger=1;
2569  fSpecialSubTriggerName="8EJ1";
2570  break;
2571  case 5: // 7EJ2 - CINT7 EJ2
2572  fSpecialSubTrigger=1;
2574  fSpecialSubTriggerName="7EJ2";
2575  break;
2576  case 6: // 8EJ2 - CINT8 EJ2
2577  fSpecialSubTrigger=1;
2579  fSpecialSubTriggerName="8EJ2";
2580  break;
2581  default:
2582  AliError("Warning: Special Subtrigger Class Not known");
2583  return 0;
2584  }
2585  }
2586  return 1;
2587 }
2588 
2591 {
2592  // Set Cut
2593  fMultiplicityMethod=multiplicityMethod;
2594 
2595  // 0 Photon Multiplicity
2596  // 1 TPC Track multiplicity
2597  // 2 V0 Mult
2598  // 3 SPD Mult
2599 
2600  return kTRUE;
2601 }
2604 {// Set Cut
2605  switch(removePileUp){
2606  case 0:
2607  fRemovePileUp=kFALSE;
2608  break;
2609  case 1:
2610  fRemovePileUp=kTRUE;
2611  break;
2612  default:
2613  AliError("RemovePileUpCut not defined");
2614  return kFALSE;
2615  }
2616  return kTRUE;
2617 }
2620 
2621  switch(extraSignal){
2622  case 0:
2623  fRejectExtraSignals = 0;
2624  break; // No Rejection
2625  case 1:
2626  fRejectExtraSignals = 1;
2627  break; // MinBias Header
2628  case 2:
2629  fRejectExtraSignals = 2;
2630  break; // User String Array
2631  case 3:
2632  fRejectExtraSignals = 3;
2633  break; // Rejection for Gamma Correction only
2634  default:
2635  AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
2636  return kFALSE;
2637  }
2638  return kTRUE;
2639 }
2642 { // Set Cut
2643  switch (v0FinderType){
2644  case 0: // on fly V0 finder
2645  cout << "have chosen onfly V0" << endl;
2646  fUseOnFlyV0Finder=kTRUE;
2647  break;
2648  case 1: // offline V0 finder
2649  cout << "have chosen offline V0" << endl;
2650  fUseOnFlyV0Finder=kFALSE;
2651  break;
2652  default:
2653  AliError(Form(" v0FinderType not defined %d",v0FinderType));
2654  return kFALSE;
2655  }
2656  return kTRUE;
2657 }
2660 { // Set Cut
2661 
2662  //Set Standard LineCutZValues
2663  fLineCutZValueMin = -2;
2664  fLineCutZValue = 7.;
2665 
2666  switch(etaCut){
2667  case 0: // 0.9
2668  fEtaCut = 0.9;
2669  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2670  fEtaCutMin = -0.1;
2671  fLineCutZRSlopeMin = 0.;
2672  break;
2673  case 1: // 0.6 // changed from 1.2 to 0.6 on 2013.06.10
2674  fEtaCut = 0.6;
2675  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2676  fEtaCutMin = -0.1;
2677  fLineCutZRSlopeMin = 0.;
2678  break;
2679  case 2: // 1.4
2680  fEtaCut = 1.4;
2681  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2682  fEtaCutMin = -0.1;
2683  fLineCutZRSlopeMin = 0.;
2684  break;
2685  case 3: // 0.65
2686  fEtaCut = 0.65;
2687  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2688  fEtaCutMin = -0.1;
2689  fLineCutZRSlopeMin = 0.;
2690  break;
2691  case 4: // 0.75
2692  fEtaCut = 0.75;
2693  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2694  fEtaCutMin = -0.1;
2695  fLineCutZRSlopeMin = 0.;
2696  break;
2697  case 5: // 0.5
2698  fEtaCut = 0.5;
2699  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2700  fEtaCutMin = -0.1;
2701  fLineCutZRSlopeMin = 0.;
2702  break;
2703  case 6: // 5.
2704  fEtaCut = 5.;
2705  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2706  fEtaCutMin = -0.1;
2707  fLineCutZRSlopeMin = 0.;
2708  break;
2709  case 7:
2710  if (fIsHeavyIon==1){
2711  fEtaCut = 0.7;
2712  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2713  fEtaCutMin = -0.1;
2714  fLineCutZRSlopeMin = 0.;
2715  break;
2716  } else {
2717  fEtaCut = 0.3;
2718  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2719  fEtaCutMin = -0.1;
2720  fLineCutZRSlopeMin = 0.;
2721  break;
2722  }
2723  // case 8: // 0.1 - 0.8
2724  // fEtaCut = 0.9;
2725  // fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2726  // fEtaCutMin = 0.1;
2727  // fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2728  // break;
2729  case 8: // 0.4
2730  fEtaCut = 0.4;
2731  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2732  fEtaCutMin = -0.1;
2733  fLineCutZRSlopeMin = 0.;
2734  break;
2735  case 9: // 10
2736  fEtaCut = 10;
2737  fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2738  fEtaCutMin = -0.1;
2739  fLineCutZRSlopeMin = 0.;
2740  break;
2741  default:
2742  AliError(Form(" EtaCut not defined %d",etaCut));
2743  return kFALSE;
2744  }
2745  return kTRUE;
2746 }
2749  // Set Cut
2750  switch(RCut){
2751  case 0:
2752  fMinR=0;
2753  fMaxR = 180.;
2754  break;
2755  case 1:
2756  fMinR=2.8;
2757  fMaxR = 180.;
2758  break;
2759  case 2:
2760  fMinR=5.;
2761  fMaxR = 180.;
2762  break;
2763  case 3:
2764  fMaxR = 70.;
2765  fMinR = 10.;
2766  break;
2767  case 4:
2768  fMaxR = 70.;
2769  fMinR = 5.;
2770  break;
2771  case 5:
2772  fMaxR = 180.;
2773  fMinR = 10.;
2774  break;
2775  case 6:
2776  fMaxR = 180.;
2777  fMinR = 20.;
2778  break;
2779  case 7:
2780  fMaxR = 180.;
2781  fMinR = 35.; //old 26.
2782  break;
2783  case 8:
2784  fMaxR = 180.;
2785  fMinR = 12.5;
2786  break;
2787  case 9:
2788  fMaxR = 180.;
2789  fMinR = 7.5;
2790  break;
2791 
2792  default:
2793  AliError("RCut not defined");
2794  return kFALSE;
2795  }
2796  return kTRUE;
2797 }
2800 { // Set Cut
2801  switch(singlePtCut){
2802  case 0: // 0.050 GeV
2803  fSinglePtCut = 0.050;
2804  break;
2805  case 1: // 0.100 GeV
2806  fSinglePtCut = 0.100;
2807  break;
2808  case 2: // 0.150 GeV
2809  fSinglePtCut = 0.150;
2810  break;
2811  case 3: // 0.200 GeV
2812  fSinglePtCut = 0.200;
2813  break;
2814  case 4: // 0.075 GeV
2815  fSinglePtCut = 0.075;
2816  break;
2817  case 5: // 0.125 GeV
2818  fSinglePtCut = 0.125;
2819  break;
2820  case 6: // 0.04 GeV
2821  fSinglePtCut = 0.040;
2822  break;
2823  case 7: // 0.0 GeV
2824  fSinglePtCut = 0.0;
2825  break;
2826  default:
2827  AliError(Form("singlePtCut not defined %d",singlePtCut));
2828  return kFALSE;
2829  }
2830  return kTRUE;
2831 }
2834 { // Set Cut
2835  switch(clsTPCCut){
2836  case 0: // 0
2837  fMinClsTPC= 0.;
2838  break;
2839  case 1: // 60
2840  fMinClsTPC= 60.;
2841  break;
2842  case 2: // 80
2843  fMinClsTPC= 80.;
2844  break;
2845  case 3: // 100
2846  fMinClsTPC= 100.;
2847  break;
2848  case 4: // 95% of findable clusters
2849  fMinClsTPCToF= 0.95;
2851  break;
2852  case 5: // 0% of findable clusters
2853  fMinClsTPCToF= 0.0;
2855  break;
2856  case 6: // 70% of findable clusters
2857  fMinClsTPCToF= 0.7;
2859  break;
2860  case 7: // 0% of findable clusters
2861  fMinClsTPCToF= 0.35;
2863  break;
2864  case 8:
2865  fMinClsTPCToF= 0.35;
2867  break;
2868  case 9:
2869  fMinClsTPCToF= 0.6;
2871  break;
2872  default:
2873  AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2874  return kFALSE;
2875  }
2876  return kTRUE;
2877 }
2880 { // Set Cut
2881  switch(ededxSigmaCut){
2882  case 0: // -10,10
2885  break;
2886  case 1: // -5,5
2889  break;
2890  case 2: // -3,5
2893  break;
2894  case 3: // -4,5
2897  break;
2898  case 4: // -6,7
2901  break;
2902  case 5: // -4,4
2905  break;
2906  case 6: // -2.5,4
2909  break;
2910  case 7: // -2,3.5
2913  break;
2914  default:
2915  AliError("TPCdEdxCutElectronLine not defined");
2916  return kFALSE;
2917 
2918  }
2919  return kTRUE;
2920 }
2923 { // Set Cut
2924 
2925  switch(pidedxSigmaCut){
2926  case 0: // -10
2929  break;
2930  case 1: // 0
2933  break;
2934  case 2: // 1
2937  break;
2938  case 3: // 1
2941  break;
2942  case 4: // 1
2945  break;
2946  case 5: // 1
2949  break;
2950  case 6: // 1
2953  break;
2954  case 7: // 1
2957  break;
2958  case 8: // 1
2961  break;
2962  case 9:
2963  fPIDnSigmaAbovePionLine=3.0; // We need a bit less tight cut on dE/dx
2965  break;
2966  default:
2967  AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2968  return kFALSE;
2969  }
2970  return kTRUE;
2971 }
2974 { // Set Cut
2975  switch(piMomdedxSigmaCut){
2976  case 0: // 0.5 GeV
2978  break;
2979  case 1: // 1. GeV
2981  break;
2982  case 2: // 1.5 GeV
2984  break;
2985  case 3: // 20.0 GeV
2987  break;
2988  case 4: // 50.0 GeV
2990  break;
2991  case 5: // 0.3 GeV
2993  break;
2994  case 6: // 0.25 GeV
2996  break;
2997  case 7: // 0.4 GeV
2999  break;
3000  case 8: // 0.2 GeV
3002  break;
3003  default:
3004  AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
3005  return kFALSE;
3006  }
3007  return kTRUE;
3008 }
3011 { // Set Cut
3012  switch(piMaxMomdedxSigmaCut){
3013  case 0: // 100. GeV
3015  break;
3016  case 1: // 5. GeV
3018  break;
3019  case 2: // 4. GeV
3021  break;
3022  case 3: // 3.5 GeV
3024  break;
3025  case 4: // 3. GeV
3027  break;
3028  case 5: // 7. GeV
3030  break;
3031  default:
3032  AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
3033  return kFALSE;
3034  }
3035  return kTRUE;
3036 }
3039 { // Set Cut
3040  switch(LowPRejectionSigmaCut){
3041  case 0: //
3045  fDoKaonRejectionLowP = kFALSE;
3046  fDoProtonRejectionLowP = kFALSE;
3047  fDoPionRejectionLowP = kFALSE;
3049  break;
3050  case 1: //
3054  fDoKaonRejectionLowP = kTRUE;
3055  fDoProtonRejectionLowP = kTRUE;
3056  fDoPionRejectionLowP = kTRUE;
3058  break;
3059  case 2: //
3063  fDoKaonRejectionLowP = kTRUE;
3064  fDoProtonRejectionLowP = kTRUE;
3065  fDoPionRejectionLowP = kTRUE;
3067  break;
3068  case 3: //
3072  fDoKaonRejectionLowP = kTRUE;
3073  fDoProtonRejectionLowP = kTRUE;
3074  fDoPionRejectionLowP = kTRUE;
3076  break;
3077  case 4: //
3081  fDoKaonRejectionLowP = kFALSE;
3082  fDoProtonRejectionLowP = kFALSE;
3083  fDoPionRejectionLowP = kTRUE;
3085  break;
3086  case 5: //
3090  fDoKaonRejectionLowP = kFALSE;
3091  fDoProtonRejectionLowP = kFALSE;
3092  fDoPionRejectionLowP = kTRUE;
3094  break;
3095  case 6: //
3099  fDoKaonRejectionLowP = kFALSE;
3100  fDoProtonRejectionLowP = kFALSE;
3101  fDoPionRejectionLowP = kTRUE;
3103  break;
3104  case 7: //
3108  fDoKaonRejectionLowP = kFALSE;
3109  fDoProtonRejectionLowP = kFALSE;
3110  fDoPionRejectionLowP = kTRUE;
3112  break;
3113  default:
3114  AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
3115  return kFALSE;
3116  }
3117  return kTRUE;
3118 }
3121  // Set Cut
3122  switch(TOFelectronPID){
3123  case 0: // no cut
3124  fUseTOFpid = kFALSE;
3127  break;
3128  case 1: // -7,7
3129  fUseTOFpid = kTRUE;
3132  break;
3133  case 2: // -5,5
3134  fUseTOFpid = kTRUE;
3137  break;
3138  case 3: // -3,5
3139  fUseTOFpid = kTRUE;
3142  break;
3143  case 4: // -2,3
3144  fUseTOFpid = kTRUE;
3147  break;
3148  case 5: // -3,3
3149  fUseTOFpid = kTRUE;
3152  break;
3153  default:
3154  AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
3155  return kFALSE;
3156  }
3157  return kTRUE;
3158 }
3161 { // Set Cut
3162  switch(QtMaxCut){
3163  case 0: //
3164  fQtMax=1.;
3165  fDoQtGammaSelection=kFALSE;
3166  fDo2DQt=kFALSE;
3167  break;
3168  case 1:
3169  fQtMax=0.1;
3170  fDo2DQt=kFALSE;
3171  break;
3172  case 2:
3173  fQtMax=0.07;
3174  fDo2DQt=kFALSE;
3175  break;
3176  case 3:
3177  fQtMax=0.05;
3178  fDo2DQt=kFALSE;
3179  break;
3180  case 4:
3181  fQtMax=0.03;
3182  fDo2DQt=kFALSE;
3183  break;
3184  case 5:
3185  fQtMax=0.02;
3186  fDo2DQt=kFALSE;
3187  break;
3188  case 6:
3189  fQtMax=0.02;
3190  fDo2DQt=kTRUE;
3191  break;
3192  case 7:
3193  fQtMax=0.15;
3194  fDo2DQt=kFALSE;
3195  break;
3196  case 8:
3197  fQtMax=0.05;
3198  fDo2DQt=kTRUE;
3199  break;
3200  case 9:
3201  fQtMax=0.03;
3202  fDo2DQt=kTRUE;
3203  break;
3204  default:
3205  AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
3206  return kFALSE;
3207  }
3208  return kTRUE;
3209 }
3212 { // Set Cut
3213 
3214  switch(chi2GammaCut){
3215  case 0: // 100
3216  fChi2CutConversion = 100.;
3217  break;
3218  case 1: // 50
3219  fChi2CutConversion = 50.;
3220  break;
3221  case 2: // 30
3222  fChi2CutConversion = 30.;
3223  break;
3224  case 3:
3225  fChi2CutConversion = 200.;
3226  break;
3227  case 4:
3228  fChi2CutConversion = 500.;
3229  break;
3230  case 5:
3231  fChi2CutConversion = 100000.;
3232  break;
3233  case 6:
3234  fChi2CutConversion = 5.;
3235  break;
3236  case 7:
3237  fChi2CutConversion = 10.;
3238  break;
3239  case 8:
3240  fChi2CutConversion = 20.;
3241  break;
3242  case 9:
3243  fChi2CutConversion = 15.;
3244  break;
3245  default:
3246  AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
3247  return kFALSE;
3248  }
3249  return kTRUE;
3250 }
3253 
3254  switch(psiCut) {
3255  case 0:
3256  fPsiPairCut = 10000; //
3257  break;
3258  case 1:
3259  fPsiPairCut = 0.1; //
3260  break;
3261  case 2:
3262  fPsiPairCut = 0.05; // Standard
3263  break;
3264  case 3:
3265  fPsiPairCut = 0.035; //
3266  break;
3267  case 4:
3268  fPsiPairCut = 0.2; //
3269  break;
3270  case 5:
3271  fPsiPairCut = 0.1; //
3272  fDo2DPsiPairChi2 = kTRUE;
3273  break;
3274  case 6:
3275  fPsiPairCut = 0.05; //
3276  fDo2DPsiPairChi2 = kTRUE;
3277  break;
3278  case 7:
3279  fPsiPairCut = 0.035; //
3280  fDo2DPsiPairChi2 = kTRUE;
3281  break;
3282  case 8:
3283  fPsiPairCut = 0.2; //
3284  fDo2DPsiPairChi2 = kTRUE; //
3285  break;
3286  case 9:
3287  fPsiPairCut = 0.5; //
3288  break;
3289  default:
3290  AliError(Form("PsiPairCut not defined %d",psiCut));
3291  return kFALSE;
3292  }
3293 
3294  return kTRUE;
3295 }
3298  // Set Cut
3299  switch(doPhotonAsymmetryCut){
3300  case 0:
3304  break;
3305  case 1:
3308  fMinPhotonAsymmetry=0.04;
3309  break;
3310  case 2:
3313  fMinPhotonAsymmetry=0.06;
3314  break;
3315  case 3:
3318  fMinPhotonAsymmetry=0.05;
3319  break;
3320  default:
3321  AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
3322  return kFALSE;
3323  }
3324  fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
3325  return kTRUE;
3326 }
3329 
3330  switch(cosCut){
3331  case 0:
3332  fCosPAngleCut = -1;
3333  break;
3334  case 1:
3335  fCosPAngleCut = 0;
3336  break;
3337  case 2:
3338  fCosPAngleCut = 0.5;
3339  break;
3340  case 3:
3341  fCosPAngleCut = 0.75;
3342  break;
3343  case 4:
3344  fCosPAngleCut = 0.85;
3345  break;
3346  case 5:
3347  fCosPAngleCut = 0.88;
3348  break;
3349  case 6:
3350  fCosPAngleCut = 0.9;
3351  break;
3352  case 7:
3353  fCosPAngleCut = 0.95;
3354  break;
3355  default:
3356  AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
3357  return kFALSE;
3358  }
3359 
3360  return kTRUE;
3361 }
3364 
3365  switch(sharedElec){
3366  case 0:
3367  fDoSharedElecCut = kFALSE;
3369  fPhotonQualityCut = 0;
3370  break;
3371  case 1:
3372  fDoSharedElecCut = kTRUE;
3374  fPhotonQualityCut = 0;
3375  break;
3376  case 2:
3377  fDoSharedElecCut = kFALSE;
3379  fPhotonQualityCut = 1;
3380  break;
3381  case 3:
3382  fDoSharedElecCut = kFALSE;
3384  fPhotonQualityCut = 2;
3385  break;
3386  case 4:
3387  fDoSharedElecCut = kFALSE;
3389  fPhotonQualityCut = 3;
3390  break;
3391  default:
3392  AliError(Form("Shared Electron Cut not defined %d",sharedElec));
3393  return kFALSE;
3394  }
3395 
3396  return kTRUE;
3397 }
3400 
3401  switch(toClose){
3402  case 0:
3403  fDoToCloseV0sCut = kFALSE;
3404  fminV0Dist = 250;
3405  break;
3406  case 1:
3407  fDoToCloseV0sCut = kTRUE;
3408  fminV0Dist = 1;
3409  break;
3410  case 2:
3411  fDoToCloseV0sCut = kTRUE;
3412  fminV0Dist = 2;
3413  break;
3414  case 3:
3415  fDoToCloseV0sCut = kTRUE;
3416  fminV0Dist = 3;
3417  break;
3418  default:
3419  AliError(Form("Shared Electron Cut not defined %d",toClose));
3420  return kFALSE;
3421  }
3422  return kTRUE;
3423 }
3426 { // Set Cut
3427  switch(TRDElectronCut){
3428  case 0:
3429  fDoTRDPID=kFALSE;
3430  break;
3431  case 1:
3432  fDoTRDPID=kTRUE;
3433  fPIDTRDEfficiency=0.1;
3434  break;
3435  case 8:
3436  fDoTRDPID=kTRUE;
3437  fPIDTRDEfficiency=0.8;
3438  break;
3439  case 9:
3440  fDoTRDPID=kTRUE;
3441  fPIDTRDEfficiency=0.9;
3442  break;
3443  default:
3444  AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
3445  return kFALSE;
3446  }
3447 
3448  return kTRUE;
3449 }
3450 
3453  // Set Cut
3454  switch(DCAZPhotonPrimVtx){
3455  case 0: //
3456  fDCAZPrimVtxCut = 1000;
3457  break;
3458  case 1: //
3459  fDCAZPrimVtxCut = 10;
3460  break;
3461  case 2: //
3462  fDCAZPrimVtxCut = 5;
3463  break;
3464  case 3: //
3465  fDCAZPrimVtxCut = 4;
3466  break;
3467  case 4: //
3468  fDCAZPrimVtxCut = 3;
3469  break;
3470  case 5: //
3471  fDCAZPrimVtxCut = 2.5;
3472  break;
3473  case 6: //
3474  fDCAZPrimVtxCut = 2;
3475  break;
3476  case 7: //
3477  fDCAZPrimVtxCut = 1.5;
3478  break;
3479  case 8: //
3480  fDCAZPrimVtxCut = 1;
3481  break;
3482  case 9: //
3483  fDCAZPrimVtxCut = 0.5;
3484  break;
3485  default:
3486  cout<<"Warning: DCAZPhotonPrimVtx not defined "<<DCAZPhotonPrimVtx<<endl;
3487  return kFALSE;
3488  }
3489  return kTRUE;
3490 }
3491 
3494  // Set Cut
3495  switch(DCARPhotonPrimVtx){
3496  case 0: //
3497  fDCARPrimVtxCut = 1000;
3498  break;
3499  case 1: //
3500  fDCARPrimVtxCut = 10;
3501  break;
3502  case 2: //
3503  fDCARPrimVtxCut = 5;
3504  break;
3505  case 3: //
3506  fDCARPrimVtxCut = 4;
3507  break;
3508  case 4: //
3509  fDCARPrimVtxCut = 3;
3510  break;
3511  case 5: //
3512  fDCARPrimVtxCut = 2.5;
3513  break;
3514  case 6: //
3515  fDCARPrimVtxCut = 2;
3516  break;
3517  case 7: //
3518  fDCARPrimVtxCut = 1.5;
3519  break;
3520  case 8: //
3521  fDCARPrimVtxCut = 1;
3522  break;
3523  case 9: //
3524  fDCARPrimVtxCut = 0.5;
3525  break;
3526  default:
3527  cout<<"Warning: DCARPhotonPrimVtx not defined "<<DCARPhotonPrimVtx<<endl;
3528  return kFALSE;
3529  }
3530  return kTRUE;
3531 }
3532 
3535  // Set Cut
3536  switch(inOutPlane){
3537  case 0: //
3538  fInPlaneOutOfPlane = 0; // No Event Plane
3539  break;
3540  case 1: //
3541  fInPlaneOutOfPlane = 1; // In-Plane
3542  break;
3543  case 2: //
3544  fInPlaneOutOfPlane = 2; // Out-Of-Plane
3545  break;
3546  default:
3547  cout<<"Warning: In-Plane or Out-Of-Plane not defined "<<inOutPlane<<endl;
3548  return kFALSE;
3549  }
3550  return kTRUE;
3551 }
3552 
3553 //-------------------------------------------------------------
3555 
3556  if((period.CompareTo("LHC15o")==0)||(period.CompareTo("LHC15k1_plus3")==0)||(period.CompareTo("LHC15k1a1")==0)
3557  ||(period.CompareTo("LHC15k1b1")==0)||(period.CompareTo("LHC15k1a2")==0)||(period.CompareTo("LHC15k1a3")==0)
3558  ||(period.CompareTo("LHC15k1b2")==0)||(period.CompareTo("LHC15k1b3")==0)||(period.CompareTo("LHC15k1_plus")==0)
3559  ||(period.CompareTo("LHC15k1")==0)||(period.CompareTo("LHC15k1_plus2")==0)||(period.CompareTo("LHC15k1_plus21")==0)
3560  ||(period.CompareTo("LHC15k1_plus31")==0)||(period.CompareTo("LHC15k1_plus32")==0)){
3561  return kTRUE;
3562  }
3563  else{
3564  return kFALSE;
3565  }
3566 }
3567 
3568 //-------------------------------------------------------------
3570 { // Get Event Centrality
3571 
3572  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
3573  if(esdEvent){
3574  TString periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->GetPeriodName();
3575  if(GetUseNewMultiplicityFramework(periodName)){
3576  AliMultSelection *MultSelection = (AliMultSelection*)event->FindListObject("MultSelection");
3577  AliCentrality *fESDCentrality = (AliCentrality*)esdEvent->GetCentrality();
3578  if(fDetectorCentrality==0){
3579  if(fIsHeavyIon==2) return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
3580  else return MultSelection->GetMultiplicityPercentile("V0M",kTRUE);
3581  }else if(fDetectorCentrality==1) return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
3582  }else{
3583  AliCentrality *fESDCentrality = (AliCentrality*)esdEvent->GetCentrality();
3584  if(fDetectorCentrality==0){
3585  if(fIsHeavyIon==2) return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
3586  else return fESDCentrality->GetCentralityPercentile("V0M"); // default
3587  }else if(fDetectorCentrality==1) return fESDCentrality->GetCentralityPercentile("CL1");
3588  }
3589  }
3590 
3591  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
3592  if(aodEvent){
3593  if(aodEvent->GetHeader()){return ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();}
3594  }
3595 
3596  return -1;
3597 }
3598 //-------------------------------------------------------------
3599 Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliMCEvent *fMCEvent)
3600 { // Centrality Selection
3601  if(!fIsHeavyIon)return kTRUE;
3602 
3603  if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
3604  else if(fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-100%
3605 
3607  if(centrality<0)return kFALSE;
3608 
3609  Int_t centralityC=0;
3610  if (fModCentralityClass == 0){
3611  centralityC= Int_t(centrality/10);
3612  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
3613  return kTRUE;
3614  else return kFALSE;
3615  }
3616  else if (fModCentralityClass ==1){
3617  centralityC= Int_t(centrality);
3618  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
3619  return kTRUE;
3620  } else return kFALSE;
3621  }
3622  else if (fModCentralityClass ==2){
3623  centralityC= Int_t(centrality);
3624  if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
3625  return kTRUE;
3626  else return kFALSE;
3627  }
3628 
3629  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks();
3630  Int_t PrimaryTracks10[11][2] =
3631  {
3632  {9999,9999}, // 0
3633  {1210, 928}, // 10
3634  { 817, 658}, // 20
3635  { 536, 435}, // 30
3636  { 337, 276}, // 40
3637  { 197, 162}, // 50
3638  { 106, 100}, // 60
3639  { 51, 44}, // 70
3640  { 21, 18}, // 80
3641  { 0, 0}, // 90
3642  { 0, 0} // 100 // only max accessible
3643  };
3644  Int_t PrimaryTracks5a[11][2] =
3645  {
3646  {9999,9999}, // 0
3647  {1485,1168}, // 5
3648  {1210, 928}, // 10
3649  { 995, 795}, // 15
3650  { 817, 658}, // 20
3651  { 666, 538}, // 25
3652  { 536, 435}, // 30
3653  { 428, 350}, // 35
3654  { 337, 276}, // 40
3655  { 260, 214}, // 45
3656  { 0, 162} // 50 only max accessible
3657  };
3658  Int_t PrimaryTracks5b[11][2] =
3659  {
3660  { 260, 214}, // 45
3661  { 197, 162}, // 50
3662  { 147, 125}, // 55
3663  { 106, 100}, // 60
3664  { 75, 63}, // 65
3665  { 51, 44}, // 70
3666  { 34, 29}, // 75
3667  { 21, 18}, // 80
3668  { 13, 11}, // 85
3669  { 0, 0}, // 90
3670  { 0, 0} // 100 only max accessible
3671  };
3672  Int_t column = 0;
3673  if(event->IsA()==AliESDEvent::Class()) column = 0;
3674  if(event->IsA()==AliAODEvent::Class()) column = 1;
3675 
3676  if (fModCentralityClass == 3){
3677  if(fMCEvent){
3678  if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column])
3679  return kTRUE;
3680  else return kFALSE;
3681  }
3682  else{
3683  centralityC= Int_t(centrality/10);
3684  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
3685  return kTRUE;
3686  else return kFALSE;
3687  }
3688  }
3689  else if (fModCentralityClass ==4){
3690  if(fMCEvent){
3691  if(nprimaryTracks > PrimaryTracks5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5a[fCentralityMin][column])
3692  return kTRUE;
3693  else return kFALSE;
3694  }
3695  else{
3696  centralityC= Int_t(centrality);
3697  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
3698  return kTRUE;
3699  } else return kFALSE;
3700  }
3701  }
3702  else if (fModCentralityClass ==5){
3703  if(fMCEvent){
3704  if(nprimaryTracks > PrimaryTracks5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5b[fCentralityMin][column])
3705  return kTRUE;
3706  else return kFALSE;
3707  }
3708  else{
3709  centralityC= Int_t(centrality);
3710  if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
3711  return kTRUE;
3712  else return kFALSE;
3713  }
3714  }
3715 
3716  return kFALSE;
3717 }
3720  // Cut on z position of primary vertex
3721  Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
3722  Double_t fVertexZSPD = 0;
3723  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
3724  if(fESDEvent){
3725  fVertexZSPD = fESDEvent->GetPrimaryVertexSPD()->GetZ();
3726  }
3727  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
3728  if(fAODEvent){
3729  fVertexZSPD = fAODEvent->GetPrimaryVertexSPD()->GetZ();
3730  }
3731 
3732  if(TMath::Abs(fVertexZ)>fMaxVertexZ)return kFALSE;
3733 
3734  TString periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
3735  ->GetTask("V0ReaderV1"))->GetPeriodName();
3736  if (periodName.CompareTo("LHC11h")==0){
3737  if (TMath::Abs(fVertexZ-fVertexZSPD) > 0.1) return kFALSE;
3738  }
3739  if (fIsHeavyIon == 2){
3740  if(fUtils->IsFirstEventInChunk(event)) return kFALSE;
3741  if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
3742  if(fUtils->IsPileUpEvent(event)) return kFALSE;
3743  }
3744 
3745  return kTRUE;
3746 }
3748 
3750  // returns number of contributors to the vertex
3751 
3752  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
3753  if(fESDEvent){
3754  if (fESDEvent->GetPrimaryVertex() != NULL){
3755  if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
3756 // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl;
3757  return fESDEvent->GetPrimaryVertex()->GetNContributors();
3758  }
3759  }
3760 
3761  if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
3762  if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
3763 // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl;
3764  return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
3765  } else {
3766  AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
3767 // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
3768  return 0;
3769  }
3770  }
3771  }
3772 
3773  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
3774  if(fAODEvent){
3775  if (fAODEvent->GetPrimaryVertex() != NULL){
3776  if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
3777  return fAODEvent->GetPrimaryVertex()->GetNContributors();
3778  }
3779  }
3780  if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
3781  if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
3782  return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
3783  } else {
3784  AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
3785  return 0;
3786  }
3787  }
3788  }
3789  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
3790  return 0;
3791 }
3792 
3794 
3796 {
3797 
3798  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
3799 // AliTRDTriggerAnalysis *trdSelection= new AliTRDTriggerAnalysis();
3800 // trdSelection->CalcTriggers(fInputEvent);
3801 
3802  UInt_t isSelected = AliVEvent::kAny;
3803  TString periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->GetPeriodName();
3804  // cout << periodName.Data() << endl;
3805 
3806  if (fInputHandler==NULL) return kFALSE;
3807  if( fInputHandler->GetEventSelection() || fInputEvent->IsA()==AliAODEvent::Class()) {
3808 
3809  TString firedTrigClass = fInputEvent->GetFiredTriggerClasses();
3811  if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny;
3812  else {
3813  if (fIsHeavyIon == 1) fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
3814  else if (fIsHeavyIon == 2) fOfflineTriggerMask = AliVEvent::kINT7;
3815  else if (periodName.CompareTo("LHC11c") == 0 || periodName.CompareTo("LHC11d") == 0 || periodName.CompareTo("LHC11e") == 0 || periodName.CompareTo("LHC11f") == 0 || periodName.CompareTo("LHC11g") == 0 || periodName.CompareTo("LHC12a") == 0 || periodName.CompareTo("LHC12b") == 0 || periodName.CompareTo("LHC12c") == 0 || periodName.CompareTo("LHC12d") == 0 || periodName.CompareTo("LHC12f") == 0 || periodName.CompareTo("LHC12g") == 0 || periodName.CompareTo("LHC12h") == 0 || periodName.CompareTo("LHC12i") == 0 ||periodName.CompareTo("LHC13g") == 0 ) {
3816  fOfflineTriggerMask = AliVEvent::kINT7;
3817  // cout << "will take kINT7 as trigger mask" << endl;
3818  }
3819  else fOfflineTriggerMask = AliVEvent::kMB;
3820  }
3821  }
3822  // Get the actual offline trigger mask for the event and AND it with the
3823  // requested mask. If no mask requested select by default the event.
3824  // if (fPreSelCut) cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask for Precut: " << fOfflineTriggerMask << endl;
3825  // else cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask: " << fOfflineTriggerMask << endl;
3826 
3827  if (fOfflineTriggerMask){
3828  isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
3829  if (isSelected && !fPreSelCut){
3830 // if (fSpecialTriggerName.Contains("kTRD")){ // make special selection for TRD trigger
3831 // Bool_t bTRDHasFiredConfirmed= 0; // bool whether the TRD has triggered and has been read out due to that trigger & should have triggered
3832 // Bool_t bTRDClassContainedInTriggerList= 1; //check whether the trigger list contains the requested trigger
3833 // if (fSpecialSubTrigger>0){
3834 // if (fSpecialSubTriggerName.Contains("HSE")){
3835 // bTRDHasFiredConfirmed = trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHSE);
3836 // } else if (fSpecialSubTriggerName.Contains("HJT")){
3837 // bTRDHasFiredConfirmed = trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHJT);
3838 // } else if (fSpecialSubTriggerName.Contains("HEE")){
3839 // bTRDHasFiredConfirmed = trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHEE);
3840 // } else if (fSpecialSubTriggerName.Contains("HQU")){
3841 // bTRDHasFiredConfirmed = trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHQU);
3842 // }
3843 // if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data())) bTRDClassContainedInTriggerList = 0;
3844 // } else {
3845 // bTRDHasFiredConfirmed = trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHQU) || trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHSE) || trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHJT) || trdSelection->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHEE);
3846 // }
3847 // if (!bTRDHasFiredConfirmed || !bTRDClassContainedInTriggerList) isSelected = 0;
3848 // } else { // more general condition for all other sub-triggers
3849 // if (fSpecialTriggerName.Contains("kEMCE"))cout << fSpecialTriggerName.Data() << "\t" <<fSpecialSubTriggerName.Data()<< endl;
3850  if (fSpecialSubTrigger>0){
3851  if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 0;
3852  }
3853 // if (fSpecialTriggerName.Contains("kEMCE"))cout <<firedTrigClass << endl;
3854 // }
3855  }
3856  }
3857  }
3858  fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
3859 
3860  // Fill Histogram
3861  if(hTriggerClass){
3862  if (fIsSDDFired) hTriggerClass->Fill(33);
3863  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
3864  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
3865  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
3866  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
3867  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
3868  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
3869  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
3870  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
3871  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
3872  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
3873  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
3874  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
3875  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
3876  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
3877  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
3878  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
3879  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
3880  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
3881  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
3882  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
3883  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
3884  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
3885  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
3886  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
3887  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
3888  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
3889  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
3890  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
3891  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
3892  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
3893  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
3894  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
3895  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
3896  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
3897  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
3898  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
3899  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28);
3900  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29);
3901  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(30);
3902  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(31);
3903  if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(34);
3904  }
3905 
3906  if(hTriggerClassSelected && isSelected){
3907  if (!fIsSDDFired) hTriggerClassSelected->Fill(33);
3908  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
3909  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
3910  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
3911  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
3912  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
3913  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
3914  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
3915  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
3916  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
3917  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
3918  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
3919  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
3920  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
3921  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
3922  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
3923  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
3924  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
3925  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
3926  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
3927  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
3928  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
3929  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
3930  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
3931  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
3932  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
3933  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
3934  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
3935  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
3936  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
3937  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
3938  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
3939  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
3940  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
3941  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
3942  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
3943  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
3944  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28);
3945  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29);
3946  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30);
3947  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31);
3948  }
3949 
3950  if(!isSelected)return kFALSE;
3951 
3952  return kTRUE;
3953 
3954 }
3955 
3958  // Get first TPC row
3959  Int_t firstTPCRow = 0;
3960  Double_t radiusI = 84.8;
3961  Double_t radiusO = 134.6;
3962  Double_t radiusOB = 198.;
3963  Double_t rSizeI = 0.75;
3964  Double_t rSizeO = 1.;
3965  Double_t rSizeOB = 1.5;
3966  Int_t nClsI = 63;
3967  Int_t nClsIO = 127;
3968 
3969  if(radius <= radiusI){
3970  return firstTPCRow;
3971  }
3972  if(radius>radiusI && radius<=radiusO){
3973  firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
3974  }
3975  if(radius>radiusO && radius<=radiusOB){
3976  firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
3977  }
3978 
3979  if(radius>radiusOB){
3980  firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
3981  }
3982 
3983  return firstTPCRow;
3984 }
3985 
3986 Bool_t AliConversionCuts::CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const {
3988  if(GetCosineOfPointingAngle(photon, event) < fCosPAngleCut){
3989  return kFALSE;
3990  }
3991  return kTRUE;
3992 }
3993 
3995  // calculates the pointing angle of the recalculated V0
3996 
3997  Double_t momV0[3] = {0,0,0};
3998  if(event->IsA()==AliESDEvent::Class()){
3999  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
4000  if(!esdEvent) return -999;
4001  AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
4002  if(!v0) return -999;
4003  v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
4004  }
4005  if(event->IsA()==AliAODEvent::Class()){
4006  momV0[0] = photon->GetPx();
4007  momV0[1] = photon->GetPy();
4008  momV0[2] = photon->GetPz();
4009  }
4010 
4011  //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
4012  Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
4013  photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
4014  photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
4015 
4016  Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
4017  Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
4018 
4019 
4020  Double_t cosinePointingAngle = -999;
4021  if(momV02*PosV02 > 0.0)
4022  cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
4023 
4024  return cosinePointingAngle;
4025 }
4026 
4029 
4030  if (fDo2DPsiPairChi2){
4031  if (TMath::Abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut ){
4032  return kTRUE;
4033  } else {
4034  return kFALSE;
4035  }
4036  } else {
4037  if(TMath::Abs(photon->GetPsiPair()) > fPsiPairCut){
4038  return kFALSE;}
4039  else{return kTRUE;}
4040  }
4041 }
4042 
4045  // returns TString with current cut number
4046  return fCutStringRead;
4047 }
4048 
4051 
4052  Int_t posLabel = photon->GetTrackLabelPositive();
4053  Int_t negLabel = photon->GetTrackLabelNegative();
4054 
4055  fElectronLabelArray[nV0*2] = posLabel;
4056  fElectronLabelArray[(nV0*2)+1] = negLabel;
4057 }
4060 
4061  Int_t posLabel = photon->GetTrackLabelPositive();
4062  Int_t negLabel = photon->GetTrackLabelNegative();
4063 
4064  for(Int_t i = 0; i<nV0s*2;i++){
4065  if(i==nV0*2) continue;
4066  if(i==(nV0*2)+1) continue;
4067  if(fElectronLabelArray[i] == posLabel){
4068  return kFALSE;}
4069  if(fElectronLabelArray[i] == negLabel){
4070  return kFALSE;}
4071  }
4072 
4073  return kTRUE;
4074 }
4077 
4078 
4079  Double_t posX = photon->GetConversionX();
4080  Double_t posY = photon->GetConversionY();
4081  Double_t posZ = photon->GetConversionZ();
4082 
4083  for(Int_t i = 0;i<photons->GetEntries();i++){
4084  if(nV0 == i) continue;
4085  AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
4086  Double_t posCompX = photonComp->GetConversionX();
4087  Double_t posCompY = photonComp->GetConversionY();
4088  Double_t posCompZ = photonComp->GetConversionZ();
4089 
4090  Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
4091 
4092  if(dist < fminV0Dist*fminV0Dist){
4093  if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
4094  else {
4095  return kFALSE;}
4096  }
4097 
4098  }
4099  return kTRUE;
4100 }
4102 void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent){
4103 
4104  TString periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->GetPeriodName();
4105 
4106 
4107  if(fNotRejectedStart){
4108  delete[] fNotRejectedStart;
4109  fNotRejectedStart = NULL;
4110  }
4111  if(fNotRejectedEnd){
4112  delete[] fNotRejectedEnd;
4113  fNotRejectedEnd = NULL;
4114  }
4115  if(fGeneratorNames){
4116  delete[] fGeneratorNames;
4117  fGeneratorNames = NULL;
4118  }
4119 
4120  if(rejection == 0) return; // No Rejection
4121 
4122  AliGenCocktailEventHeader *cHeader = 0x0;
4123  AliAODMCHeader *cHeaderAOD = 0x0;
4124  Bool_t headerFound = kFALSE;
4125  AliMCEvent *mcEvent = 0x0;
4126  TClonesArray *mcEventAOD = 0x0;
4127  if(MCEvent->IsA()==AliMCEvent::Class()){
4128  if (dynamic_cast<AliMCEvent*>(MCEvent)){
4129  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
4130  if(cHeader) headerFound = kTRUE;
4131  }
4132  }
4133  if(MCEvent->IsA()==AliAODEvent::Class()){ // MCEvent is a AODEvent in case of AOD
4134  cHeaderAOD = dynamic_cast<AliAODMCHeader*>(MCEvent->FindListObject(AliAODMCHeader::StdBranchName()));
4135  mcEventAOD = dynamic_cast<TClonesArray*>(MCEvent->FindListObject(AliAODMCParticle::StdBranchName()));
4136 
4137 
4138  if(cHeaderAOD) headerFound = kTRUE;
4139  }
4140 
4141  if(headerFound){
4142  TList *genHeaders = 0x0;
4143  if(cHeader) genHeaders = cHeader->GetHeaders();
4144  if(cHeaderAOD){
4145  genHeaders = cHeaderAOD->GetCocktailHeaders();
4146  if(genHeaders->GetEntries()==1){
4148  return;
4149  }
4150  }
4151  AliGenEventHeader* gh = 0;
4152  fnHeaders = 0;
4153  Int_t firstindexA = 0;
4154  Int_t lastindexA = -1;
4155  if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
4156  if(rejection == 2){ // TList of Headers Names
4157  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
4158  gh = (AliGenEventHeader*)genHeaders->At(i);
4159  TString GeneratorName = gh->GetName();
4160  lastindexA = lastindexA + gh->NProduced();
4161 // cout << i << "\t" << GeneratorName.Data() << endl;
4162  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
4163  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
4164  if(GeneratorName.CompareTo(GeneratorInList) == 0){
4165  if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
4166  if(mcEvent){
4167  if (mcEvent->Particle(firstindexA)->GetPdgCode() == fAddedSignalPDGCode ) {
4168  if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){
4169  if (gh->NProduced() > 10 && mcEvent->Particle(firstindexA+10)->GetPdgCode() == fAddedSignalPDGCode ){
4170 // cout << "cond 1: "<< fnHeaders << endl;
4171  fnHeaders++;
4172  continue;
4173  }
4174  continue;
4175  } else {
4176 // cout << "cond 2: " << fnHeaders << endl;
4177  fnHeaders++;
4178  continue;
4179  }
4180  }
4181  }
4182  if ( mcEventAOD){
4183  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(mcEventAOD->At(firstindexA));
4184  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
4185  if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){
4186  if (gh->NProduced() > 10){
4187  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(mcEventAOD->At(firstindexA+10));
4188  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
4189 // cout << "cond 1: " << fnHeaders << endl;
4190  fnHeaders++;
4191  continue;
4192  }
4193  }
4194  continue;
4195  } else {
4196 // cout << "cond 2: " << fnHeaders << endl;
4197  fnHeaders++;
4198  continue;
4199  }
4200  }
4201  }
4202  continue;
4203  }
4204 // cout << "cond 3: "<< fnHeaders << endl;
4205  fnHeaders++;
4206  continue;
4207  }
4208  }
4209  firstindexA = firstindexA + gh->NProduced();
4210  }
4211  }
4212 // cout << "number of headers: " <<fnHeaders << endl;
4213 
4217 
4218  if(rejection == 1 || rejection == 3){
4219  fNotRejectedStart[0] = 0;
4220  fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
4221  fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
4222  return;
4223  }
4224 
4225  Int_t firstindex = 0;
4226  Int_t lastindex = -1;
4227  Int_t number = 0;
4228 
4229  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
4230  gh = (AliGenEventHeader*)genHeaders->At(i);
4231  TString GeneratorName = gh->GetName();
4232  lastindex = lastindex + gh->NProduced();
4233  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
4234  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
4235 // cout << i << "\t" << GeneratorName.Data() << endl;
4236  if(GeneratorName.CompareTo(GeneratorInList) == 0){
4237  if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
4238  if(mcEvent){
4239  if (mcEvent->Particle(firstindex)->GetPdgCode() == fAddedSignalPDGCode ) {
4240  if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){
4241 // cout << "produced " << gh->NProduced() << " with box generator" << endl;
4242  if (gh->NProduced() > 10 && mcEvent->Particle(firstindex+10)->GetPdgCode() == fAddedSignalPDGCode){
4243 // cout << "one of them was a pi0 or eta" << endl;
4244  fNotRejectedStart[number] = firstindex;
4245  fNotRejectedEnd[number] = lastindex;
4246  fGeneratorNames[number] = GeneratorName;
4247  number++;
4248 // cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4249  continue;
4250  }
4251  } else {
4252  fNotRejectedStart[number] = firstindex;
4253  fNotRejectedEnd[number] = lastindex;
4254  fGeneratorNames[number] = GeneratorName;
4255  number++;
4256  continue;
4257  }
4258  }
4259  }
4260  if ( mcEventAOD){
4261  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(mcEventAOD->At(firstindex));
4262  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
4263  if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){
4264  if (gh->NProduced() > 10) {
4265  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(mcEventAOD->At(firstindex+10));
4266  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
4267  fNotRejectedEnd[number] = lastindex;
4268  fNotRejectedStart[number] = firstindex;
4269  fGeneratorNames[number] = GeneratorName;
4270  number++;
4271  }
4272  continue;
4273  }
4274  } else {
4275  fNotRejectedStart[number] = firstindex;
4276  fNotRejectedEnd[number] = lastindex;
4277  fGeneratorNames[number] = GeneratorName;
4278  number++;
4279  continue;
4280  }
4281  }
4282  }
4283  continue;
4284  } else {
4285  fNotRejectedStart[number] = firstindex;
4286  fNotRejectedEnd[number] = lastindex;
4287  fGeneratorNames[number] = GeneratorName;
4288 // cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4289  number++;
4290  continue;
4291  }
4292 
4293  }
4294  }
4295  firstindex = firstindex + gh->NProduced();
4296  }
4297 // for (Int_t i = 0; i < number; i++){
4298 // cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl;
4299 // }
4300 
4301  } else { // No Cocktail Header Found
4302  fNotRejectedStart = new Int_t[1];
4303  fNotRejectedEnd = new Int_t[1];
4304 
4305  fnHeaders = 1;
4306  fNotRejectedStart[0] = 0;
4307  fNotRejectedEnd[0] = mcEvent->GetNumberOfPrimaries()-1;
4308  fGeneratorNames = new TString[1];
4309  fGeneratorNames[0] = "NoCocktailGeneratorFound";
4310 
4311  AliGenPythiaEventHeader *mcHeaderPythia = dynamic_cast<AliGenPythiaEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
4312  if (mcHeaderPythia) fGeneratorNames[0] = "NoCocktailGeneratorFound_Pythia";
4313  AliGenDPMjetEventHeader *mcHeaderPhojet = dynamic_cast<AliGenDPMjetEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
4314  if (mcHeaderPhojet) fGeneratorNames[0] = "NoCocktailGeneratorFound_Phojet";
4315  AliGenHijingEventHeader *mcHeaderHijing = dynamic_cast<AliGenHijingEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
4316  if (mcHeaderHijing) fGeneratorNames[0] = "NoCocktailGeneratorFound_Hijing";
4317 
4319  }
4320 
4321 }
4322 
4323 //_________________________________________________________________________
4324 Int_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliMCEvent *mcEvent, AliVEvent *InputEvent){
4325 
4326  // Not Accepted == kFALSE == 0
4327  // Accepted == kTRUE == 1
4328  // FirstHeader == kTRUE == 3
4329  if(index < 0) return 0; // No Particle
4330 
4331 // if (index == 100){
4332 // cout << "possible headers" << endl;
4333 // for(Int_t i = 0;i<fnHeaders;i++){
4334 // cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl;
4335 // }
4336 // }
4337  Int_t accepted = 0;
4338  if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
4339  if( index >= mcEvent->GetNumberOfPrimaries()){ // Secondary Particle
4340  if( ((TParticle*)mcEvent->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother??
4341  return IsParticleFromBGEvent(((TParticle*)mcEvent->Particle(index))->GetMother(0),mcEvent,InputEvent);
4342  }
4343  for(Int_t i = 0;i<fnHeaders;i++){
4344  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
4345  accepted = 1;
4346  if(i == 0) accepted = 2; // MB Header
4347  }
4348  }
4349  }
4350  else if(InputEvent->IsA()==AliAODEvent::Class()){
4351  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
4352  if (AODMCTrackArray){
4353  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
4354  if(!aodMCParticle) return 1; // Photon Without a Mother ? --> Accepted
4355  if(!aodMCParticle->IsPrimary()){
4356  if( aodMCParticle->GetMother() < 0) return 1;// Secondary Particle without Mother??
4357  return IsParticleFromBGEvent(aodMCParticle->GetMother(),mcEvent,InputEvent);
4358  }
4359  index = abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
4360  for(Int_t i = 0;i<fnHeaders;i++){
4361  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
4362  accepted = 1;
4363  if(i == 0) accepted = 2; // MB Header
4364  }
4365  }
4366  }
4367  }
4368 
4369  return accepted;
4370 }
4371 
4372 //_________________________________________________________________________
4373 Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon){
4374 
4375  if ( !IsTriggerSelected(InputEvent) )
4376  return 3;
4377 
4378  if(isHeavyIon != 0 && !(IsCentralitySelected(InputEvent,MCEvent)))
4379  return 1; // Check Centrality --> Not Accepted => eventQuality = 1
4380 
4381 
4382  if(isHeavyIon == 0 && GetIsFromPileup()){
4383  if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
4384 
4385  return 6; // Check Pileup --> Not Accepted => eventQuality = 6
4386  }
4387  }
4388 
4389  Bool_t hasV0And = ReaderCuts->HasV0AND();
4390  Bool_t isSDDFired = ReaderCuts->IsSDDFired();
4391  if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent)
4392  return 7; // With SDD requested but no fired
4393 
4394  if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
4395  return 8; // V0AND requested but no fired
4396 
4397  if(hCentrality)hCentrality->Fill(GetCentrality(InputEvent));
4400  ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
4401  ->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks());
4402 
4403  return 0;
4404 }
4405 
4406 //_________________________________________________________________________
4407 Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliMCEvent *mcEvent, AliVEvent *InputEvent){
4408  if (!(period.CompareTo("LHC12f1a") == 0 || period.CompareTo("LHC12f1b") == 0 || period.CompareTo("LHC12i3") == 0 || period.CompareTo("LHC11a10a") == 0 || period.CompareTo("LHC11a10b") == 0 || period.CompareTo("LHC11a10b_bis") == 0 || period.CompareTo("LHC11a10a_bis") == 0 || period.CompareTo("LHC11a10b_plus") == 0 || period.Contains("LHC13d2")|| period.Contains("LHC14a1") ||
4409  period.CompareTo("LHC13e7") == 0 || period.Contains("LHC13b2_efix") || period.CompareTo("LHC14b2") == 0 )) return 1.;
4410 
4411  Int_t kCaseGen = 0;
4412  for (Int_t i = 0; i < fnHeaders; i++){
4413  if (index >= fNotRejectedStart[i] && index < fNotRejectedEnd[i]+1){
4414  if (fGeneratorNames[i].CompareTo("Pythia") == 0){
4415  kCaseGen = 1;
4416  } else if (fGeneratorNames[i].CompareTo("DPMJET") == 0){
4417  kCaseGen = 2;
4418  } else if (fGeneratorNames[i].CompareTo("HIJING") == 0 ||
4419  fGeneratorNames[i].CompareTo("Hijing") == 0 ||
4420  fGeneratorNames[i].Contains("hijing")){
4421  kCaseGen = 3;
4422  } else if (fGeneratorNames[i].CompareTo("BOX") == 0){
4423  kCaseGen = 4;
4424  } else if (fGeneratorNames[i].CompareTo("PARAM") == 0){
4425  kCaseGen = 5;
4426  } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound") == 0){
4427  kCaseGen = 6;
4428  } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Pythia") == 0){
4429  kCaseGen = 1;
4430  } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Phojet") == 0){
4431  kCaseGen = 2;
4432  } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Hijing") == 0){
4433  kCaseGen = 3;
4434  }
4435  if (period.Contains("LHC13d2") || period.CompareTo("LHC13e7") == 0 || period.Contains("LHC13b2_efix") || period.Contains("LHC14a1") || period.CompareTo("LHC14b2") == 0 ){
4436  kCaseGen = 3;
4437  }
4438  }
4439  }
4440  if (kCaseGen == 0) return 1;
4441 
4442 
4443  Double_t mesonPt = 0;
4444  Double_t mesonMass = 0;
4445  Int_t PDGCode = 0;
4446  if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
4447  mesonPt = ((TParticle*)mcEvent->Particle(index))->Pt();
4448  mesonMass = ((TParticle*)mcEvent->Particle(index))->GetCalcMass();
4449  PDGCode = ((TParticle*)mcEvent->Particle(index))->GetPdgCode();
4450  }
4451  else if(InputEvent->IsA()==AliAODEvent::Class()){
4452  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
4453  if (AODMCTrackArray){
4454  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
4455  mesonPt = aodMCParticle->Pt();
4456  mesonMass = aodMCParticle->GetCalcMass();
4457  PDGCode = aodMCParticle->GetPdgCode();
4458  } else {
4459  return 1;
4460  }
4461  }
4462 
4463  Float_t functionResultMC = 1.;
4464  if (kCaseGen == 1){ // Pythia 6
4465  Float_t dNdyMC = 2.1462;
4466  Float_t nMC = 7.06055;
4467  Float_t tMC = 0.12533;
4468  if ( PDGCode == 111){
4469  dNdyMC = 2.1462;
4470  nMC = 7.06055;
4471  tMC = 0.12533;
4472  } else if ( PDGCode == 221){
4473  dNdyMC = 0.2357;
4474  nMC = 5.9105;
4475  tMC = 0.1525;
4476  }
4477  functionResultMC = dNdyMC / ( 2 * TMath::Pi())*(nMC-1.)*(nMC-2.) / (nMC*tMC*(nMC*tMC+mesonMass*(nMC-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nMC*tMC), -nMC);
4478  } else if (kCaseGen == 2){ // Phojet
4479  Float_t dNdyMC = 2.35978;
4480  Float_t nMC = 6.81795;
4481  Float_t tMC = 0.11492;
4482  if ( PDGCode == 111){
4483  dNdyMC = 2.35978;
4484  nMC = 6.81795;
4485  tMC = 0.11492;
4486  } else if ( PDGCode == 221){
4487  dNdyMC = 0.3690;
4488  nMC = 5.55809;
4489  tMC = 0.13387;
4490  }
4491  functionResultMC = dNdyMC / ( 2 * TMath::Pi())*(nMC-1.)*(nMC-2.) / (nMC*tMC*(nMC*tMC+mesonMass*(nMC-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nMC*tMC), -nMC);
4492  } else if (kCaseGen == 4){ // BOX generators pp
4493  // functionResultMC = 1./sqrt(1.-mesonMass*mesonMass/((mesonMass*mesonMass+mesonPt*mesonPt)*cosh(mesonY)*cosh(mesonY)));
4494  Float_t a = 0.23437;
4495  Float_t b = 5.6661;
4496  Float_t c = -1430.5863;
4497  Float_t d = -0.6966624;
4498  Float_t e = 252.3742;
4499  if ( PDGCode == 111){
4500  a = 0.23437;
4501  b = 5.6661;
4502  c = -1430.5863;
4503  d = -0.6966624;
4504  e = 252.3742;
4505  } else if ( PDGCode == 221){
4506  a = 0.10399;
4507  b = 4.35311;
4508  c = -12.17723;
4509  d = -0.01172;
4510  e =1.85140;
4511  }
4512  functionResultMC = a*TMath::Power(mesonPt,-1.*(b+c/(TMath::Power(mesonPt,d)+e)))*1./mesonPt *1./1.6 *1./(2.* TMath::Pi());
4513  // cout << functionResultMC << endl;
4514  } else if (kCaseGen == 3 ){ // HIJING
4515  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){
4516  functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt);
4517  }
4518  if ( PDGCode == 221 && fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0){
4519  functionResultMC = hReweightMCHistEta->Interpolate(mesonPt);
4520  }
4521  if ( PDGCode == 310 && fDoReweightHistoMCK0s && hReweightMCHistK0s!= 0x0){
4522  functionResultMC = hReweightMCHistK0s->Interpolate(mesonPt);
4523  }
4524  }
4525 
4526  Float_t functionResultData = 1;
4527  if (kCaseGen == 1 || kCaseGen == 2 || kCaseGen == 4 ){
4528  Float_t dNdyData = 2.2328;
4529  Float_t nData = 7.1473;
4530  Float_t tData = 0.1346;
4531  if ( PDGCode == 111){
4532  dNdyData = 2.2328;
4533  nData = 7.1473;
4534  tData = 0.1346;
4535  } else if ( PDGCode == 221){
4536  dNdyData = 0.38992; //be careful this fit is not optimal, eta in data still has problems
4537  nData = 5.72778;
4538  tData = 0.13835;
4539  }
4540  functionResultData = dNdyData / ( 2 * TMath::Pi())*(nData-1.)*(nData-2.) / (nData*tData*(nData*tData+mesonMass*(nData-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nData*tData), -nData);
4541  // cout << functionResultData << endl;
4542  } else {
4543  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && fFitDataPi0!= 0x0){
4544  functionResultData = fFitDataPi0->Eval(mesonPt);
4545  }
4546  if ( PDGCode == 221 && fDoReweightHistoMCEta && fFitDataEta!= 0x0){
4547  functionResultData = fFitDataEta->Eval(mesonPt);
4548  }
4549  if ( PDGCode == 310 && fDoReweightHistoMCK0s && fFitDataK0s!= 0x0){
4550  functionResultData = fFitDataK0s->Eval(mesonPt);
4551  }
4552 
4553  }
4554 
4555  Double_t weight = 1;
4556  if (PDGCode == 111 || PDGCode == 221){
4557  if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){
4558  weight = functionResultData/functionResultMC;
4559  if ( kCaseGen == 3){
4560  if (PDGCode == 111){
4561  if (!(fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode == 111)){
4562  weight = 1.;
4563  }
4564  }
4565  if (PDGCode == 221){
4566  if (!(fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0 && PDGCode == 221)){
4567  weight = 1.;
4568  }
4569  }
4570  }
4571  if (!isfinite(functionResultData)) weight = 1.;
4572  if (!isfinite(weight)) weight = 1.;
4573  }
4574  } else if (PDGCode == 310 && functionResultMC != 0 && isfinite(functionResultMC)){
4575  weight = functionResultMC;
4576  }
4577 
4578  // if (fModCentralityClass == 0 && fCentralityMin == 4 && fCentralityMax == 6 && PDGCode == 111){
4579  // cout << period.Data() << "\t" << kCaseGen << "\t" <<fModCentralityClass<< "\t" <<fCentralityMin<< "\t" <<fCentralityMax << "\t" << mesonPt << "\t" <<mesonMass<< "\t"<<functionResultData << "\t"<< functionResultMC << "\t" << weight <<endl;
4580  // }
4581  return weight;
4582 }
4585  //Create and return standard 2010 PbPb cuts
4586  AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
4587  if(!cuts->InitializeCutsFromCutString("100000204209297002322000000")){
4588  cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
4589  return cuts;
4590 }
4591 
4594  //Create and return standard 2010 PbPb cuts
4595  AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010pp","StandardCuts2010pp");
4596  if(!cuts->InitializeCutsFromCutString("000001100209366300380000000")){
4597  cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
4598  return cuts;
4599 }
4602 
4603  if(periodName.CompareTo("LHC12g") == 0 || //pilot run 2012
4604  periodName.CompareTo("LHC13b") == 0 || //mainly minimum bias
4605  periodName.CompareTo("LHC13c") == 0 || //mainly minimum bias
4606  periodName.CompareTo("LHC13d") == 0 || //mainly triggered
4607  periodName.CompareTo("LHC13e") == 0 || //mainly triggered
4608  periodName.CompareTo("LHC13c3") == 0 || //MC Starlight, anchor LHC13d+e
4609  periodName.CompareTo("LHC13c2") == 0 || //MC Starlight, coherent J/Psi, UPC muon anchor LHC13d+e
4610  periodName.CompareTo("LHC13b4") == 0 || //MC Pythia 6 (Jet-Jet), anchor LHC13b
4611  periodName.CompareTo("LHC13b2_fix_1") == 0 || //MC DPMJET, anchr LHC13b+c
4612  periodName.CompareTo("LHC13b2_efix_p1") == 0 || //MC DPMJET, anchr LHC13b+c
4613  periodName.CompareTo("LHC13b2_efix_p2") == 0 || //MC DPMJET, anchr LHC13b+c
4614  periodName.CompareTo("LHC13b2_efix_p3") == 0 || //MC DPMJET, anchr LHC13b+c
4615  periodName.CompareTo("LHC13b2_efix_p4") == 0 || //MC DPMJET, anchr LHC13b+c
4616  periodName.CompareTo("LHC13e7") == 0 || //MC DPMJET, anchr LHC13b+c
4617  periodName.CompareTo("LHC13b3") == 0 || //MC HIJING, weighted to number of events per run, anchor LHC13b
4618  periodName.CompareTo("LHC13b2") == 0 || // MC DPMJET, wrong energy, anchor LHC13b
4619  periodName.CompareTo("LHC13b2_plus") == 0 || // MC DPMJET, weighted to number event per run, anchor LHC13b
4620  periodName.CompareTo("LHC13c1_bis") == 0 || // MC AMPT fast generation, pT hardbin, anchor ?
4621  periodName.CompareTo("LHC13c1") == 0 || // MC AMPT fast generation, anchor ?
4622  periodName.CompareTo("LHC13b1") == 0 || // MC DPMJET, fragments, with fixed label 0, anchor LHC12g
4623  periodName.CompareTo("LHC12g4b_fix") == 0 || // MC DPMJET, with fixed label 0, anchor LHC12g
4624  periodName.CompareTo("LHC12g1_fix") == 0 || // MC ?, with fixed label 0, anchor LHC12g
4625  periodName.CompareTo("LHC12g4c") == 0 || // MC DPMJET, shifted vertex runs, anchor LHC12g
4626  periodName.CompareTo("LHC12h6") == 0 || // MC muon cocktail, anchor LHC12g
4627  periodName.CompareTo("LHC12g4b") == 0 || // MC DPMJET 3rd iteration, anchor LHC12g
4628  periodName.CompareTo("LHC12g4a") == 0 || // MC DPMJET improved, anchor LHC12g
4629  periodName.CompareTo("LHC12g4") == 0 || // MC DPMJET, anchor LHC12g
4630  periodName.CompareTo("LHC12g5") == 0 || // MC PHOJET, anchor LHC12g
4631  periodName.CompareTo("LHC12g2") == 0 || // MC Starlight background, anchor LHC12g
4632  periodName.CompareTo("LHC12g1") == 0 ) // MC ?, anchor LHC12g
4633  {
4634  printf(" Gamma Conversion Cuts %s :: pPb Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),-0.465);
4635  SetEtaShift(-0.465);
4636  }
4637  else if(periodName.CompareTo("LHC13f") == 0 ||
4638  periodName.CompareTo("LHC13c6b") == 0 ||// MC Jpsi -> mumu, anchor LHC13f
4639  periodName.CompareTo("LHC13c5") == 0 || //MC Starlight, gamma gamma UPC muon, anchor LHC13f
4640  periodName.CompareTo("LHC13c4") == 0 )//MC Starlight, coherent JPsi, UPC muon, anchor LHC13f
4641  {
4642  printf(" Gamma Conversion Cuts %s :: Pbp Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),0.465);
4643  SetEtaShift(+0.465);
4644  }
4645  else printf(" Gamma Conversion Cuts %s :: Automatic Eta Shift requested but Period is not known -> No Shift \n\n",(GetCutNumber()).Data());
4646 }
4647 
4650 
4651  //GetPhotonPhi() 0-2 Pi //eventPlaneAngle -1pi-1pi
4652  eventPlaneAngle=eventPlaneAngle+TMath::Pi();
4653  Double_t gammaToEPAngle = eventPlaneAngle-photonPhi;
4654  if(gammaToEPAngle < 0) gammaToEPAngle=gammaToEPAngle+2*TMath::Pi();
4655  gammaToEPAngle = gammaToEPAngle-TMath::Pi(); // angle from -pi +pi
4656 
4657  if(!fInPlaneOutOfPlane){
4658  if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
4659  return kTRUE;
4660  }
4661  else if(fInPlaneOutOfPlane == 1){
4662  if(TMath::Abs(gammaToEPAngle)<=0.25*TMath::Pi() || TMath::Abs(gammaToEPAngle)>=0.75*TMath::Pi()){
4663  if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
4664  return kTRUE;
4665  }
4666  else return kFALSE;
4667  }
4668  else if(fInPlaneOutOfPlane == 2){
4669  if(TMath::Abs(gammaToEPAngle)>0.25*TMath::Pi() && TMath::Abs(gammaToEPAngle)<0.75*TMath::Pi()){
4670  if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
4671  return kTRUE;
4672  }
4673  else return kFALSE;
4674  }
4675  return kFALSE;
4676 
4677 }
4678 
4681 
4682  AliAODTrack * negTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelNegative()));
4683  AliAODTrack * posTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelPositive()));
4684 
4685  if(!negTrack || !posTrack) {
4686  return 0;
4687  }
4688  if(negTrack->Charge() == posTrack->Charge()){
4689  return 0;
4690  }
4691  Int_t nClusterITSneg = negTrack->GetITSNcls();
4692  Int_t nClusterITSpos = posTrack->GetITSNcls();
4693 // cout << nClusterITSneg << "\t" << nClusterITSpos <<endl;
4694 
4695  if (nClusterITSneg > 1 && nClusterITSpos > 1){
4696  return 3;
4697  } else if (nClusterITSneg > 1 || nClusterITSpos > 1){
4698  return 2;
4699  } else {
4700  return 1;
4701  }
4702  return 0;
4703 
4704 }
4705 
4706 //***********************************************************************************
4707 //***********************************************************************************
4708 //***********************************************************************************
4709 //***********************************************************************************
4710 //***********************************************************************************
4711 // WARNING: this class is no longer supported,
4712 // please use AliConversionPhotonCuts and AliConvEventCuts
4713 //***********************************************************************************
4714 //***********************************************************************************
4715 //***********************************************************************************
4716 //***********************************************************************************
4717 //***********************************************************************************
Double_t fPIDMinPPionRejectionLowP
Double_t fTofPIDnSigmaAboveElectronLine
Bool_t SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
void GetCorrectEtaShiftFromPeriod(TString periodName)
AliPIDResponse * fPIDResponse
Double_t fPIDnSigmaAbovePionLine
Bool_t SetSinglePtCut(Int_t singlePtCut)
Bool_t SetCut(cutIds cutID, Int_t cut)
Bool_t PhotonIsSelectedAODMC(AliAODMCParticle *particle, TClonesArray *aodmcArray, Bool_t checkForConvertedGamma=kTRUE)
Bool_t SetMultiplicityMethod(Int_t multiplicityMethod)
Bool_t SetV0Finder(Int_t v0FinderType)
Int_t IsParticleFromBGEvent(Int_t index, AliMCEvent *mcEvent, AliVEvent *InputEvent=0x0)
Bool_t SetTRDElectronCut(Int_t TRDElectronCut)
Double_t GetArmenterosAlpha() const
double Double_t
Definition: External.C:58
Double_t fPIDMinPProtonRejectionLowP
virtual Double_t GetPz() const =0
Definition: External.C:236
Bool_t PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent *event)
const char * title
Definition: MakeQAPdf.C:27
Double_t fPIDMinPKaonRejectionLowP
Int_t IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon)
void GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent)
Bool_t ArmenterosQtCut(AliConversionPhotonBase *photon)
Bool_t SetQtMaxCut(Int_t QtMaxCut)
Bool_t PhotonCuts(AliConversionPhotonBase *photon, AliVEvent *event)
Bool_t SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut)
static AliVTrack * GetTrack(AliVEvent *event, Int_t label)
centrality
void FillPhotonCutIndex(Int_t photoncut)
Bool_t SetPsiPairCut(Int_t psiCut)
Bool_t InPlaneOutOfPlaneCut(Double_t photonPhi, Double_t eventPlaneAngle=-100, Bool_t fill=kTRUE)
Bool_t SetEtaCut(Int_t etaCut)
Bool_t IsCentralitySelected(AliVEvent *fInputEvent, AliMCEvent *fMCEvent=NULL)
Bool_t SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
AliConversionCuts(const char *name="V0Cuts", const char *title="V0 Cuts")
Float_t GetDCAzToPrimVtx() const
Bool_t SetRejectExtraSignalsCut(Int_t extraSignal)
TCanvas * c
Definition: TestFitELoss.C:172
Bool_t PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent *event)
TString fNameHistoReweightingEta
virtual Double_t GetPx() const =0
Bool_t CosinePAngleCut(const AliConversionPhotonBase *photon, AliVEvent *event) const
Bool_t SpecificTrackCuts(AliAODTrack *negTrack, AliAODTrack *posTrack, Int_t &cutIndex)
Cut functions.
Double_t mesonMass
Bool_t SetIsHeavyIon(Int_t isHeavyIon)
Bool_t RejectToCloseV0s(AliAODConversionPhoton *photon, TList *photons, Int_t nV0)
static AliESDtrack * GetESDTrack(AliESDEvent *event, Int_t label)
void FillElectonLabelArray(AliAODConversionPhoton *photon, Int_t nV0)
UChar_t DeterminePhotonQualityAOD(AliAODConversionPhoton *, AliVEvent *)
Bool_t IsTriggerSelected(AliVEvent *fInputEvent)
Bool_t SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
Double_t fPIDnSigmaAboveElectronLine
Bool_t SetSharedElectronCut(Int_t sharedElec)
virtual Double_t GetPhotonP() const =0
Bool_t VertexZCut(AliVEvent *fInputEvent)
Bool_t PsiPairCut(const AliConversionPhotonBase *photon) const
Bool_t PhotonIsSelectedMC(TParticle *particle, AliMCEvent *mcEvent, Bool_t checkForConvertedGamma=kTRUE)
AliAnalysisUtils * fUtils
int Int_t
Definition: External.C:63
Double_t fDoProtonRejectionLowP
Bool_t SetDCAZPhotonPrimVtxCut(Int_t DCAZPhotonPrimVtx)
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
void DeterminePhotonQuality(AliVTrack *negTrack, AliVTrack *posTrack)
Bool_t SetCentralityMax(Int_t centralityBin)
Double_t fPIDProbabilityCutNegativeParticle
Bool_t SetTOFElectronPIDCut(Int_t TOFelectronPID)
Int_t GetTrackLabel(Int_t i) const
Definition: External.C:212
#define ASSIGNARRAY(i)
TH2F * hCentralityVsNumberOfPrimaryTracks
void SetEtaShift(Double_t etaShift)
Double_t fPIDnSigmaAtLowPAroundKaonLine
Bool_t EventIsSelected(AliVEvent *fInputEvent, AliMCEvent *fMCEvent)
Int_t GetNumberOfContributorsVtx(AliVEvent *event)
Float_t GetDCArToPrimVtx() const
virtual Double_t GetPhotonPt() const =0
Bool_t SetDCARPhotonPrimVtxCut(Int_t DCARPhotonPrimVtx)
Double_t fPIDnSigmaAtLowPAroundPionLine
Double_t GetCosineOfPointingAngle(const AliConversionPhotonBase *photon, AliVEvent *event) const
void InitCutHistograms(TString name="", Bool_t preCut=kTRUE)
Bool_t SetChi2GammaCut(Int_t chi2GammaCut)
Double_t fMinPPhotonAsymmetryCut
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)
Bool_t SelectV0Finder(Bool_t onfly)
Bool_t AsymmetryCut(AliConversionPhotonBase *photon, AliVEvent *event)
Bool_t SetTPCClusterCut(Int_t clsTPCCut)
static AliConversionCuts * GetStandardCuts2010PbPb()
TString fNameHistoReweightingK0s
Bool_t SetRCut(Int_t RCut)
Double_t fTofPIDnSigmaBelowElectronLine
Bool_t SetInPlaneOutOfPlane(Int_t inOutPlane)
Double_t fPIDnSigmaAbovePionLineHighPt
Bool_t SetCosPAngleCut(Int_t cosCut)
Bool_t SetMinMomPiondEdxCut(Int_t piMinMomdedxSigmaCut)
Bool_t fDoPhotonQualitySelectionCut
Bool_t TracksAreSelected(AliVTrack *negTrack, AliVTrack *posTrack)
virtual Double_t GetPy() const =0
static AliConversionCuts * GetStandardCuts2010pp()
Bool_t SetSelectSubTriggerClass(Int_t selectSpecialSubTriggerClass)
Bool_t GetUseNewMultiplicityFramework(TString period)
Double_t fPIDnSigmaBelowElectronLine
Bool_t SetCentralityMin(Int_t useCentrality)
Float_t GetWeightForMeson(TString period, Int_t index, AliMCEvent *mcEvent, AliVEvent *InputEvent=0x0)
void LoadReweightingHistosMCFromFile()
Bool_t SetToCloseV0sCut(Int_t toClose)
TObjString * fCutString
Double_t fPIDnSigmaAtLowPAroundProtonLine
Int_t GetFirstTPCRow(Double_t radius)
Bool_t InitializeCutsFromCutString(const TString analysisCutSelection)
Double_t fPIDMaxPnSigmaAbovePionLine
Bool_t RejectSharedElectronV0s(AliAODConversionPhoton *photon, Int_t nV0, Int_t nV0s)
Bool_t AcceptanceCut(TParticle *particle, TParticle *ePos, TParticle *eNeg)
bool Bool_t
Definition: External.C:53
Bool_t SetRemovePileUp(Int_t removePileUp)
Bool_t dEdxCuts(AliVTrack *track)
void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex *primVertex)
Bool_t CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent *event)
TString fNameHistoReweightingPi0
Double_t fPIDProbabilityCutPositiveParticle
Bool_t SetSelectSpecialTrigger(Int_t selectSpecialTrigger)