1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Svein Lindal, Daniel Lohner *
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 **************************************************************************/
16 ////////////////////////////////////////////////
17 //---------------------------------------------
18 // Class handling all kinds of selection cuts for
19 // Gamma Conversion analysis
20 //---------------------------------------------
21 ////////////////////////////////////////////////
23 #include "AliConversionCuts.h"
25 #include "AliKFVertex.h"
26 #include "AliAODTrack.h"
27 #include "AliESDtrack.h"
28 #include "AliAnalysisManager.h"
29 #include "AliInputEventHandler.h"
30 #include "AliMCEventHandler.h"
31 #include "AliAODHandler.h"
32 #include "AliPIDResponse.h"
36 #include "AliAODConversionMother.h"
37 #include "TObjString.h"
38 #include "AliAODEvent.h"
39 #include "AliESDEvent.h"
40 #include "AliCentrality.h"
43 #include "AliGenCocktailEventHeader.h"
44 #include "AliTriggerAnalysis.h"
45 #include "AliV0ReaderV1.h"
51 ClassImp(AliConversionCuts)
54 const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
70 "piMaxMomdedxSigmaCut",
71 "LowPRejectionSigmaCut",
76 "DoPhotonAsymmetryCut",
77 "CosinePointingAngle",
83 //________________________________________________________________________
84 AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
85 AliAnalysisCuts(name,title),
101 fLineCutZRSlopeMin(0.),
102 fLineCutZValueMin(0),
103 fChi2CutConversion(1000),
104 fPIDProbabilityCutNegativeParticle(0),
105 fPIDProbabilityCutPositiveParticle(0),
106 fDodEdxSigmaCut(kTRUE),
107 fDoTOFsigmaCut(kFALSE),
108 fPIDTRDEfficiency(1),
110 fPIDnSigmaAboveElectronLine(100),
111 fPIDnSigmaBelowElectronLine(-100),
112 fTofPIDnSigmaAboveElectronLine(100),
113 fTofPIDnSigmaBelowElectronLine(-100),
114 fPIDnSigmaAbovePionLine(0),
115 fPIDnSigmaAbovePionLineHighPt(-100),
116 fPIDMinPnSigmaAbovePionLine(0),
117 fPIDMaxPnSigmaAbovePionLine(0),
118 fDoKaonRejectionLowP(kFALSE),
119 fDoProtonRejectionLowP(kFALSE),
120 fDoPionRejectionLowP(kFALSE),
121 fPIDnSigmaAtLowPAroundKaonLine(0),
122 fPIDnSigmaAtLowPAroundProtonLine(0),
123 fPIDnSigmaAtLowPAroundPionLine(0),
124 fPIDMinPKaonRejectionLowP(1.5),
125 fPIDMinPProtonRejectionLowP(2),
126 fPIDMinPPionRejectionLowP(0),
127 fDoQtGammaSelection(kTRUE),
128 fDoHighPtQtGammaSelection(kFALSE),
136 fUseEtaMinCut(kFALSE),
137 fUseOnFlyV0Finder(kTRUE),
138 fDoPhotonAsymmetryCut(kTRUE),
139 fMinPPhotonAsymmetryCut(100.),
140 fMinPhotonAsymmetry(0.),
142 fDetectorCentrality(0),
143 fModCentralityClass(0),
147 fUseCorrectedTPCClsInfo(kFALSE),
149 fMultiplicityMethod(0),
151 fRemovePileUp(kFALSE),
152 fOpeningAngle(0.005),
154 fCosPAngleCut(10000),
155 fDoToCloseV0sCut(kFALSE),
156 fRejectExtraSignals(0),
158 fDoSharedElecCut(kFALSE),
159 fOfflineTriggerMask(0),
163 fElectronArraySize(500),
164 fElectronLabelArray(NULL),
165 fConversionPointXArray(0.0),
166 fConversionPointYArray(0.0),
167 fConversionPointZArray(0.0),
169 fNotRejectedStart(NULL),
170 fNotRejectedEnd(NULL),
171 fGeneratorNames(NULL),
174 hTPCdEdxbefore(NULL),
176 hTPCdEdxSigbefore(NULL),
177 hTPCdEdxSigafter(NULL),
183 hInvMassbefore(NULL),
184 hArmenterosbefore(NULL),
186 hArmenterosafter(NULL),
187 hAcceptanceCuts(NULL),
195 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
196 fCutString=new TObjString((GetCutNumber()).Data());
198 fElectronLabelArray = new Int_t[fElectronArraySize];
202 //________________________________________________________________________
203 AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
204 AliAnalysisCuts(ref),
206 fHeaderList(ref.fHeaderList),
208 fEventQuality(ref.fEventQuality),
211 fEtaCut(ref.fEtaCut),
212 fEtaCutMin(ref.fEtaCutMin),
214 fSinglePtCut(ref.fSinglePtCut),
216 fMinClsTPC(ref.fMinClsTPC),
217 fMinClsTPCToF(ref.fMinClsTPCToF),
218 fLineCutZRSlope(ref.fLineCutZRSlope),
219 fLineCutZValue(ref.fLineCutZValue),
220 fLineCutZRSlopeMin(ref.fLineCutZRSlopeMin),
221 fLineCutZValueMin(ref.fLineCutZValueMin),
222 fChi2CutConversion(ref.fChi2CutConversion),
223 fPIDProbabilityCutNegativeParticle(ref.fPIDProbabilityCutNegativeParticle),
224 fPIDProbabilityCutPositiveParticle(ref.fPIDProbabilityCutPositiveParticle),
225 fDodEdxSigmaCut(ref. fDodEdxSigmaCut),
226 fDoTOFsigmaCut(ref.fDoTOFsigmaCut),
227 fPIDTRDEfficiency(ref.fPIDTRDEfficiency),
228 fDoTRDPID(ref.fDoTRDPID),
229 fPIDnSigmaAboveElectronLine(ref.fPIDnSigmaAboveElectronLine),
230 fPIDnSigmaBelowElectronLine(ref.fPIDnSigmaBelowElectronLine),
231 fTofPIDnSigmaAboveElectronLine(ref.fTofPIDnSigmaAboveElectronLine),
232 fTofPIDnSigmaBelowElectronLine(ref.fTofPIDnSigmaBelowElectronLine),
233 fPIDnSigmaAbovePionLine(ref.fPIDnSigmaAbovePionLine),
234 fPIDnSigmaAbovePionLineHighPt(ref.fPIDnSigmaAbovePionLineHighPt),
235 fPIDMinPnSigmaAbovePionLine(ref.fPIDMinPnSigmaAbovePionLine),
236 fPIDMaxPnSigmaAbovePionLine(ref.fPIDMaxPnSigmaAbovePionLine),
237 fDoKaonRejectionLowP(ref.fDoKaonRejectionLowP),
238 fDoProtonRejectionLowP(ref.fDoProtonRejectionLowP),
239 fDoPionRejectionLowP(ref.fDoPionRejectionLowP),
240 fPIDnSigmaAtLowPAroundKaonLine(ref.fPIDnSigmaAtLowPAroundKaonLine),
241 fPIDnSigmaAtLowPAroundProtonLine(ref.fPIDnSigmaAtLowPAroundProtonLine),
242 fPIDnSigmaAtLowPAroundPionLine(ref.fPIDnSigmaAtLowPAroundPionLine),
243 fPIDMinPKaonRejectionLowP(ref.fPIDMinPKaonRejectionLowP),
244 fPIDMinPProtonRejectionLowP(ref.fPIDMinPProtonRejectionLowP),
245 fPIDMinPPionRejectionLowP(ref.fPIDMinPPionRejectionLowP),
246 fDoQtGammaSelection(ref.fDoQtGammaSelection),
247 fDoHighPtQtGammaSelection(ref.fDoHighPtQtGammaSelection),
249 fHighPtQtMax(ref.fHighPtQtMax),
250 fPtBorderForQt(ref.fPtBorderForQt),
251 fXVertexCut(ref.fXVertexCut),
252 fYVertexCut(ref.fYVertexCut),
253 fZVertexCut(ref.fZVertexCut),
254 fNSigmaMass(ref.fNSigmaMass),
255 fUseEtaMinCut(ref.fUseEtaMinCut),
256 fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
257 fDoPhotonAsymmetryCut(fDoPhotonAsymmetryCut),
258 fMinPPhotonAsymmetryCut(ref.fMinPPhotonAsymmetryCut),
259 fMinPhotonAsymmetry(ref.fMinPhotonAsymmetry),
260 fIsHeavyIon(ref.fIsHeavyIon),
261 fDetectorCentrality(ref.fDetectorCentrality),
262 fModCentralityClass(ref.fModCentralityClass),
263 fMaxVertexZ(ref.fMaxVertexZ),
264 fCentralityMin(ref.fCentralityMin),
265 fCentralityMax(ref.fCentralityMax),
266 fUseCorrectedTPCClsInfo(ref.fUseCorrectedTPCClsInfo),
267 fUseTOFpid(ref.fUseTOFpid),
268 fMultiplicityMethod(ref.fMultiplicityMethod),
269 fSpecialTrigger(ref.fSpecialTrigger),
270 fRemovePileUp(ref.fRemovePileUp),
271 fOpeningAngle(ref.fOpeningAngle),
272 fPsiPairCut(ref.fPsiPairCut),
273 fCosPAngleCut(ref.fCosPAngleCut),
274 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
275 fRejectExtraSignals(ref.fRejectExtraSignals),
276 fminV0Dist(ref.fminV0Dist),
277 fDoSharedElecCut(ref.fDoSharedElecCut),
278 fOfflineTriggerMask(ref.fOfflineTriggerMask),
279 fHasV0AND(ref.fHasV0AND),
280 fIsSDDFired(ref.fIsSDDFired),
281 fRandom(ref.fRandom),
282 fElectronArraySize(ref.fElectronArraySize),
283 fElectronLabelArray(NULL),
284 fConversionPointXArray(ref.fConversionPointXArray),
285 fConversionPointYArray(ref.fConversionPointYArray),
286 fConversionPointZArray(ref.fConversionPointZArray),
287 fnHeaders(ref.fnHeaders),
288 fNotRejectedStart(NULL),
289 fNotRejectedEnd(NULL),
290 fGeneratorNames(ref.fGeneratorNames),
293 hTPCdEdxbefore(NULL),
295 hTPCdEdxSigbefore(NULL),
296 hTPCdEdxSigafter(NULL),
302 hInvMassbefore(NULL),
303 hArmenterosbefore(NULL),
305 hArmenterosafter(NULL),
306 hAcceptanceCuts(NULL),
314 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
315 fCutString=new TObjString((GetCutNumber()).Data());
316 fElectronLabelArray = new Int_t[fElectronArraySize];
317 // dont copy histograms (if you like histograms, call InitCutHistograms())
320 //________________________________________________________________________
321 AliConversionCuts::~AliConversionCuts() {
323 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
325 // delete fHistograms;
326 // fHistograms = NULL;
327 if(fCutString != NULL){
331 if(fElectronLabelArray){
332 delete fElectronLabelArray;
333 fElectronLabelArray = NULL;
335 if(fNotRejectedStart){
336 delete[] fNotRejectedStart;
337 fNotRejectedStart = NULL;
340 delete[] fNotRejectedEnd;
341 fNotRejectedEnd = NULL;
344 delete[] fGeneratorNames;
345 fGeneratorNames = NULL;
349 //________________________________________________________________________
350 void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
352 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
354 if(fHistograms != NULL){
358 if(fHistograms==NULL){
359 fHistograms=new TList();
360 if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
361 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
365 hCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",10,-0.5,9.5);
366 hCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
367 hCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
368 hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
369 hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
370 hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
371 hCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
372 hCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
373 hCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
374 fHistograms->Add(hCutIndex);
377 hTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
378 hTrackCuts->GetXaxis()->SetBinLabel(1,"in");
379 hTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
380 hTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
381 hTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
382 hTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
383 hTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
384 hTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
385 hTrackCuts->GetXaxis()->SetBinLabel(8,"out");
386 fHistograms->Add(hTrackCuts);
389 hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",12,-0.5,11.5);
390 hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
391 hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
392 hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
393 hPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
394 hPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
395 hPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
396 hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
397 hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
398 hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
399 hPhotonCuts->GetXaxis()->SetBinLabel(10,"out");
400 fHistograms->Add(hPhotonCuts);
403 hInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
404 fHistograms->Add(hInvMassbefore);
405 hArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
406 fHistograms->Add(hArmenterosbefore);
408 hInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
409 fHistograms->Add(hInvMassafter);
410 hArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
411 fHistograms->Add(hArmenterosafter);
413 hAcceptanceCuts=new TH1F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts",10,-0.5,9.5);
414 hAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
415 hAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
416 hAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
417 hAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
418 hAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
419 hAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
420 hAcceptanceCuts->GetXaxis()->SetBinLabel(7,"minpt");
421 hAcceptanceCuts->GetXaxis()->SetBinLabel(8,"out");
422 fHistograms->Add(hAcceptanceCuts);
425 hdEdxCuts=new TH1F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts",10,-0.5,9.5);
426 hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
427 hdEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
428 hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
429 hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
430 hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
431 hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
432 hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
433 hdEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
434 hdEdxCuts->GetXaxis()->SetBinLabel(9,"TRDelectron");
435 hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
436 fHistograms->Add(hdEdxCuts);
438 TAxis *AxisBeforedEdx = NULL;
439 TAxis *AxisBeforedEdxSig = NULL;
440 TAxis *AxisBeforeTOF = NULL;
441 TAxis *AxisBeforeTOFSig = NULL;
443 hTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
444 fHistograms->Add(hTPCdEdxbefore);
445 AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
446 hTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
447 fHistograms->Add(hTPCdEdxSigbefore);
448 AxisBeforedEdxSig = hTPCdEdxSigbefore->GetXaxis();
450 hTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
451 fHistograms->Add(hTOFbefore);
452 AxisBeforeTOF = hTOFbefore->GetXaxis();
453 hTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
454 fHistograms->Add(hTOFSigbefore);
455 AxisBeforeTOFSig = hTOFSigbefore->GetXaxis();
458 hTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
459 fHistograms->Add(hTPCdEdxSigafter);
461 hTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
462 fHistograms->Add(hTPCdEdxafter);
464 hTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
465 fHistograms->Add(hTOFSigafter);
467 TAxis *AxisAfter = hTPCdEdxSigafter->GetXaxis();
468 Int_t bins = AxisAfter->GetNbins();
469 Double_t from = AxisAfter->GetXmin();
470 Double_t to = AxisAfter->GetXmax();
471 Double_t *newBins = new Double_t[bins+1];
473 Double_t factor = TMath::Power(to/from, 1./bins);
474 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
475 AxisAfter->Set(bins, newBins);
476 AxisAfter = hTOFSigafter->GetXaxis();
477 AxisAfter->Set(bins, newBins);
478 AxisAfter = hTPCdEdxafter->GetXaxis();
479 AxisAfter->Set(bins, newBins);
481 AxisBeforedEdx->Set(bins, newBins);
482 AxisBeforeTOF->Set(bins, newBins);
483 AxisBeforedEdxSig->Set(bins, newBins);
484 AxisBeforeTOFSig->Set(bins, newBins);
488 // Event Cuts and Info
490 hV0EventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",7,-0.5,6.5);
491 hV0EventCuts->GetXaxis()->SetBinLabel(1,"in");
492 hV0EventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
493 hV0EventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
494 hV0EventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
495 hV0EventCuts->GetXaxis()->SetBinLabel(5,"pileup");
496 hV0EventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
497 hV0EventCuts->GetXaxis()->SetBinLabel(7,"out");
498 fHistograms->Add(hV0EventCuts);
500 hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",100,0,100);
501 fHistograms->Add(hCentrality);
502 hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
503 fHistograms->Add(hVertexZ);
505 hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",33,-0.5,32.5);
506 hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
507 hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
508 hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
509 hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
510 hTriggerClass->GetXaxis()->SetBinLabel( 5,"kKEMC1");
511 hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
512 hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
513 hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
514 hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
515 hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
516 hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
517 hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
518 hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
519 hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
520 hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
521 hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
522 hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
523 hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
524 hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
525 hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
526 hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
527 hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
528 hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
529 hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
530 hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
531 hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
532 hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
533 hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
534 hTriggerClass->GetXaxis()->SetBinLabel(29,"kFastOnly");
535 hTriggerClass->GetXaxis()->SetBinLabel(30,"kAnyINT");
536 hTriggerClass->GetXaxis()->SetBinLabel(31,"kAny");
537 hTriggerClass->GetXaxis()->SetBinLabel(32,"V0AND");
538 hTriggerClass->GetXaxis()->SetBinLabel(33,"NOT kFastOnly");
539 fHistograms->Add(hTriggerClass);
543 //________________________________________________________________________
544 Bool_t AliConversionCuts::InitPIDResponse(){
545 // Set Pointer to AliPIDResponse
547 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
549 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
550 fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
551 if(fPIDResponse)return kTRUE;
558 ///________________________________________________________________________
559 Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent){
560 // Process Event Selection
563 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
566 // Check for MC event
568 // Check if MC event is correctly loaded
569 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
574 if (!mcHandler->InitOk() ){
578 if (!mcHandler->TreeK() ){
582 if (!mcHandler->TreeTR() ) {
589 if(!IsTriggerSelected()){
590 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
596 if(fInputEvent->IsA()==AliESDEvent::Class()){
597 AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
598 fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
599 if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(31);
602 // Number of Contributors Cut
603 if(GetNumberOfContributorsVtx(fInputEvent)<=0) {
604 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
610 // Z Vertex Position Cut
611 if(!VertexZCut(fInputEvent)){
612 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
621 if(fInputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
622 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
629 // Centrality Selection
630 if(!IsCentralitySelected(fInputEvent,fMCEvent)){
631 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
637 // Fill Event Histograms
638 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
639 if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
640 if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent));
646 ///________________________________________________________________________
647 Bool_t AliConversionCuts::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
648 // MonteCarlo Photon Selection
650 if(!fMCStack)return kFALSE;
652 if (particle->GetPdgCode() == 22){
654 if(particle->R() > fMaxR) return kFALSE;
655 if(abs(particle->Eta())> fEtaCut || abs(particle->Eta())< fEtaCutMin) return kFALSE;
657 if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
658 return kFALSE; // no photon as mothers!
661 if(particle->GetMother(0) >= fMCStack->GetNprimary()){
662 return kFALSE; // the gamma has a mother, and it is not a primary particle
665 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
667 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
668 TParticle* ePos = NULL;
669 TParticle* eNeg = NULL;
671 if(particle->GetNDaughters() >= 2){
672 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
673 TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
674 if(tmpDaughter->GetUniqueID() == 5){
675 if(tmpDaughter->GetPdgCode() == 11){
677 } else if(tmpDaughter->GetPdgCode() == -11){
684 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
688 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
689 return kFALSE; // no reconstruction below the Pt cut
692 if( abs(ePos->Eta())> fEtaCut || abs(ePos->Eta())< fEtaCutMin ||
693 abs(eNeg->Eta())> fEtaCut || abs(eNeg->Eta())< fEtaCutMin ) {
698 return kFALSE; // cuts on distance from collision point
701 if(abs(ePos->Vz()) > fMaxZ){
702 return kFALSE; // outside material
704 if(abs(eNeg->Vz()) > fMaxZ){
705 return kFALSE; // outside material
708 if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
709 return kFALSE; // line cut to exclude regions where we do not reconstruct
710 } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
714 if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
715 return kFALSE; // line cut to exclude regions where we do not reconstruct
716 } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
721 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
727 ///________________________________________________________________________
728 Bool_t AliConversionCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event)
729 { // Specific Photon Cuts
732 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex);
735 // Fill Histos before Cuts
736 if(hInvMassbefore)hInvMassbefore->Fill(photon->GetMass());
738 if(hArmenterosbefore)hArmenterosbefore->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
740 // Gamma selection based on QT from Armenteros
741 if(fDoQtGammaSelection == kTRUE){
742 if(!ArmenterosQtCut(photon)){
743 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //1
750 if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
752 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //2
758 // Reconstruction Acceptance Cuts
759 if(!AcceptanceCuts(photon)){
760 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //3
766 if(fDoPhotonAsymmetryCut == kTRUE){
767 if(!AsymmetryCut(photon,event)){
768 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //4
773 //Check the pid probability
775 if(!PIDProbabilityCut(photon, event)) {
776 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //5
781 if(!CorrectedTPCClusterCut(photon, event)) {
782 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //6
788 if(!PsiPairCut(photon)) {
789 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //7
794 if(!CosinePAngleCut(photon, event)) {
795 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //8
800 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
803 if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
804 if(hArmenterosafter)hArmenterosafter->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
811 ///________________________________________________________________________
812 Bool_t AliConversionCuts::CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event)
813 { //Cut on corrected TPC Cluster Info
815 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
816 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
818 if(!negTrack||!posTrack)return kFALSE;
820 Double_t negclsToF=0;
822 if (!fUseCorrectedTPCClsInfo ){
823 if(negTrack->GetTPCNclsF()!=0){
824 negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
827 negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
830 Double_t posclsToF = 0.;
831 if (!fUseCorrectedTPCClsInfo ){
832 if(posTrack->GetTPCNclsF()!=0){
833 posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
836 posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
839 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
846 ///________________________________________________________________________
847 Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent * event)
849 //Selection of Reconstructed Photons
851 FillPhotonCutIndex(kPhotonIn);
854 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
855 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
857 if(!negTrack || !posTrack) {
858 FillPhotonCutIndex(kNoTracks);
863 if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
864 FillPhotonCutIndex(kdEdxCuts);
869 if(!TracksAreSelected(negTrack, posTrack)){
870 FillPhotonCutIndex(kTrackCuts);
875 if(!PhotonCuts(photon,event)){
876 FillPhotonCutIndex(kPhotonCuts);
880 // Photon passed cuts
881 FillPhotonCutIndex(kPhotonOut);
885 ///________________________________________________________________________
886 Bool_t AliConversionCuts::ArmenterosQtCut(AliConversionPhotonBase *photon)
887 { // Armenteros Qt Cut
889 if(fDoHighPtQtGammaSelection){
890 if(photon->GetPhotonPt() < fPtBorderForQt){
891 if(photon->GetArmenterosQt()>fQtMax){
895 if(photon->GetArmenterosQt()>fHighPtQtMax){
901 if(photon->GetArmenterosQt()>fQtMax){
909 ///________________________________________________________________________
910 Bool_t AliConversionCuts::AcceptanceCuts(AliConversionPhotonBase *photon) {
911 // Exclude certain areas for photon reconstruction
914 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
917 if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
918 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
923 if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
924 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
929 if(photon->GetConversionRadius() <= ((abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
930 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
933 else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
934 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
939 if(abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
940 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
946 if(abs(photon->GetPhotonEta())> fEtaCut || abs(photon->GetPhotonEta())< fEtaCutMin){
947 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
953 if(photon->GetPhotonPt()<fPtCut){
954 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
959 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
965 ///________________________________________________________________________
966 Bool_t AliConversionCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
967 // Track Cuts which require AOD/ESD specific implementation
969 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
970 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
975 AliAODVertex * NegVtxType=negTrack->GetProdVertex();
976 AliAODVertex * PosVtxType=posTrack->GetProdVertex();
977 if((NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
978 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
986 ///________________________________________________________________________
987 Bool_t AliConversionCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
988 // Track Cuts which require AOD/ESD specific implementation
990 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
991 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
996 if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
997 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1005 ///________________________________________________________________________
1006 Bool_t AliConversionCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1007 // Track Selection for Photon Reconstruction
1010 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1014 if(negTrack->Charge() == posTrack->Charge()) {
1015 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1020 // Number of TPC Clusters
1021 if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1022 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1029 if(abs(negTrack->Eta()) > fEtaCut || abs(negTrack->Eta()) < fEtaCutMin ||
1030 abs(posTrack->Eta())> fEtaCut || abs(posTrack->Eta())< fEtaCutMin) {
1031 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1037 if( negTrack->Pt()< fSinglePtCut || posTrack->Pt()< fSinglePtCut){
1038 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1043 // AOD ESD specific cuts
1044 Bool_t passCuts = kTRUE;
1046 if(negTrack->IsA()==AliAODTrack::Class()) {
1047 passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1049 passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1053 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1058 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1064 ///________________________________________________________________________
1065 Bool_t AliConversionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
1066 // Electron Identification Cuts for Photon reconstruction
1068 if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1069 if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1072 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1073 if(hTPCdEdxSigbefore)hTPCdEdxSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1074 if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1078 if(fDodEdxSigmaCut == kTRUE){
1079 // TPC Electron Line
1080 if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1081 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
1083 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1089 if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1090 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1091 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1092 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1094 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1101 if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1102 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1103 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine &&
1104 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1106 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1114 if(fDoKaonRejectionLowP == kTRUE){
1115 if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1116 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1118 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1125 if(fDoProtonRejectionLowP == kTRUE){
1126 if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1127 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1129 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1136 if(fDoPionRejectionLowP == kTRUE){
1137 if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1138 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1140 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1148 // cout<<"Start"<<endl;
1149 // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1151 // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1152 // {cout<<"TOF DA"<<endl;}
1153 // if(status == AliPIDResponse::kDetPidOk){
1154 // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1155 // cout<<"--> "<<probMis<<endl;
1156 // if(probMis > 0.01){
1161 if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1163 Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1165 fCurrentTrack->GetIntegratedTimes(times);
1166 Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1167 Double_t dT = TOFsignal - t0 - times[0];
1168 hTOFbefore->Fill(fCurrentTrack->P(),dT);
1170 if(hTOFSigbefore) hTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1172 if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1173 fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1174 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1178 if(hTOFSigafter)hTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1184 if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1185 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1191 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1192 if(hTPCdEdxSigafter)hTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1193 if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1197 ///________________________________________________________________________
1198 Bool_t AliConversionCuts::AsymmetryCut(AliConversionPhotonBase * photon,AliVEvent *event) {
1199 // Cut on Energy Assymetry
1201 for(Int_t ii=0;ii<2;ii++){
1203 AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1205 if( track->P() > fMinPPhotonAsymmetryCut ){
1206 Double_t trackNegAsy=0;
1207 if (photon->GetPhotonP()!=0.){
1208 trackNegAsy= track->P()/photon->GetPhotonP();
1211 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1220 ///________________________________________________________________________
1221 AliVTrack *AliConversionCuts::GetTrack(AliVEvent * event, Int_t label){
1222 //Returns pointer to the track with given ESD label
1223 //(Important for AOD implementation, since Track array in AOD data is different
1224 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1226 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1228 if(label > event->GetNumberOfTracks() ) return NULL;
1229 AliESDtrack * track = esdEvent->GetTrack(label);
1233 for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1234 AliVTrack * track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1237 if(track->GetID() == label) {
1244 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1248 ///________________________________________________________________________
1249 AliESDtrack *AliConversionCuts::GetESDTrack(AliESDEvent * event, Int_t label){
1250 //Returns pointer to the track with given ESD label
1251 //(Important for AOD implementation, since Track array in AOD data is different
1252 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1255 if(label > event->GetNumberOfTracks() ) return NULL;
1256 AliESDtrack * track = event->GetTrack(label);
1259 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1265 ///________________________________________________________________________
1266 Bool_t AliConversionCuts::PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event){
1267 // Cut on Electron Probability for Photon Reconstruction
1269 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1273 Bool_t iResult=kFALSE;
1275 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1276 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1278 AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1279 AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1281 if(negProbArray && posProbArray){
1283 negTrack->GetTPCpid(negProbArray);
1284 posTrack->GetTPCpid(posProbArray);
1286 if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1291 delete [] posProbArray;
1292 delete [] negProbArray;
1296 ///Not possible for AODs
1306 ///________________________________________________________________________
1307 Bool_t AliConversionCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1308 // MC Acceptance Cuts
1309 //(Certain areas were excluded for photon reconstruction)
1311 if(particle->R()>fMaxR){
1314 if(ePos->R()>fMaxR){
1318 if(ePos->R()<fMinR){
1322 if( ePos->R() <= ((abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1325 else if (fUseEtaMinCut && ePos->R() >= ((abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1329 if(abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1333 if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1337 if(abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1341 if(abs(particle->Eta())> fEtaCut || abs(particle->Eta())< fEtaCutMin){
1345 if(abs(ePos->Eta())> fEtaCut || abs(ePos->Eta())< fEtaCutMin){
1349 if(abs(eNeg->Eta())> fEtaCut || abs(eNeg->Eta())< fEtaCutMin){
1353 if( ePos->Pt()< fSinglePtCut || eNeg->Pt()< fSinglePtCut){
1357 if(particle->Pt()<fPtCut){
1363 ///________________________________________________________________________
1364 Bool_t AliConversionCuts::UpdateCutString() {
1365 ///Update the cut string (if it has been created yet)
1367 if(fCutString && fCutString->GetString().Length() == kNCuts) {
1368 fCutString->SetString(GetCutNumber());
1375 ///________________________________________________________________________
1376 Bool_t AliConversionCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
1377 // Initialize Cuts from a given Cut string
1379 AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1380 if(analysisCutSelection.Length()!=kNCuts) {
1381 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1384 if(!analysisCutSelection.IsDigit()){
1385 AliError("Cut selection contains characters");
1389 const char *cutSelection = analysisCutSelection.Data();
1390 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
1391 for(Int_t ii=0;ii<kNCuts;ii++){
1395 // Set Individual Cuts
1396 for(Int_t ii=0;ii<kNCuts;ii++){
1397 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1402 // Set StandardTriggers
1404 if(fIsHeavyIon)SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
1405 else SelectCollisionCandidates(AliVEvent::kMB);
1409 ///________________________________________________________________________
1410 Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
1411 ///Set individual cut ID
1416 if( SetV0Finder(value)) {
1417 fCuts[kv0FinderType] = value;
1420 } else return kFALSE;
1422 case kededxSigmaCut:
1423 if( SetTPCdEdxCutElectronLine(value)) {
1424 fCuts[kededxSigmaCut] = value;
1427 } else return kFALSE;
1429 case kpidedxSigmaCut:
1430 if( SetTPCdEdxCutPionLine(value)) {
1431 fCuts[kpidedxSigmaCut] = value;
1434 } else return kFALSE;
1436 case kpiMomdedxSigmaCut:
1437 if( SetMinMomPiondEdxCut(value)) {
1438 fCuts[kpiMomdedxSigmaCut] = value;
1441 } else return kFALSE;
1444 if( SetChi2GammaCut(value)) {
1445 fCuts[kchi2GammaCut] = value;
1448 } else return kFALSE;
1451 if( SetSinglePtCut(value)) {
1452 fCuts[ksinglePtCut] = value;
1455 } else return kFALSE;
1458 if( SetTPCClusterCut(value)) {
1459 fCuts[kclsTPCCut] = value;
1462 } else return kFALSE;
1465 if( SetEtaCut(value)) {
1466 fCuts[ketaCut] = value;
1469 } else return kFALSE;
1471 case kLowPRejectionSigmaCut:
1472 if( SetLowPRejectionCuts(value)) {
1473 fCuts[kLowPRejectionSigmaCut] = value;
1476 } else return kFALSE;
1479 if( SetQtMaxCut(value)) {
1480 fCuts[kQtMaxCut] = value;
1483 } else return kFALSE;
1485 case kpiMaxMomdedxSigmaCut:
1486 if( SetMaxMomPiondEdxCut(value)) {
1487 fCuts[kpiMaxMomdedxSigmaCut] = value;
1490 } else return kFALSE;
1493 if( SetRCut(value)) {
1494 fCuts[kRCut] = value;
1497 } else return kFALSE;
1500 if( SetRemovePileUp(value)) {
1501 fCuts[kremovePileUp] = value;
1504 } else return kFALSE;
1507 if( SetSelectSpecialTrigger(value)) {
1508 fCuts[kselectV0AND] = value;
1511 } else return kFALSE;
1513 case kmultiplicityMethod:
1514 if( SetMultiplicityMethod(value)) {
1515 fCuts[kmultiplicityMethod] = value;
1518 } else return kFALSE;
1521 if( SetIsHeavyIon(value)) {
1522 fCuts[kisHeavyIon] = value;
1525 } else return kFALSE;
1527 case kCentralityMin:
1528 if( SetCentralityMin(value)) {
1529 fCuts[kCentralityMin] = value;
1532 } else return kFALSE;
1534 case kCentralityMax:
1535 if( SetCentralityMax(value)) {
1536 fCuts[kCentralityMax] = value;
1539 } else return kFALSE;
1541 case kTOFelectronPID:
1542 if( SetTOFElectronPIDCut(value)) {
1543 fCuts[kTOFelectronPID] = value;
1546 } else return kFALSE;
1548 case kdoPhotonAsymmetryCut:
1549 if( SetPhotonAsymmetryCut(value)) {
1550 fCuts[kdoPhotonAsymmetryCut] = value;
1553 } else return kFALSE;
1556 if( SetPsiPairCut(value)) {
1557 fCuts[kPsiPair] = value;
1560 } else return kFALSE;
1563 if( SetCosPAngleCut(value)) {
1564 fCuts[kCosPAngle] = value;
1567 } else return kFALSE;
1571 if( SetSharedElectronCut(value)) {
1572 fCuts[kElecShare] = value;
1575 } else return kFALSE;
1578 if( SetToCloseV0sCut(value)) {
1579 fCuts[kToCloseV0s] = value;
1582 } else return kFALSE;
1585 if( SetRejectExtraSignalsCut(value)) {
1586 fCuts[kExtraSignals] = value;
1589 } else return kFALSE;
1592 AliError("Cut id out of range");
1596 AliError("Cut id %d not recognized");
1601 ///________________________________________________________________________
1602 void AliConversionCuts::PrintCuts() {
1603 // Print out current Cut Selection
1604 for(Int_t ic = 0; ic < kNCuts; ic++) {
1605 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
1608 ///________________________________________________________________________
1609 Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
1617 fDetectorCentrality=0;
1621 fDetectorCentrality=1;
1623 case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1625 fDetectorCentrality=0;
1626 fModCentralityClass=1;
1628 case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1630 fDetectorCentrality=0;
1631 fModCentralityClass=2;
1633 case 5: //strict cut on v0 tracks for MC
1635 fDetectorCentrality=0;
1636 fModCentralityClass=3;
1638 case 6: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1639 //strict cut on v0 tracks for MC
1641 fDetectorCentrality=0;
1642 fModCentralityClass=4;
1644 case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1645 //strict cut on v0 tracks for MC
1647 fDetectorCentrality=0;
1648 fModCentralityClass=5;
1651 AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1656 //___________________________________________________________________
1657 Bool_t AliConversionCuts::SetCentralityMin(Int_t minCentrality)
1660 if(minCentrality<0||minCentrality>9){
1661 AliError(Form("minCentrality not defined %d",minCentrality));
1665 fCentralityMin=minCentrality;
1668 //___________________________________________________________________
1669 Bool_t AliConversionCuts::SetCentralityMax(Int_t maxCentrality)
1672 if(maxCentrality<0||maxCentrality>9){
1673 AliError(Form("maxCentrality not defined %d",maxCentrality));
1676 fCentralityMax=maxCentrality;
1679 ///________________________________________________________________________
1680 Int_t AliConversionCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger)
1683 switch(selectSpecialTrigger){
1685 fSpecialTrigger=0; // dont care
1688 fSpecialTrigger=1; // V0AND
1691 fSpecialTrigger=2; // with SDD requested
1694 fSpecialTrigger=3; // V0AND plus with SDD requested
1698 AliError("Warning: Special Trigger Not known");
1703 ///________________________________________________________________________
1704 Bool_t AliConversionCuts::SetMultiplicityMethod(Int_t multiplicityMethod)
1707 fMultiplicityMethod=multiplicityMethod;
1709 // 0 Photon Multiplicity
1710 // 1 TPC Track multiplicity
1716 ///________________________________________________________________________
1717 Bool_t AliConversionCuts::SetRemovePileUp(Int_t removePileUp)
1719 switch(removePileUp){
1721 fRemovePileUp=kFALSE;
1724 fRemovePileUp=kTRUE;
1727 AliError("RemovePileUpCut not defined");
1732 ///________________________________________________________________________
1733 Bool_t AliConversionCuts::SetRejectExtraSignalsCut(Int_t extraSignal) {
1735 switch(extraSignal){
1737 fRejectExtraSignals = 0;
1738 break; // No Rejection
1740 fRejectExtraSignals = 1;
1741 break; // MinBias Header
1743 fRejectExtraSignals = 2;
1744 break; // User String Array
1746 fRejectExtraSignals = 3;
1747 break; // Rejection for Gamma Correction only
1749 AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
1754 ///________________________________________________________________________
1755 Bool_t AliConversionCuts::SetV0Finder(Int_t v0FinderType)
1757 switch (v0FinderType){
1758 case 0: // on fly V0 finder
1759 fUseOnFlyV0Finder=kTRUE;
1761 case 1: // offline V0 finder
1762 fUseOnFlyV0Finder=kFALSE;
1765 AliError(Form(" v0FinderType not defined %d",v0FinderType));
1770 ///________________________________________________________________________
1771 Bool_t AliConversionCuts::SetEtaCut(Int_t etaCut)
1774 //Set Standard LineCutZValues
1775 fLineCutZValueMin = -2;
1776 fLineCutZValue = 7.;
1781 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1783 fLineCutZRSlopeMin = 0.;
1787 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1789 fLineCutZRSlopeMin = 0.;
1793 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1795 fLineCutZRSlopeMin = 0.;
1799 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1801 fLineCutZRSlopeMin = 0.;
1805 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1807 fLineCutZRSlopeMin = 0.;
1809 case 5: // 0.9 - 1.4
1811 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1813 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1817 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1819 fLineCutZRSlopeMin = 0.;
1821 case 7: // 0.1 - 0.8
1823 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1825 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1827 case 8: // 0.1 - 0.8
1829 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1831 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1835 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1837 fLineCutZRSlopeMin = 0.;
1840 AliError(Form(" EtaCut not defined %d",etaCut));
1845 ///________________________________________________________________________
1846 Bool_t AliConversionCuts::SetRCut(Int_t RCut){
1869 // High purity cuts for PbPb (remove first layers of material)
1892 AliError("RCut not defined");
1897 ///________________________________________________________________________
1898 Bool_t AliConversionCuts::SetSinglePtCut(Int_t singlePtCut)
1900 switch(singlePtCut){
1901 case 0: // 0.050 GeV
1902 fSinglePtCut = 0.050;
1904 case 1: // 0.100 GeV
1905 fSinglePtCut = 0.100;
1907 case 2: // 0.150 GeV
1908 fSinglePtCut = 0.150;
1910 case 3: // 0.200 GeV
1911 fSinglePtCut = 0.200;
1913 case 4: // 0.075 GeV
1914 fSinglePtCut = 0.075;
1916 case 5: // 0.125 GeV
1917 fSinglePtCut = 0.125;
1920 fSinglePtCut = 0.040;
1926 AliError(Form("singlePtCut not defined %d",singlePtCut));
1931 ///________________________________________________________________________
1932 Bool_t AliConversionCuts::SetTPCClusterCut(Int_t clsTPCCut)
1947 case 4: // 60% of findable clusters
1949 fUseCorrectedTPCClsInfo=0;
1951 case 5: // 0% of findable clusters
1953 fUseCorrectedTPCClsInfo=1;
1955 case 6: // 70% of findable clusters
1957 fUseCorrectedTPCClsInfo=1;
1959 case 7: // 0% of findable clusters
1960 fMinClsTPCToF= 0.35;
1961 fUseCorrectedTPCClsInfo=0;
1964 fMinClsTPCToF= 0.35;
1965 fUseCorrectedTPCClsInfo=1;
1969 fUseCorrectedTPCClsInfo=1;
1972 AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
1977 ///________________________________________________________________________
1978 Bool_t AliConversionCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
1980 switch(ededxSigmaCut){
1982 fPIDnSigmaBelowElectronLine=-10;
1983 fPIDnSigmaAboveElectronLine=10;
1986 fPIDnSigmaBelowElectronLine=-5;
1987 fPIDnSigmaAboveElectronLine=5;
1990 fPIDnSigmaBelowElectronLine=-3;
1991 fPIDnSigmaAboveElectronLine=5;
1994 fPIDnSigmaBelowElectronLine=-4;
1995 fPIDnSigmaAboveElectronLine=5;
1998 fPIDnSigmaBelowElectronLine=-6;
1999 fPIDnSigmaAboveElectronLine=7;
2002 fPIDnSigmaBelowElectronLine=-4;
2003 fPIDnSigmaAboveElectronLine=4;
2006 fPIDnSigmaBelowElectronLine=-2.5;
2007 fPIDnSigmaAboveElectronLine=4;
2010 fPIDnSigmaBelowElectronLine=-2;
2011 fPIDnSigmaAboveElectronLine=3.5;
2014 AliError("TPCdEdxCutElectronLine not defined");
2020 ///________________________________________________________________________
2021 Bool_t AliConversionCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
2024 switch(pidedxSigmaCut){
2026 fPIDnSigmaAbovePionLine=-10;
2027 fPIDnSigmaAbovePionLineHighPt=-10;
2030 fPIDnSigmaAbovePionLine=0;
2031 fPIDnSigmaAbovePionLineHighPt=-10;
2034 fPIDnSigmaAbovePionLine=1;
2035 fPIDnSigmaAbovePionLineHighPt=-10;
2038 fPIDnSigmaAbovePionLine=2.5;
2039 fPIDnSigmaAbovePionLineHighPt=-10;
2042 fPIDnSigmaAbovePionLine=0.5;
2043 fPIDnSigmaAbovePionLineHighPt=-10;
2046 fPIDnSigmaAbovePionLine=2.;
2047 fPIDnSigmaAbovePionLineHighPt=-10;
2050 fPIDnSigmaAbovePionLine=2.;
2051 fPIDnSigmaAbovePionLineHighPt=0.5;
2054 fPIDnSigmaAbovePionLine=3.5;
2055 fPIDnSigmaAbovePionLineHighPt=-10;
2058 fPIDnSigmaAbovePionLine=2.;
2059 fPIDnSigmaAbovePionLineHighPt=1.;
2062 fPIDnSigmaAbovePionLine=3.0; // We need a bit less tight cut on dE/dx
2063 fPIDnSigmaAbovePionLineHighPt=-10;
2066 AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2071 ///________________________________________________________________________
2072 Bool_t AliConversionCuts::SetMinMomPiondEdxCut(Int_t piMomdedxSigmaCut)
2074 switch(piMomdedxSigmaCut){
2076 fPIDMinPnSigmaAbovePionLine=0.5;
2079 fPIDMinPnSigmaAbovePionLine=1.;
2082 fPIDMinPnSigmaAbovePionLine=1.5;
2085 fPIDMinPnSigmaAbovePionLine=20.;
2088 fPIDMinPnSigmaAbovePionLine=50.;
2091 fPIDMinPnSigmaAbovePionLine=0.3;
2094 fPIDMinPnSigmaAbovePionLine=0.25;
2097 fPIDMinPnSigmaAbovePionLine=0.4;
2100 fPIDMinPnSigmaAbovePionLine=0.2;
2103 AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2108 ///________________________________________________________________________
2109 Bool_t AliConversionCuts::SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
2111 switch(piMaxMomdedxSigmaCut){
2113 fPIDMaxPnSigmaAbovePionLine=100.;
2116 fPIDMaxPnSigmaAbovePionLine=5.;
2119 fPIDMaxPnSigmaAbovePionLine=4.;
2122 fPIDMaxPnSigmaAbovePionLine=3.5;
2125 fPIDMaxPnSigmaAbovePionLine=3.;
2128 fPIDMaxPnSigmaAbovePionLine=7.;
2131 AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2136 ///________________________________________________________________________
2137 Bool_t AliConversionCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
2139 switch(LowPRejectionSigmaCut){
2141 fPIDnSigmaAtLowPAroundKaonLine=0;
2142 fPIDnSigmaAtLowPAroundProtonLine=0;
2143 fPIDnSigmaAtLowPAroundPionLine=0;
2144 fDoKaonRejectionLowP = kFALSE;
2145 fDoProtonRejectionLowP = kFALSE;
2146 fDoPionRejectionLowP = kFALSE;
2147 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2150 fPIDnSigmaAtLowPAroundKaonLine=0.5;
2151 fPIDnSigmaAtLowPAroundProtonLine=0.5;
2152 fPIDnSigmaAtLowPAroundPionLine=0.5;
2153 fDoKaonRejectionLowP = kTRUE;
2154 fDoProtonRejectionLowP = kTRUE;
2155 fDoPionRejectionLowP = kTRUE;
2156 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2159 fPIDnSigmaAtLowPAroundKaonLine=1;
2160 fPIDnSigmaAtLowPAroundProtonLine=1;
2161 fPIDnSigmaAtLowPAroundPionLine=1;
2162 fDoKaonRejectionLowP = kTRUE;
2163 fDoProtonRejectionLowP = kTRUE;
2164 fDoPionRejectionLowP = kTRUE;
2165 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2168 fPIDnSigmaAtLowPAroundKaonLine=2.;
2169 fPIDnSigmaAtLowPAroundProtonLine=2.;
2170 fPIDnSigmaAtLowPAroundPionLine=2.;
2171 fDoKaonRejectionLowP = kTRUE;
2172 fDoProtonRejectionLowP = kTRUE;
2173 fDoPionRejectionLowP = kTRUE;
2174 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2177 fPIDnSigmaAtLowPAroundKaonLine=0.;
2178 fPIDnSigmaAtLowPAroundProtonLine=0.;
2179 fPIDnSigmaAtLowPAroundPionLine=1;
2180 fDoKaonRejectionLowP = kFALSE;
2181 fDoProtonRejectionLowP = kFALSE;
2182 fDoPionRejectionLowP = kTRUE;
2183 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2186 fPIDnSigmaAtLowPAroundKaonLine=0.;
2187 fPIDnSigmaAtLowPAroundProtonLine=0.;
2188 fPIDnSigmaAtLowPAroundPionLine=1.5;
2189 fDoKaonRejectionLowP = kFALSE;
2190 fDoProtonRejectionLowP = kFALSE;
2191 fDoPionRejectionLowP = kTRUE;
2192 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2195 fPIDnSigmaAtLowPAroundKaonLine=0.;
2196 fPIDnSigmaAtLowPAroundProtonLine=0.;
2197 fPIDnSigmaAtLowPAroundPionLine=2.;
2198 fDoKaonRejectionLowP = kFALSE;
2199 fDoProtonRejectionLowP = kFALSE;
2200 fDoPionRejectionLowP = kTRUE;
2201 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2204 fPIDnSigmaAtLowPAroundKaonLine=0.;
2205 fPIDnSigmaAtLowPAroundProtonLine=0.;
2206 fPIDnSigmaAtLowPAroundPionLine=0.5;
2207 fDoKaonRejectionLowP = kFALSE;
2208 fDoProtonRejectionLowP = kFALSE;
2209 fDoPionRejectionLowP = kTRUE;
2210 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2213 AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
2218 ///________________________________________________________________________
2219 Bool_t AliConversionCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
2221 switch(TOFelectronPID){
2223 fUseTOFpid = kFALSE;
2224 fTofPIDnSigmaBelowElectronLine=-100;
2225 fTofPIDnSigmaAboveElectronLine=100;
2229 fTofPIDnSigmaBelowElectronLine=-7;
2230 fTofPIDnSigmaAboveElectronLine=7;
2234 fTofPIDnSigmaBelowElectronLine=-5;
2235 fTofPIDnSigmaAboveElectronLine=5;
2239 fTofPIDnSigmaBelowElectronLine=-3;
2240 fTofPIDnSigmaAboveElectronLine=5;
2244 fTofPIDnSigmaBelowElectronLine=-2;
2245 fTofPIDnSigmaAboveElectronLine=3;
2249 fTofPIDnSigmaBelowElectronLine=-3;
2250 fTofPIDnSigmaAboveElectronLine=3;
2253 AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
2258 ///________________________________________________________________________
2259 Bool_t AliConversionCuts::SetQtMaxCut(Int_t QtMaxCut)
2264 fDoQtGammaSelection=kFALSE;
2265 fDoHighPtQtGammaSelection=kFALSE;
2267 fPtBorderForQt=100.;
2271 fDoHighPtQtGammaSelection=kFALSE;
2273 fPtBorderForQt=100.;
2277 fDoHighPtQtGammaSelection=kFALSE;
2279 fPtBorderForQt=100.;
2283 fDoHighPtQtGammaSelection=kFALSE;
2285 fPtBorderForQt=100.;
2289 fDoHighPtQtGammaSelection=kFALSE;
2291 fPtBorderForQt=100.;
2295 fDoHighPtQtGammaSelection=kFALSE;
2297 fPtBorderForQt=100.;
2301 fDoHighPtQtGammaSelection=kTRUE;
2307 fDoHighPtQtGammaSelection=kFALSE;
2309 fPtBorderForQt=100.;
2312 AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
2317 ///________________________________________________________________________
2318 Bool_t AliConversionCuts::SetChi2GammaCut(Int_t chi2GammaCut)
2321 switch(chi2GammaCut){
2323 fChi2CutConversion = 100.;
2326 fChi2CutConversion = 50.;
2329 fChi2CutConversion = 30.;
2332 fChi2CutConversion = 200.;
2335 fChi2CutConversion = 500.;
2338 fChi2CutConversion = 100000.;
2341 fChi2CutConversion = 5.;
2344 fChi2CutConversion = 10.;
2347 fChi2CutConversion = 20.;
2350 fChi2CutConversion = 15.;
2353 AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
2358 ///________________________________________________________________________
2359 Bool_t AliConversionCuts::SetPsiPairCut(Int_t psiCut) {
2363 fPsiPairCut = 10000; //
2366 fPsiPairCut = 0.1; //
2369 fPsiPairCut = 0.05; // Standard
2372 fPsiPairCut = 0.035; //
2375 fPsiPairCut = 0.15; //
2378 fPsiPairCut = 0.2; //
2381 fPsiPairCut = 0.03; //
2384 fPsiPairCut = 0.025; //
2387 fPsiPairCut = 0.01; //
2390 fPsiPairCut = 0.5; //
2393 AliError(Form("PsiPairCut not defined %d",psiCut));
2399 ///________________________________________________________________________
2400 Bool_t AliConversionCuts::SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut){
2402 switch(doPhotonAsymmetryCut){
2404 fDoPhotonAsymmetryCut=0;
2405 fMinPPhotonAsymmetryCut=100.;
2406 fMinPhotonAsymmetry=0.;
2409 fDoPhotonAsymmetryCut=1;
2410 fMinPPhotonAsymmetryCut=3.5;
2411 fMinPhotonAsymmetry=0.04;
2414 fDoPhotonAsymmetryCut=1;
2415 fMinPPhotonAsymmetryCut=3.5;
2416 fMinPhotonAsymmetry=0.06;
2419 AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
2422 fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
2425 ///________________________________________________________________________
2426 Bool_t AliConversionCuts::SetCosPAngleCut(Int_t cosCut) {
2430 fCosPAngleCut = TMath::Pi(); // -1
2433 fCosPAngleCut = 0.1; // 0.99500
2436 fCosPAngleCut = 0.05; // 0.99875
2439 fCosPAngleCut = 0.025; // 0.99969
2442 fCosPAngleCut = 0.01; // 0.99995
2445 fCosPAngleCut = 0.2; // 0.98007
2448 fCosPAngleCut = 0.5; // 0.87758
2451 fCosPAngleCut = 0.075; // 0.73169
2454 AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
2460 ///________________________________________________________________________
2461 Bool_t AliConversionCuts::SetSharedElectronCut(Int_t sharedElec) {
2465 fDoSharedElecCut = kFALSE;
2468 fDoSharedElecCut = kTRUE;
2471 AliError(Form("Shared Electron Cut not defined %d",sharedElec));
2477 ///________________________________________________________________________
2478 Bool_t AliConversionCuts::SetToCloseV0sCut(Int_t toClose) {
2482 fDoToCloseV0sCut = kFALSE;
2486 fDoToCloseV0sCut = kTRUE;
2490 fDoToCloseV0sCut = kTRUE;
2494 fDoToCloseV0sCut = kTRUE;
2498 AliError(Form("Shared Electron Cut not defined %d",toClose));
2503 ///________________________________________________________________________
2504 Bool_t AliConversionCuts::SetTRDElectronCut(Int_t TRDElectronCut)
2506 switch(TRDElectronCut){
2512 fPIDTRDEfficiency=0.1;
2516 fPIDTRDEfficiency=0.8;
2520 fPIDTRDEfficiency=0.9;
2523 AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
2529 //-------------------------------------------------------------
2530 Double_t AliConversionCuts::GetCentrality(AliVEvent *event)
2531 { // Get Event Centrality
2533 AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
2535 AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
2537 if(fDetectorCentrality==0){
2538 return fESDCentrality->GetCentralityPercentile("V0M"); // default
2540 if(fDetectorCentrality==1){
2541 return fESDCentrality->GetCentralityPercentile("CL1");
2545 AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
2547 if(aodEvent->GetHeader()){return aodEvent->GetHeader()->GetCentrality();}
2552 //-------------------------------------------------------------
2553 Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEvent)
2554 { // Centrality Selection
2555 if(!fIsHeavyIon)return kTRUE;
2557 if(fCentralityMin == 0 && fCentralityMax == 0) return kTRUE;//0-100%
2558 if(fCentralityMin >= fCentralityMax) return kTRUE;//0-100%
2560 Double_t centrality=GetCentrality(event);
2561 if(centrality<0)return kFALSE;
2563 Int_t centralityC=0;
2564 if (fModCentralityClass == 0){
2565 centralityC= Int_t(centrality/10);
2566 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2570 else if (fModCentralityClass ==1){
2571 centralityC= Int_t(centrality);
2572 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2574 } else return kFALSE;
2576 else if (fModCentralityClass ==2){
2577 centralityC= Int_t(centrality);
2578 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2583 // Use strict V0 amplitude cut for MC centrality
2584 Float_t nv0amplitude = event->GetVZEROData()->GetMTotV0A()+event->GetVZEROData()->GetMTotV0C();
2585 Float_t V0Amplitude10[10] = {9999999.0,13670,9345,6209,3944,2352,1272,611,255, 83};
2586 // 0 10 20 30 40 50 60 70 80 90%
2587 Float_t V0Amplitude5a[10] = {9999999.0,16612,13670,11290,9345,7650,6209,4984,3944,3074};
2588 // 0 5 10 15 20 25 30 35 40 45%
2589 Float_t V0Amplitude5b[10] = {3074,2352,1725,1272,899,611,402,255,152,83};
2590 // 45 50 55 60 65 70 75 80 85 90%
2592 if (fModCentralityClass == 3){
2594 if(nv0amplitude > V0Amplitude10[fCentralityMax] && nv0amplitude <= V0Amplitude10[fCentralityMin])
2599 centralityC= Int_t(centrality/10);
2600 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2605 else if (fModCentralityClass ==4){
2607 if(nv0amplitude > V0Amplitude5a[fCentralityMax] && nv0amplitude <= V0Amplitude5a[fCentralityMin])
2612 centralityC= Int_t(centrality);
2613 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2615 } else return kFALSE;
2618 else if (fModCentralityClass ==5){
2620 if(nv0amplitude > V0Amplitude5b[fCentralityMax] && nv0amplitude <= V0Amplitude5b[fCentralityMin])
2625 centralityC= Int_t(centrality);
2626 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2634 ///________________________________________________________________________
2635 Bool_t AliConversionCuts::VertexZCut(AliVEvent *event){
2636 // Cut on z position of primary vertex
2637 Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2639 if(abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2642 ///________________________________________________________________________
2644 Int_t AliConversionCuts::GetNumberOfContributorsVtx(AliVEvent *event){
2645 // returns number of contributors to the vertex
2647 AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2649 if (fESDEvent->GetPrimaryVertex() != NULL){
2650 if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2651 return fESDEvent->GetPrimaryVertex()->GetNContributors();
2655 if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2656 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2657 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2659 AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2665 AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2667 if (fAODEvent->GetPrimaryVertex() != NULL){
2668 if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2669 return fAODEvent->GetPrimaryVertex()->GetNContributors();
2672 if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2673 if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2674 return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2676 AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
2685 ///________________________________________________________________________
2687 Bool_t AliConversionCuts::IsTriggerSelected()
2690 AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
2692 UInt_t isSelected = AliVEvent::kAny;
2693 if( fInputHandler && fInputHandler->GetEventSelection()) {
2694 // Get the actual offline trigger mask for the event and AND it with the
2695 // requested mask. If no mask requested select by default the event.
2696 if (fOfflineTriggerMask)
2697 isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
2699 fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
2703 if (!fIsSDDFired) hTriggerClass->Fill(32);
2704 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
2705 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
2706 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
2707 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
2708 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
2709 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
2710 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
2711 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
2712 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
2713 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
2714 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
2715 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
2716 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
2717 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
2718 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
2719 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
2720 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
2721 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
2722 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
2723 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
2724 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
2725 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
2726 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
2727 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
2728 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
2729 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
2730 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
2731 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
2732 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
2733 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
2734 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
2735 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
2736 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
2737 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
2738 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
2739 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
2740 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
2741 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
2742 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(28);
2743 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(29);
2744 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(30);
2747 if(!isSelected)return kFALSE;
2753 ///________________________________________________________________________
2754 Int_t AliConversionCuts::GetFirstTPCRow(Double_t radius){
2755 // Get first TPC row
2756 Int_t firstTPCRow = 0;
2757 Double_t radiusI = 84.8;
2758 Double_t radiusO = 134.6;
2759 Double_t radiusOB = 198.;
2760 Double_t rSizeI = 0.75;
2761 Double_t rSizeO = 1.;
2762 Double_t rSizeOB = 1.5;
2766 if(radius <= radiusI){
2769 if(radius>radiusI && radius<=radiusO){
2770 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
2772 if(radius>radiusO && radius<=radiusOB){
2773 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
2776 if(radius>radiusOB){
2777 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
2783 Bool_t AliConversionCuts::CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const {
2784 ///Check if passes cosine of pointing angle cut
2785 if(GetCosineOfPointingAngle(photon, event) < (TMath::Cos(fCosPAngleCut))){
2791 Double_t AliConversionCuts::GetCosineOfPointingAngle( const AliConversionPhotonBase * photon, AliVEvent * event) const{
2792 // calculates the pointing angle of the recalculated V0
2794 Double_t momV0[3] = {0,0,0};
2795 if(event->IsA()==AliESDEvent::Class()){
2796 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
2797 if(!esdEvent) return -999;
2798 AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
2799 if(!v0) return -999;
2800 v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
2802 if(event->IsA()==AliAODEvent::Class()){
2803 momV0[0] = photon->GetPx();
2804 momV0[1] = photon->GetPy();
2805 momV0[2] = photon->GetPz();
2808 //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
2809 Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
2810 photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
2811 photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
2813 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
2814 Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
2817 Double_t cosinePointingAngle = -999;
2818 if(momV02*PosV02 > 0.0)
2819 cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
2821 return cosinePointingAngle;
2824 ///________________________________________________________________________
2825 Bool_t AliConversionCuts::PsiPairCut(const AliConversionPhotonBase * photon) const {
2827 if(photon->GetPsiPair() > fPsiPairCut){
2833 ///________________________________________________________________________
2834 TString AliConversionCuts::GetCutNumber(){
2835 // returns TString with current cut number
2837 for(Int_t ii=0;ii<kNCuts;ii++){
2838 a.Append(Form("%d",fCuts[ii]));
2843 ///________________________________________________________________________
2844 void AliConversionCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
2846 Int_t posLabel = photon->GetTrackLabelPositive();
2847 Int_t negLabel = photon->GetTrackLabelNegative();
2849 fElectronLabelArray[nV0*2] = posLabel;
2850 fElectronLabelArray[(nV0*2)+1] = negLabel;
2852 ///________________________________________________________________________
2853 Bool_t AliConversionCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
2855 Int_t posLabel = photon->GetTrackLabelPositive();
2856 Int_t negLabel = photon->GetTrackLabelNegative();
2858 for(Int_t i = 0; i<nV0s*2;i++){
2859 if(i==nV0*2) continue;
2860 if(i==(nV0*2)+1) continue;
2861 if(fElectronLabelArray[i] == posLabel){
2863 if(fElectronLabelArray[i] == negLabel){
2869 ///________________________________________________________________________
2870 Bool_t AliConversionCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
2873 Double_t posX = photon->GetConversionX();
2874 Double_t posY = photon->GetConversionY();
2875 Double_t posZ = photon->GetConversionZ();
2877 for(Int_t i = 0;i<photons->GetEntries();i++){
2878 if(nV0 == i) continue;
2879 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
2880 Double_t posCompX = photonComp->GetConversionX();
2881 Double_t posCompY = photonComp->GetConversionY();
2882 Double_t posCompZ = photonComp->GetConversionZ();
2884 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
2886 if(dist < fminV0Dist*fminV0Dist){
2887 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
2895 ///________________________________________________________________________
2896 void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliMCEvent *MCEvent){
2898 if(fNotRejectedStart){
2899 delete[] fNotRejectedStart;
2900 fNotRejectedStart = NULL;
2902 if(fNotRejectedEnd){
2903 delete[] fNotRejectedEnd;
2904 fNotRejectedEnd = NULL;
2906 if(fGeneratorNames){
2907 delete[] fGeneratorNames;
2908 fGeneratorNames = NULL;
2911 if(rejection == 0) return; // No Rejection
2912 AliGenCocktailEventHeader *cHeader = dynamic_cast<AliGenCocktailEventHeader*>(MCEvent->GenEventHeader());
2914 TList *genHeaders = cHeader->GetHeaders();
2915 AliGenEventHeader* gh = 0;
2917 if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
2918 if(rejection == 2){ // TList of Headers Names
2919 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2920 gh = (AliGenEventHeader*)genHeaders->At(i);
2921 TString GeneratorName = gh->GetName();
2922 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
2923 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
2924 if(GeneratorName.CompareTo(GeneratorInList) == 0){
2932 fNotRejectedStart = new Int_t[fnHeaders];
2933 fNotRejectedEnd = new Int_t[fnHeaders];
2934 fGeneratorNames = new TString[fnHeaders];
2936 if(rejection == 1 || rejection == 3){
2937 fNotRejectedStart[0] = 0;
2938 fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
2939 fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
2943 Int_t firstindex = 0;
2944 Int_t lastindex = -1;
2946 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2947 gh = (AliGenEventHeader*)genHeaders->At(i);
2948 TString GeneratorName = gh->GetName();
2949 lastindex = lastindex + gh->NProduced();
2950 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
2951 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
2952 if(GeneratorName.CompareTo(GeneratorInList) == 0){
2953 fNotRejectedStart[nummer] = firstindex;
2954 fNotRejectedEnd[nummer] = lastindex;
2955 fGeneratorNames[nummer] = GeneratorName;
2960 firstindex = firstindex + gh->NProduced();
2963 else{ // No Cocktail Header Found
2964 fNotRejectedStart = new Int_t[1];
2965 fNotRejectedEnd = new Int_t[1];
2968 fNotRejectedStart[0] = 0;
2969 fNotRejectedEnd[0] = MCEvent->Stack()->GetNprimary()-1;
2971 fGeneratorNames = new TString[1];
2972 fGeneratorNames[0] = "NoCocktailGeneratorFound";
2974 SetRejectExtraSignalsCut(0);
2978 //_________________________________________________________________________
2979 Bool_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack){
2981 if(index < 0) return kFALSE; // No Particle
2983 Bool_t accepted = kFALSE;
2984 if( index >= MCStack->GetNprimary()){ // Secondary Particle
2985 if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return kTRUE; // Secondary Particle without Mother??
2986 return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack);
2988 for(Int_t i = 0;i<fnHeaders;i++){
2989 if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
2996 //_________________________________________________________________________
2997 Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Bool_t isHeavyIon){
2999 if(isHeavyIon && !(IsCentralitySelected(InputEvent,MCEvent)))
3000 return 1; // Check Centrality --> Not Accepted => eventQuality = 1
3002 if(!isHeavyIon && GetIsFromPileup()){
3003 if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
3004 return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3008 Bool_t hasV0And = ReaderCuts->HasV0AND();
3009 Bool_t isSDDFired = ReaderCuts->IsSDDFired();
3010 if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent)
3011 return 7; // With SDD requested but no fired
3013 if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
3014 return 8; // V0AND requested but no fired