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 "AliGenDPMjetEventHeader.h"
45 #include "AliGenPythiaEventHeader.h"
46 #include "AliGenHijingEventHeader.h"
47 #include "AliTriggerAnalysis.h"
48 #include "AliV0ReaderV1.h"
54 ClassImp(AliConversionCuts)
57 const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
73 "piMaxMomdedxSigmaCut",
74 "LowPRejectionSigmaCut",
79 "DoPhotonAsymmetryCut",
80 "CosinePointingAngle",
86 //________________________________________________________________________
87 AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
88 AliAnalysisCuts(name,title),
104 fLineCutZRSlopeMin(0.),
105 fLineCutZValueMin(0),
106 fChi2CutConversion(1000),
107 fPIDProbabilityCutNegativeParticle(0),
108 fPIDProbabilityCutPositiveParticle(0),
109 fDodEdxSigmaCut(kTRUE),
110 fDoTOFsigmaCut(kFALSE),
111 fPIDTRDEfficiency(1),
113 fPIDnSigmaAboveElectronLine(100),
114 fPIDnSigmaBelowElectronLine(-100),
115 fTofPIDnSigmaAboveElectronLine(100),
116 fTofPIDnSigmaBelowElectronLine(-100),
117 fPIDnSigmaAbovePionLine(0),
118 fPIDnSigmaAbovePionLineHighPt(-100),
119 fPIDMinPnSigmaAbovePionLine(0),
120 fPIDMaxPnSigmaAbovePionLine(0),
121 fDoKaonRejectionLowP(kFALSE),
122 fDoProtonRejectionLowP(kFALSE),
123 fDoPionRejectionLowP(kFALSE),
124 fPIDnSigmaAtLowPAroundKaonLine(0),
125 fPIDnSigmaAtLowPAroundProtonLine(0),
126 fPIDnSigmaAtLowPAroundPionLine(0),
127 fPIDMinPKaonRejectionLowP(1.5),
128 fPIDMinPProtonRejectionLowP(2),
129 fPIDMinPPionRejectionLowP(0),
130 fDoQtGammaSelection(kTRUE),
131 fDoHighPtQtGammaSelection(kFALSE),
139 fUseEtaMinCut(kFALSE),
140 fUseOnFlyV0Finder(kTRUE),
141 fDoPhotonAsymmetryCut(kTRUE),
142 fMinPPhotonAsymmetryCut(100.),
143 fMinPhotonAsymmetry(0.),
145 fDetectorCentrality(0),
146 fModCentralityClass(0),
150 fUseCorrectedTPCClsInfo(kFALSE),
152 fMultiplicityMethod(0),
154 fRemovePileUp(kFALSE),
155 fOpeningAngle(0.005),
157 fCosPAngleCut(10000),
158 fDoToCloseV0sCut(kFALSE),
159 fRejectExtraSignals(0),
161 fDoSharedElecCut(kFALSE),
162 fOfflineTriggerMask(0),
166 fElectronArraySize(500),
167 fElectronLabelArray(NULL),
168 fConversionPointXArray(0.0),
169 fConversionPointYArray(0.0),
170 fConversionPointZArray(0.0),
172 fNotRejectedStart(NULL),
173 fNotRejectedEnd(NULL),
174 fGeneratorNames(NULL),
178 hTPCdEdxbefore(NULL),
180 hTPCdEdxSigbefore(NULL),
181 hTPCdEdxSigafter(NULL),
187 hInvMassbefore(NULL),
188 hArmenterosbefore(NULL),
190 hArmenterosafter(NULL),
191 hAcceptanceCuts(NULL),
197 hTriggerClassSelected(NULL)
200 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
201 fCutString=new TObjString((GetCutNumber()).Data());
203 fElectronLabelArray = new Int_t[fElectronArraySize];
204 fUtils = new AliAnalysisUtils();
205 //if you do not want to apply the cut on the distance between the SPD and TRK vertex:
206 //fUtils->SetCutOnZVertexSPD(kFALSE);
211 //________________________________________________________________________
212 AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
213 AliAnalysisCuts(ref),
215 fHeaderList(ref.fHeaderList),
217 fEventQuality(ref.fEventQuality),
220 fEtaCut(ref.fEtaCut),
221 fEtaCutMin(ref.fEtaCutMin),
223 fSinglePtCut(ref.fSinglePtCut),
225 fMinClsTPC(ref.fMinClsTPC),
226 fMinClsTPCToF(ref.fMinClsTPCToF),
227 fLineCutZRSlope(ref.fLineCutZRSlope),
228 fLineCutZValue(ref.fLineCutZValue),
229 fLineCutZRSlopeMin(ref.fLineCutZRSlopeMin),
230 fLineCutZValueMin(ref.fLineCutZValueMin),
231 fChi2CutConversion(ref.fChi2CutConversion),
232 fPIDProbabilityCutNegativeParticle(ref.fPIDProbabilityCutNegativeParticle),
233 fPIDProbabilityCutPositiveParticle(ref.fPIDProbabilityCutPositiveParticle),
234 fDodEdxSigmaCut(ref. fDodEdxSigmaCut),
235 fDoTOFsigmaCut(ref.fDoTOFsigmaCut),
236 fPIDTRDEfficiency(ref.fPIDTRDEfficiency),
237 fDoTRDPID(ref.fDoTRDPID),
238 fPIDnSigmaAboveElectronLine(ref.fPIDnSigmaAboveElectronLine),
239 fPIDnSigmaBelowElectronLine(ref.fPIDnSigmaBelowElectronLine),
240 fTofPIDnSigmaAboveElectronLine(ref.fTofPIDnSigmaAboveElectronLine),
241 fTofPIDnSigmaBelowElectronLine(ref.fTofPIDnSigmaBelowElectronLine),
242 fPIDnSigmaAbovePionLine(ref.fPIDnSigmaAbovePionLine),
243 fPIDnSigmaAbovePionLineHighPt(ref.fPIDnSigmaAbovePionLineHighPt),
244 fPIDMinPnSigmaAbovePionLine(ref.fPIDMinPnSigmaAbovePionLine),
245 fPIDMaxPnSigmaAbovePionLine(ref.fPIDMaxPnSigmaAbovePionLine),
246 fDoKaonRejectionLowP(ref.fDoKaonRejectionLowP),
247 fDoProtonRejectionLowP(ref.fDoProtonRejectionLowP),
248 fDoPionRejectionLowP(ref.fDoPionRejectionLowP),
249 fPIDnSigmaAtLowPAroundKaonLine(ref.fPIDnSigmaAtLowPAroundKaonLine),
250 fPIDnSigmaAtLowPAroundProtonLine(ref.fPIDnSigmaAtLowPAroundProtonLine),
251 fPIDnSigmaAtLowPAroundPionLine(ref.fPIDnSigmaAtLowPAroundPionLine),
252 fPIDMinPKaonRejectionLowP(ref.fPIDMinPKaonRejectionLowP),
253 fPIDMinPProtonRejectionLowP(ref.fPIDMinPProtonRejectionLowP),
254 fPIDMinPPionRejectionLowP(ref.fPIDMinPPionRejectionLowP),
255 fDoQtGammaSelection(ref.fDoQtGammaSelection),
256 fDoHighPtQtGammaSelection(ref.fDoHighPtQtGammaSelection),
258 fHighPtQtMax(ref.fHighPtQtMax),
259 fPtBorderForQt(ref.fPtBorderForQt),
260 fXVertexCut(ref.fXVertexCut),
261 fYVertexCut(ref.fYVertexCut),
262 fZVertexCut(ref.fZVertexCut),
263 fNSigmaMass(ref.fNSigmaMass),
264 fUseEtaMinCut(ref.fUseEtaMinCut),
265 fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
266 fDoPhotonAsymmetryCut(ref.fDoPhotonAsymmetryCut),
267 fMinPPhotonAsymmetryCut(ref.fMinPPhotonAsymmetryCut),
268 fMinPhotonAsymmetry(ref.fMinPhotonAsymmetry),
269 fIsHeavyIon(ref.fIsHeavyIon),
270 fDetectorCentrality(ref.fDetectorCentrality),
271 fModCentralityClass(ref.fModCentralityClass),
272 fMaxVertexZ(ref.fMaxVertexZ),
273 fCentralityMin(ref.fCentralityMin),
274 fCentralityMax(ref.fCentralityMax),
275 fUseCorrectedTPCClsInfo(ref.fUseCorrectedTPCClsInfo),
276 fUseTOFpid(ref.fUseTOFpid),
277 fMultiplicityMethod(ref.fMultiplicityMethod),
278 fSpecialTrigger(ref.fSpecialTrigger),
279 fRemovePileUp(ref.fRemovePileUp),
280 fOpeningAngle(ref.fOpeningAngle),
281 fPsiPairCut(ref.fPsiPairCut),
282 fCosPAngleCut(ref.fCosPAngleCut),
283 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
284 fRejectExtraSignals(ref.fRejectExtraSignals),
285 fminV0Dist(ref.fminV0Dist),
286 fDoSharedElecCut(ref.fDoSharedElecCut),
287 fOfflineTriggerMask(ref.fOfflineTriggerMask),
288 fHasV0AND(ref.fHasV0AND),
289 fIsSDDFired(ref.fIsSDDFired),
290 fRandom(ref.fRandom),
291 fElectronArraySize(ref.fElectronArraySize),
292 fElectronLabelArray(NULL),
293 fConversionPointXArray(ref.fConversionPointXArray),
294 fConversionPointYArray(ref.fConversionPointYArray),
295 fConversionPointZArray(ref.fConversionPointZArray),
296 fnHeaders(ref.fnHeaders),
297 fNotRejectedStart(NULL),
298 fNotRejectedEnd(NULL),
299 fGeneratorNames(ref.fGeneratorNames),
303 hTPCdEdxbefore(NULL),
305 hTPCdEdxSigbefore(NULL),
306 hTPCdEdxSigafter(NULL),
312 hInvMassbefore(NULL),
313 hArmenterosbefore(NULL),
315 hArmenterosafter(NULL),
316 hAcceptanceCuts(NULL),
322 hTriggerClassSelected(NULL)
325 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
326 fCutString=new TObjString((GetCutNumber()).Data());
327 fElectronLabelArray = new Int_t[fElectronArraySize];
328 fUtils = new AliAnalysisUtils();
329 // dont copy histograms (if you like histograms, call InitCutHistograms())
333 //________________________________________________________________________
334 AliConversionCuts::~AliConversionCuts() {
336 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
338 // delete fHistograms;
339 // fHistograms = NULL;
340 if(fCutString != NULL){
344 if(fElectronLabelArray){
345 delete fElectronLabelArray;
346 fElectronLabelArray = NULL;
348 if(fNotRejectedStart){
349 delete[] fNotRejectedStart;
350 fNotRejectedStart = NULL;
353 delete[] fNotRejectedEnd;
354 fNotRejectedEnd = NULL;
357 delete[] fGeneratorNames;
358 fGeneratorNames = NULL;
367 //________________________________________________________________________
368 void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
370 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
372 if(fHistograms != NULL){
376 if(fHistograms==NULL){
377 fHistograms=new TList();
378 if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
379 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
383 hCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",10,-0.5,9.5);
384 hCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
385 hCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
386 hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
387 hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
388 hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
389 hCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
390 hCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
391 hCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
392 fHistograms->Add(hCutIndex);
395 hTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
396 hTrackCuts->GetXaxis()->SetBinLabel(1,"in");
397 hTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
398 hTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
399 hTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
400 hTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
401 hTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
402 hTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
403 hTrackCuts->GetXaxis()->SetBinLabel(8,"out");
404 fHistograms->Add(hTrackCuts);
407 hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",12,-0.5,11.5);
408 hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
409 hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
410 hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
411 hPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
412 hPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
413 hPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
414 hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
415 hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
416 hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
417 hPhotonCuts->GetXaxis()->SetBinLabel(10,"out");
418 fHistograms->Add(hPhotonCuts);
421 hInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
422 fHistograms->Add(hInvMassbefore);
423 hArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
424 fHistograms->Add(hArmenterosbefore);
426 hInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
427 fHistograms->Add(hInvMassafter);
428 hArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
429 fHistograms->Add(hArmenterosafter);
431 hAcceptanceCuts=new TH1F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts",10,-0.5,9.5);
432 hAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
433 hAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
434 hAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
435 hAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
436 hAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
437 hAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
438 hAcceptanceCuts->GetXaxis()->SetBinLabel(7,"minpt");
439 hAcceptanceCuts->GetXaxis()->SetBinLabel(8,"out");
440 fHistograms->Add(hAcceptanceCuts);
443 hdEdxCuts=new TH1F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts",10,-0.5,9.5);
444 hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
445 hdEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
446 hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
447 hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
448 hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
449 hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
450 hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
451 hdEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
452 hdEdxCuts->GetXaxis()->SetBinLabel(9,"TRDelectron");
453 hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
454 fHistograms->Add(hdEdxCuts);
456 TAxis *AxisBeforedEdx = NULL;
457 TAxis *AxisBeforedEdxSig = NULL;
458 TAxis *AxisBeforeTOF = NULL;
459 TAxis *AxisBeforeTOFSig = NULL;
461 hTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
462 fHistograms->Add(hTPCdEdxbefore);
463 AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
464 hTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
465 fHistograms->Add(hTPCdEdxSigbefore);
466 AxisBeforedEdxSig = hTPCdEdxSigbefore->GetXaxis();
468 hTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
469 fHistograms->Add(hTOFbefore);
470 AxisBeforeTOF = hTOFbefore->GetXaxis();
471 hTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
472 fHistograms->Add(hTOFSigbefore);
473 AxisBeforeTOFSig = hTOFSigbefore->GetXaxis();
476 hTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
477 fHistograms->Add(hTPCdEdxSigafter);
479 hTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
480 fHistograms->Add(hTPCdEdxafter);
482 hTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
483 fHistograms->Add(hTOFSigafter);
485 TAxis *AxisAfter = hTPCdEdxSigafter->GetXaxis();
486 Int_t bins = AxisAfter->GetNbins();
487 Double_t from = AxisAfter->GetXmin();
488 Double_t to = AxisAfter->GetXmax();
489 Double_t *newBins = new Double_t[bins+1];
491 Double_t factor = TMath::Power(to/from, 1./bins);
492 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
493 AxisAfter->Set(bins, newBins);
494 AxisAfter = hTOFSigafter->GetXaxis();
495 AxisAfter->Set(bins, newBins);
496 AxisAfter = hTPCdEdxafter->GetXaxis();
497 AxisAfter->Set(bins, newBins);
499 AxisBeforedEdx->Set(bins, newBins);
500 AxisBeforeTOF->Set(bins, newBins);
501 AxisBeforedEdxSig->Set(bins, newBins);
502 AxisBeforeTOFSig->Set(bins, newBins);
506 // Event Cuts and Info
508 hV0EventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",7,-0.5,6.5);
509 hV0EventCuts->GetXaxis()->SetBinLabel(1,"in");
510 hV0EventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
511 hV0EventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
512 hV0EventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
513 hV0EventCuts->GetXaxis()->SetBinLabel(5,"pileup");
514 hV0EventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
515 hV0EventCuts->GetXaxis()->SetBinLabel(7,"out");
516 fHistograms->Add(hV0EventCuts);
518 hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",100,0,100);
519 fHistograms->Add(hCentrality);
520 hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
521 fHistograms->Add(hVertexZ);
523 hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",34,-0.5,33.5);
524 hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
525 hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
526 hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
527 hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
528 hTriggerClass->GetXaxis()->SetBinLabel( 5,"kKEMC1");
529 hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
530 hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
531 hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
532 hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
533 hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
534 hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
535 hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
536 hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
537 hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
538 hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
539 hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
540 hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
541 hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
542 hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
543 hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
544 hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
545 hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
546 hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
547 hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
548 hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
549 hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
550 hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
551 hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
552 hTriggerClass->GetXaxis()->SetBinLabel(29,"kFastOnly");
553 hTriggerClass->GetXaxis()->SetBinLabel(30,"kAnyINT");
554 hTriggerClass->GetXaxis()->SetBinLabel(31,"kAny");
555 hTriggerClass->GetXaxis()->SetBinLabel(32,"V0AND");
556 hTriggerClass->GetXaxis()->SetBinLabel(33,"NOT kFastOnly");
557 hTriggerClass->GetXaxis()->SetBinLabel(34,"failed Physics Selection");
558 fHistograms->Add(hTriggerClass);
560 hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",33,-0.5,32.5);
561 hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB");
562 hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7");
563 hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON");
564 hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult");
565 hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kKEMC1");
566 hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5");
567 hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
568 hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
569 hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
570 hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
571 hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
572 hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7");
573 hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1");
574 hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
575 hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE");
576 hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA");
577 hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral");
578 hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral");
579 hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5");
580 hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED");
581 hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
582 hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8");
583 hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
584 hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
585 hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
586 hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
587 hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
588 hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined");
589 hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kFastOnly");
590 hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kAnyINT");
591 hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAny");
592 hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"V0AND");
593 hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"NOT kFastOnly");
594 fHistograms->Add(hTriggerClassSelected);
598 //________________________________________________________________________
599 Bool_t AliConversionCuts::InitPIDResponse(){
600 // Set Pointer to AliPIDResponse
602 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
604 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
605 fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
606 if(fPIDResponse)return kTRUE;
613 ///________________________________________________________________________
614 Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent){
615 // Process Event Selection
618 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
621 // Check for MC event
623 // Check if MC event is correctly loaded
624 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
629 if (!mcHandler->InitOk() ){
633 if (!mcHandler->TreeK() ){
637 if (!mcHandler->TreeTR() ) {
644 if(!IsTriggerSelected()){
645 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
651 if(fInputEvent->IsA()==AliESDEvent::Class()){
652 AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
653 fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
654 if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(31);
657 // Number of Contributors Cut
658 if(GetNumberOfContributorsVtx(fInputEvent)<=0) {
659 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
665 // Z Vertex Position Cut
666 if(!VertexZCut(fInputEvent)){
667 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
676 if(fInputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
677 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
684 // Centrality Selection
685 if(!IsCentralitySelected(fInputEvent,fMCEvent)){
686 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
692 // Fill Event Histograms
693 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
694 if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
695 if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent));
701 ///________________________________________________________________________
702 Bool_t AliConversionCuts::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
703 // MonteCarlo Photon Selection
705 if(!fMCStack)return kFALSE;
707 if (particle->GetPdgCode() == 22){
709 if(particle->R() > fMaxR) return kFALSE;
710 if(abs(particle->Eta())> fEtaCut || abs(particle->Eta())< fEtaCutMin) return kFALSE;
712 if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
713 return kFALSE; // no photon as mothers!
716 if(particle->GetMother(0) >= fMCStack->GetNprimary()){
717 return kFALSE; // the gamma has a mother, and it is not a primary particle
720 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
722 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
723 TParticle* ePos = NULL;
724 TParticle* eNeg = NULL;
726 if(particle->GetNDaughters() >= 2){
727 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
728 TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
729 if(tmpDaughter->GetUniqueID() == 5){
730 if(tmpDaughter->GetPdgCode() == 11){
732 } else if(tmpDaughter->GetPdgCode() == -11){
739 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
743 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
744 return kFALSE; // no reconstruction below the Pt cut
747 if( abs(ePos->Eta())> fEtaCut || abs(ePos->Eta())< fEtaCutMin ||
748 abs(eNeg->Eta())> fEtaCut || abs(eNeg->Eta())< fEtaCutMin ) {
753 return kFALSE; // cuts on distance from collision point
756 if(abs(ePos->Vz()) > fMaxZ){
757 return kFALSE; // outside material
759 if(abs(eNeg->Vz()) > fMaxZ){
760 return kFALSE; // outside material
763 if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
764 return kFALSE; // line cut to exclude regions where we do not reconstruct
765 } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
769 if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
770 return kFALSE; // line cut to exclude regions where we do not reconstruct
771 } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
776 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
782 ///________________________________________________________________________
783 Bool_t AliConversionCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event)
784 { // Specific Photon Cuts
787 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex);
790 // Fill Histos before Cuts
791 if(hInvMassbefore)hInvMassbefore->Fill(photon->GetMass());
793 if(hArmenterosbefore)hArmenterosbefore->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
795 // Gamma selection based on QT from Armenteros
796 if(fDoQtGammaSelection == kTRUE){
797 if(!ArmenterosQtCut(photon)){
798 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //1
805 if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
807 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //2
813 // Reconstruction Acceptance Cuts
814 if(!AcceptanceCuts(photon)){
815 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //3
821 if(fDoPhotonAsymmetryCut == kTRUE){
822 if(!AsymmetryCut(photon,event)){
823 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //4
828 //Check the pid probability
830 if(!PIDProbabilityCut(photon, event)) {
831 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //5
836 if(!CorrectedTPCClusterCut(photon, event)) {
837 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //6
843 if(!PsiPairCut(photon)) {
844 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //7
849 if(!CosinePAngleCut(photon, event)) {
850 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //8
855 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
858 if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
859 if(hArmenterosafter)hArmenterosafter->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
866 ///________________________________________________________________________
867 Bool_t AliConversionCuts::CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event)
868 { //Cut on corrected TPC Cluster Info
870 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
871 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
873 if(!negTrack||!posTrack)return kFALSE;
875 Double_t negclsToF=0;
877 if (!fUseCorrectedTPCClsInfo ){
878 if(negTrack->GetTPCNclsF()!=0){
879 negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
882 negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
885 Double_t posclsToF = 0.;
886 if (!fUseCorrectedTPCClsInfo ){
887 if(posTrack->GetTPCNclsF()!=0){
888 posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
891 posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
894 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
901 ///________________________________________________________________________
902 Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent * event)
904 //Selection of Reconstructed Photons
906 FillPhotonCutIndex(kPhotonIn);
908 if(event->IsA()==AliESDEvent::Class()) {
909 if(!SelectV0Finder( ( ((AliESDEvent*)event)->GetV0(photon->GetV0Index())) ) ){
910 FillPhotonCutIndex(kOnFly);
914 // else if(event->IsA()==AliAODEvent::Class()) {
915 // if(!SelectV0Finder( ( ((AliAODEvent*)event)->GetV0(photon->GetV0Index())) ) ){
916 // FillPhotonCutIndex(kOnFly);
922 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
923 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
925 if(!negTrack || !posTrack) {
926 FillPhotonCutIndex(kNoTracks);
931 if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
932 FillPhotonCutIndex(kdEdxCuts);
937 if(!TracksAreSelected(negTrack, posTrack)){
938 FillPhotonCutIndex(kTrackCuts);
943 if(!PhotonCuts(photon,event)){
944 FillPhotonCutIndex(kPhotonCuts);
948 // Photon passed cuts
949 FillPhotonCutIndex(kPhotonOut);
953 ///________________________________________________________________________
954 Bool_t AliConversionCuts::ArmenterosQtCut(AliConversionPhotonBase *photon)
955 { // Armenteros Qt Cut
957 if(fDoHighPtQtGammaSelection){
958 if(photon->GetPhotonPt() < fPtBorderForQt){
959 if(photon->GetArmenterosQt()>fQtMax){
963 if(photon->GetArmenterosQt()>fHighPtQtMax){
969 if(photon->GetArmenterosQt()>fQtMax){
977 ///________________________________________________________________________
978 Bool_t AliConversionCuts::AcceptanceCuts(AliConversionPhotonBase *photon) {
979 // Exclude certain areas for photon reconstruction
982 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
985 if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
986 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
991 if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
992 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
997 if(photon->GetConversionRadius() <= ((abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
998 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1001 else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1002 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1007 if(abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1008 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1014 if(abs(photon->GetPhotonEta())> fEtaCut || abs(photon->GetPhotonEta())< fEtaCutMin){
1015 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1021 if(photon->GetPhotonPt()<fPtCut){
1022 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1027 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1033 ///________________________________________________________________________
1034 Bool_t AliConversionCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
1035 // Track Cuts which require AOD/ESD specific implementation
1037 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1038 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1043 AliAODVertex * NegVtxType=negTrack->GetProdVertex();
1044 AliAODVertex * PosVtxType=posTrack->GetProdVertex();
1045 if((NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
1046 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1054 ///________________________________________________________________________
1055 Bool_t AliConversionCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
1056 // Track Cuts which require AOD/ESD specific implementation
1058 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1059 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1064 if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
1065 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1073 ///________________________________________________________________________
1074 Bool_t AliConversionCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1075 // Track Selection for Photon Reconstruction
1078 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1082 if(negTrack->Charge() == posTrack->Charge()) {
1083 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1088 // Number of TPC Clusters
1089 if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1090 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1097 if(abs(negTrack->Eta()) > fEtaCut || abs(negTrack->Eta()) < fEtaCutMin ||
1098 abs(posTrack->Eta())> fEtaCut || abs(posTrack->Eta())< fEtaCutMin) {
1099 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1105 if( negTrack->Pt()< fSinglePtCut || posTrack->Pt()< fSinglePtCut){
1106 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1111 // AOD ESD specific cuts
1112 Bool_t passCuts = kTRUE;
1114 if(negTrack->IsA()==AliAODTrack::Class()) {
1115 passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1117 passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1121 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1126 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1132 ///________________________________________________________________________
1133 Bool_t AliConversionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
1134 // Electron Identification Cuts for Photon reconstruction
1136 if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1137 if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1140 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1141 if(hTPCdEdxSigbefore)hTPCdEdxSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1142 if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1146 if(fDodEdxSigmaCut == kTRUE){
1147 // TPC Electron Line
1148 if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1149 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
1151 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1157 if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1158 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1159 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1160 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1162 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1169 if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1170 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1171 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine &&
1172 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1174 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1182 if(fDoKaonRejectionLowP == kTRUE){
1183 if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1184 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1186 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1193 if(fDoProtonRejectionLowP == kTRUE){
1194 if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1195 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1197 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1204 if(fDoPionRejectionLowP == kTRUE){
1205 if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1206 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1208 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1216 // cout<<"Start"<<endl;
1217 // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1219 // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1220 // {cout<<"TOF DA"<<endl;}
1221 // if(status == AliPIDResponse::kDetPidOk){
1222 // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1223 // cout<<"--> "<<probMis<<endl;
1224 // if(probMis > 0.01){
1229 if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1231 Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1233 fCurrentTrack->GetIntegratedTimes(times);
1234 Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1235 Double_t dT = TOFsignal - t0 - times[0];
1236 hTOFbefore->Fill(fCurrentTrack->P(),dT);
1238 if(hTOFSigbefore) hTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1240 if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1241 fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1242 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1246 if(hTOFSigafter)hTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1252 if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1253 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1259 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1260 if(hTPCdEdxSigafter)hTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1261 if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1265 ///________________________________________________________________________
1266 Bool_t AliConversionCuts::AsymmetryCut(AliConversionPhotonBase * photon,AliVEvent *event) {
1267 // Cut on Energy Assymetry
1269 for(Int_t ii=0;ii<2;ii++){
1271 AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1273 if( track->P() > fMinPPhotonAsymmetryCut ){
1274 Double_t trackNegAsy=0;
1275 if (photon->GetPhotonP()!=0.){
1276 trackNegAsy= track->P()/photon->GetPhotonP();
1279 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1288 ///________________________________________________________________________
1289 AliVTrack *AliConversionCuts::GetTrack(AliVEvent * event, Int_t label){
1290 //Returns pointer to the track with given ESD label
1291 //(Important for AOD implementation, since Track array in AOD data is different
1292 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1294 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1296 if(label > event->GetNumberOfTracks() ) return NULL;
1297 AliESDtrack * track = esdEvent->GetTrack(label);
1301 for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1302 AliVTrack * track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1305 if(track->GetID() == label) {
1312 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1316 ///________________________________________________________________________
1317 AliESDtrack *AliConversionCuts::GetESDTrack(AliESDEvent * event, Int_t label){
1318 //Returns pointer to the track with given ESD label
1319 //(Important for AOD implementation, since Track array in AOD data is different
1320 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1323 if(label > event->GetNumberOfTracks() ) return NULL;
1324 AliESDtrack * track = event->GetTrack(label);
1327 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1333 ///________________________________________________________________________
1334 Bool_t AliConversionCuts::PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event){
1335 // Cut on Electron Probability for Photon Reconstruction
1337 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1341 Bool_t iResult=kFALSE;
1343 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1344 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1346 AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1347 AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1349 if(negProbArray && posProbArray){
1351 negTrack->GetTPCpid(negProbArray);
1352 posTrack->GetTPCpid(posProbArray);
1354 if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1359 delete [] posProbArray;
1360 delete [] negProbArray;
1364 ///Not possible for AODs
1374 ///________________________________________________________________________
1375 Bool_t AliConversionCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1376 // MC Acceptance Cuts
1377 //(Certain areas were excluded for photon reconstruction)
1379 if(particle->R()>fMaxR){
1382 if(ePos->R()>fMaxR){
1386 if(ePos->R()<fMinR){
1390 if( ePos->R() <= ((abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1393 else if (fUseEtaMinCut && ePos->R() >= ((abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1397 if(abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1401 if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1405 if(abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1409 if(abs(particle->Eta())> fEtaCut || abs(particle->Eta())< fEtaCutMin){
1413 if(abs(ePos->Eta())> fEtaCut || abs(ePos->Eta())< fEtaCutMin){
1417 if(abs(eNeg->Eta())> fEtaCut || abs(eNeg->Eta())< fEtaCutMin){
1421 if( ePos->Pt()< fSinglePtCut || eNeg->Pt()< fSinglePtCut){
1425 if(particle->Pt()<fPtCut){
1431 ///________________________________________________________________________
1432 Bool_t AliConversionCuts::UpdateCutString() {
1433 ///Update the cut string (if it has been created yet)
1435 if(fCutString && fCutString->GetString().Length() == kNCuts) {
1436 fCutString->SetString(GetCutNumber());
1443 ///________________________________________________________________________
1444 Bool_t AliConversionCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
1445 // Initialize Cuts from a given Cut string
1447 AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1448 if(analysisCutSelection.Length()!=kNCuts) {
1449 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1452 if(!analysisCutSelection.IsDigit()){
1453 AliError("Cut selection contains characters");
1457 const char *cutSelection = analysisCutSelection.Data();
1458 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
1459 for(Int_t ii=0;ii<kNCuts;ii++){
1463 // Set Individual Cuts
1464 for(Int_t ii=0;ii<kNCuts;ii++){
1465 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1470 // Set StandardTriggers
1472 if(fIsHeavyIon)SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
1473 else SelectCollisionCandidates(AliVEvent::kMB);
1477 ///________________________________________________________________________
1478 Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
1479 ///Set individual cut ID
1484 if( SetV0Finder(value)) {
1485 fCuts[kv0FinderType] = value;
1488 } else return kFALSE;
1490 case kededxSigmaCut:
1491 if( SetTPCdEdxCutElectronLine(value)) {
1492 fCuts[kededxSigmaCut] = value;
1495 } else return kFALSE;
1497 case kpidedxSigmaCut:
1498 if( SetTPCdEdxCutPionLine(value)) {
1499 fCuts[kpidedxSigmaCut] = value;
1502 } else return kFALSE;
1504 case kpiMomdedxSigmaCut:
1505 if( SetMinMomPiondEdxCut(value)) {
1506 fCuts[kpiMomdedxSigmaCut] = value;
1509 } else return kFALSE;
1512 if( SetChi2GammaCut(value)) {
1513 fCuts[kchi2GammaCut] = value;
1516 } else return kFALSE;
1519 if( SetSinglePtCut(value)) {
1520 fCuts[ksinglePtCut] = value;
1523 } else return kFALSE;
1526 if( SetTPCClusterCut(value)) {
1527 fCuts[kclsTPCCut] = value;
1530 } else return kFALSE;
1533 if( SetEtaCut(value)) {
1534 fCuts[ketaCut] = value;
1537 } else return kFALSE;
1539 case kLowPRejectionSigmaCut:
1540 if( SetLowPRejectionCuts(value)) {
1541 fCuts[kLowPRejectionSigmaCut] = value;
1544 } else return kFALSE;
1547 if( SetQtMaxCut(value)) {
1548 fCuts[kQtMaxCut] = value;
1551 } else return kFALSE;
1553 case kpiMaxMomdedxSigmaCut:
1554 if( SetMaxMomPiondEdxCut(value)) {
1555 fCuts[kpiMaxMomdedxSigmaCut] = value;
1558 } else return kFALSE;
1561 if( SetRCut(value)) {
1562 fCuts[kRCut] = value;
1565 } else return kFALSE;
1568 if( SetRemovePileUp(value)) {
1569 fCuts[kremovePileUp] = value;
1572 } else return kFALSE;
1575 if( SetSelectSpecialTrigger(value)) {
1576 fCuts[kselectV0AND] = value;
1579 } else return kFALSE;
1581 case kmultiplicityMethod:
1582 if( SetMultiplicityMethod(value)) {
1583 fCuts[kmultiplicityMethod] = value;
1586 } else return kFALSE;
1589 if( SetIsHeavyIon(value)) {
1590 fCuts[kisHeavyIon] = value;
1593 } else return kFALSE;
1595 case kCentralityMin:
1596 if( SetCentralityMin(value)) {
1597 fCuts[kCentralityMin] = value;
1600 } else return kFALSE;
1602 case kCentralityMax:
1603 if( SetCentralityMax(value)) {
1604 fCuts[kCentralityMax] = value;
1607 } else return kFALSE;
1609 case kTOFelectronPID:
1610 if( SetTOFElectronPIDCut(value)) {
1611 fCuts[kTOFelectronPID] = value;
1614 } else return kFALSE;
1616 case kdoPhotonAsymmetryCut:
1617 if( SetPhotonAsymmetryCut(value)) {
1618 fCuts[kdoPhotonAsymmetryCut] = value;
1621 } else return kFALSE;
1624 if( SetPsiPairCut(value)) {
1625 fCuts[kPsiPair] = value;
1628 } else return kFALSE;
1631 if( SetCosPAngleCut(value)) {
1632 fCuts[kCosPAngle] = value;
1635 } else return kFALSE;
1639 if( SetSharedElectronCut(value)) {
1640 fCuts[kElecShare] = value;
1643 } else return kFALSE;
1646 if( SetToCloseV0sCut(value)) {
1647 fCuts[kToCloseV0s] = value;
1650 } else return kFALSE;
1653 if( SetRejectExtraSignalsCut(value)) {
1654 fCuts[kExtraSignals] = value;
1657 } else return kFALSE;
1660 AliError("Cut id out of range");
1664 AliError("Cut id %d not recognized");
1669 ///________________________________________________________________________
1670 void AliConversionCuts::PrintCuts() {
1671 // Print out current Cut Selection
1672 for(Int_t ic = 0; ic < kNCuts; ic++) {
1673 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
1676 ///________________________________________________________________________
1677 Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
1685 fDetectorCentrality=0;
1689 fDetectorCentrality=1;
1691 case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1693 fDetectorCentrality=0;
1694 fModCentralityClass=1;
1696 case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1698 fDetectorCentrality=0;
1699 fModCentralityClass=2;
1701 case 5: //strict cut on v0 tracks for MC
1703 fDetectorCentrality=0;
1704 fModCentralityClass=3;
1706 case 6: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1707 //strict cut on v0 tracks for MC
1709 fDetectorCentrality=0;
1710 fModCentralityClass=4;
1712 case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1713 //strict cut on v0 tracks for MC
1715 fDetectorCentrality=0;
1716 fModCentralityClass=5;
1720 fDetectorCentrality=0;
1724 fDetectorCentrality=1;
1727 AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1733 //___________________________________________________________________
1734 Bool_t AliConversionCuts::SetCentralityMin(Int_t minCentrality)
1737 if(minCentrality<0||minCentrality>9){
1738 AliError(Form("minCentrality not defined %d",minCentrality));
1742 fCentralityMin=minCentrality;
1745 //___________________________________________________________________
1746 Bool_t AliConversionCuts::SetCentralityMax(Int_t maxCentrality)
1749 if(maxCentrality<0||maxCentrality>9){
1750 AliError(Form("maxCentrality not defined %d",maxCentrality));
1753 fCentralityMax=maxCentrality;
1756 ///________________________________________________________________________
1757 Int_t AliConversionCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger)
1760 switch(selectSpecialTrigger){
1762 fSpecialTrigger=0; // dont care
1765 fSpecialTrigger=1; // V0AND
1768 fSpecialTrigger=2; // with SDD requested
1771 fSpecialTrigger=3; // V0AND plus with SDD requested
1775 AliError("Warning: Special Trigger Not known");
1780 ///________________________________________________________________________
1781 Bool_t AliConversionCuts::SetMultiplicityMethod(Int_t multiplicityMethod)
1784 fMultiplicityMethod=multiplicityMethod;
1786 // 0 Photon Multiplicity
1787 // 1 TPC Track multiplicity
1793 ///________________________________________________________________________
1794 Bool_t AliConversionCuts::SetRemovePileUp(Int_t removePileUp)
1796 switch(removePileUp){
1798 fRemovePileUp=kFALSE;
1801 fRemovePileUp=kTRUE;
1804 AliError("RemovePileUpCut not defined");
1809 ///________________________________________________________________________
1810 Bool_t AliConversionCuts::SetRejectExtraSignalsCut(Int_t extraSignal) {
1812 switch(extraSignal){
1814 fRejectExtraSignals = 0;
1815 break; // No Rejection
1817 fRejectExtraSignals = 1;
1818 break; // MinBias Header
1820 fRejectExtraSignals = 2;
1821 break; // User String Array
1823 fRejectExtraSignals = 3;
1824 break; // Rejection for Gamma Correction only
1826 AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
1831 ///________________________________________________________________________
1832 Bool_t AliConversionCuts::SetV0Finder(Int_t v0FinderType)
1834 switch (v0FinderType){
1835 case 0: // on fly V0 finder
1836 fUseOnFlyV0Finder=kTRUE;
1838 case 1: // offline V0 finder
1839 fUseOnFlyV0Finder=kFALSE;
1842 AliError(Form(" v0FinderType not defined %d",v0FinderType));
1847 ///________________________________________________________________________
1848 Bool_t AliConversionCuts::SetEtaCut(Int_t etaCut)
1851 //Set Standard LineCutZValues
1852 fLineCutZValueMin = -2;
1853 fLineCutZValue = 7.;
1858 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1860 fLineCutZRSlopeMin = 0.;
1864 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1866 fLineCutZRSlopeMin = 0.;
1870 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1872 fLineCutZRSlopeMin = 0.;
1876 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1878 fLineCutZRSlopeMin = 0.;
1882 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1884 fLineCutZRSlopeMin = 0.;
1886 case 5: // 0.9 - 1.4
1888 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1890 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1894 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1896 fLineCutZRSlopeMin = 0.;
1898 case 7: // 0.1 - 0.8
1900 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1902 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1904 case 8: // 0.1 - 0.8
1906 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1908 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1912 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1914 fLineCutZRSlopeMin = 0.;
1917 AliError(Form(" EtaCut not defined %d",etaCut));
1922 ///________________________________________________________________________
1923 Bool_t AliConversionCuts::SetRCut(Int_t RCut){
1946 // High purity cuts for PbPb (remove first layers of material)
1969 AliError("RCut not defined");
1974 ///________________________________________________________________________
1975 Bool_t AliConversionCuts::SetSinglePtCut(Int_t singlePtCut)
1977 switch(singlePtCut){
1978 case 0: // 0.050 GeV
1979 fSinglePtCut = 0.050;
1981 case 1: // 0.100 GeV
1982 fSinglePtCut = 0.100;
1984 case 2: // 0.150 GeV
1985 fSinglePtCut = 0.150;
1987 case 3: // 0.200 GeV
1988 fSinglePtCut = 0.200;
1990 case 4: // 0.075 GeV
1991 fSinglePtCut = 0.075;
1993 case 5: // 0.125 GeV
1994 fSinglePtCut = 0.125;
1997 fSinglePtCut = 0.040;
2003 AliError(Form("singlePtCut not defined %d",singlePtCut));
2008 ///________________________________________________________________________
2009 Bool_t AliConversionCuts::SetTPCClusterCut(Int_t clsTPCCut)
2024 case 4: // 60% of findable clusters
2026 fUseCorrectedTPCClsInfo=0;
2028 case 5: // 0% of findable clusters
2030 fUseCorrectedTPCClsInfo=1;
2032 case 6: // 70% of findable clusters
2034 fUseCorrectedTPCClsInfo=1;
2036 case 7: // 0% of findable clusters
2037 fMinClsTPCToF= 0.35;
2038 fUseCorrectedTPCClsInfo=0;
2041 fMinClsTPCToF= 0.35;
2042 fUseCorrectedTPCClsInfo=1;
2046 fUseCorrectedTPCClsInfo=1;
2049 AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2054 ///________________________________________________________________________
2055 Bool_t AliConversionCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
2057 switch(ededxSigmaCut){
2059 fPIDnSigmaBelowElectronLine=-10;
2060 fPIDnSigmaAboveElectronLine=10;
2063 fPIDnSigmaBelowElectronLine=-5;
2064 fPIDnSigmaAboveElectronLine=5;
2067 fPIDnSigmaBelowElectronLine=-3;
2068 fPIDnSigmaAboveElectronLine=5;
2071 fPIDnSigmaBelowElectronLine=-4;
2072 fPIDnSigmaAboveElectronLine=5;
2075 fPIDnSigmaBelowElectronLine=-6;
2076 fPIDnSigmaAboveElectronLine=7;
2079 fPIDnSigmaBelowElectronLine=-4;
2080 fPIDnSigmaAboveElectronLine=4;
2083 fPIDnSigmaBelowElectronLine=-2.5;
2084 fPIDnSigmaAboveElectronLine=4;
2087 fPIDnSigmaBelowElectronLine=-2;
2088 fPIDnSigmaAboveElectronLine=3.5;
2091 AliError("TPCdEdxCutElectronLine not defined");
2097 ///________________________________________________________________________
2098 Bool_t AliConversionCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
2101 switch(pidedxSigmaCut){
2103 fPIDnSigmaAbovePionLine=-10;
2104 fPIDnSigmaAbovePionLineHighPt=-10;
2107 fPIDnSigmaAbovePionLine=0;
2108 fPIDnSigmaAbovePionLineHighPt=-10;
2111 fPIDnSigmaAbovePionLine=1;
2112 fPIDnSigmaAbovePionLineHighPt=-10;
2115 fPIDnSigmaAbovePionLine=2.5;
2116 fPIDnSigmaAbovePionLineHighPt=-10;
2119 fPIDnSigmaAbovePionLine=0.5;
2120 fPIDnSigmaAbovePionLineHighPt=-10;
2123 fPIDnSigmaAbovePionLine=2.;
2124 fPIDnSigmaAbovePionLineHighPt=-10;
2127 fPIDnSigmaAbovePionLine=2.;
2128 fPIDnSigmaAbovePionLineHighPt=0.5;
2131 fPIDnSigmaAbovePionLine=3.5;
2132 fPIDnSigmaAbovePionLineHighPt=-10;
2135 fPIDnSigmaAbovePionLine=2.;
2136 fPIDnSigmaAbovePionLineHighPt=1.;
2139 fPIDnSigmaAbovePionLine=3.0; // We need a bit less tight cut on dE/dx
2140 fPIDnSigmaAbovePionLineHighPt=-10;
2143 AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2148 ///________________________________________________________________________
2149 Bool_t AliConversionCuts::SetMinMomPiondEdxCut(Int_t piMomdedxSigmaCut)
2151 switch(piMomdedxSigmaCut){
2153 fPIDMinPnSigmaAbovePionLine=0.5;
2156 fPIDMinPnSigmaAbovePionLine=1.;
2159 fPIDMinPnSigmaAbovePionLine=1.5;
2162 fPIDMinPnSigmaAbovePionLine=20.;
2165 fPIDMinPnSigmaAbovePionLine=50.;
2168 fPIDMinPnSigmaAbovePionLine=0.3;
2171 fPIDMinPnSigmaAbovePionLine=0.25;
2174 fPIDMinPnSigmaAbovePionLine=0.4;
2177 fPIDMinPnSigmaAbovePionLine=0.2;
2180 AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2185 ///________________________________________________________________________
2186 Bool_t AliConversionCuts::SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
2188 switch(piMaxMomdedxSigmaCut){
2190 fPIDMaxPnSigmaAbovePionLine=100.;
2193 fPIDMaxPnSigmaAbovePionLine=5.;
2196 fPIDMaxPnSigmaAbovePionLine=4.;
2199 fPIDMaxPnSigmaAbovePionLine=3.5;
2202 fPIDMaxPnSigmaAbovePionLine=3.;
2205 fPIDMaxPnSigmaAbovePionLine=7.;
2208 AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2213 ///________________________________________________________________________
2214 Bool_t AliConversionCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
2216 switch(LowPRejectionSigmaCut){
2218 fPIDnSigmaAtLowPAroundKaonLine=0;
2219 fPIDnSigmaAtLowPAroundProtonLine=0;
2220 fPIDnSigmaAtLowPAroundPionLine=0;
2221 fDoKaonRejectionLowP = kFALSE;
2222 fDoProtonRejectionLowP = kFALSE;
2223 fDoPionRejectionLowP = kFALSE;
2224 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2227 fPIDnSigmaAtLowPAroundKaonLine=0.5;
2228 fPIDnSigmaAtLowPAroundProtonLine=0.5;
2229 fPIDnSigmaAtLowPAroundPionLine=0.5;
2230 fDoKaonRejectionLowP = kTRUE;
2231 fDoProtonRejectionLowP = kTRUE;
2232 fDoPionRejectionLowP = kTRUE;
2233 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2236 fPIDnSigmaAtLowPAroundKaonLine=1;
2237 fPIDnSigmaAtLowPAroundProtonLine=1;
2238 fPIDnSigmaAtLowPAroundPionLine=1;
2239 fDoKaonRejectionLowP = kTRUE;
2240 fDoProtonRejectionLowP = kTRUE;
2241 fDoPionRejectionLowP = kTRUE;
2242 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2245 fPIDnSigmaAtLowPAroundKaonLine=2.;
2246 fPIDnSigmaAtLowPAroundProtonLine=2.;
2247 fPIDnSigmaAtLowPAroundPionLine=2.;
2248 fDoKaonRejectionLowP = kTRUE;
2249 fDoProtonRejectionLowP = kTRUE;
2250 fDoPionRejectionLowP = kTRUE;
2251 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2254 fPIDnSigmaAtLowPAroundKaonLine=0.;
2255 fPIDnSigmaAtLowPAroundProtonLine=0.;
2256 fPIDnSigmaAtLowPAroundPionLine=1;
2257 fDoKaonRejectionLowP = kFALSE;
2258 fDoProtonRejectionLowP = kFALSE;
2259 fDoPionRejectionLowP = kTRUE;
2260 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2263 fPIDnSigmaAtLowPAroundKaonLine=0.;
2264 fPIDnSigmaAtLowPAroundProtonLine=0.;
2265 fPIDnSigmaAtLowPAroundPionLine=1.5;
2266 fDoKaonRejectionLowP = kFALSE;
2267 fDoProtonRejectionLowP = kFALSE;
2268 fDoPionRejectionLowP = kTRUE;
2269 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2272 fPIDnSigmaAtLowPAroundKaonLine=0.;
2273 fPIDnSigmaAtLowPAroundProtonLine=0.;
2274 fPIDnSigmaAtLowPAroundPionLine=2.;
2275 fDoKaonRejectionLowP = kFALSE;
2276 fDoProtonRejectionLowP = kFALSE;
2277 fDoPionRejectionLowP = kTRUE;
2278 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2281 fPIDnSigmaAtLowPAroundKaonLine=0.;
2282 fPIDnSigmaAtLowPAroundProtonLine=0.;
2283 fPIDnSigmaAtLowPAroundPionLine=0.5;
2284 fDoKaonRejectionLowP = kFALSE;
2285 fDoProtonRejectionLowP = kFALSE;
2286 fDoPionRejectionLowP = kTRUE;
2287 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2290 AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
2295 ///________________________________________________________________________
2296 Bool_t AliConversionCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
2298 switch(TOFelectronPID){
2300 fUseTOFpid = kFALSE;
2301 fTofPIDnSigmaBelowElectronLine=-100;
2302 fTofPIDnSigmaAboveElectronLine=100;
2306 fTofPIDnSigmaBelowElectronLine=-7;
2307 fTofPIDnSigmaAboveElectronLine=7;
2311 fTofPIDnSigmaBelowElectronLine=-5;
2312 fTofPIDnSigmaAboveElectronLine=5;
2316 fTofPIDnSigmaBelowElectronLine=-3;
2317 fTofPIDnSigmaAboveElectronLine=5;
2321 fTofPIDnSigmaBelowElectronLine=-2;
2322 fTofPIDnSigmaAboveElectronLine=3;
2326 fTofPIDnSigmaBelowElectronLine=-3;
2327 fTofPIDnSigmaAboveElectronLine=3;
2330 AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
2335 ///________________________________________________________________________
2336 Bool_t AliConversionCuts::SetQtMaxCut(Int_t QtMaxCut)
2341 fDoQtGammaSelection=kFALSE;
2342 fDoHighPtQtGammaSelection=kFALSE;
2344 fPtBorderForQt=100.;
2348 fDoHighPtQtGammaSelection=kFALSE;
2350 fPtBorderForQt=100.;
2354 fDoHighPtQtGammaSelection=kFALSE;
2356 fPtBorderForQt=100.;
2360 fDoHighPtQtGammaSelection=kFALSE;
2362 fPtBorderForQt=100.;
2366 fDoHighPtQtGammaSelection=kFALSE;
2368 fPtBorderForQt=100.;
2372 fDoHighPtQtGammaSelection=kFALSE;
2374 fPtBorderForQt=100.;
2378 fDoHighPtQtGammaSelection=kTRUE;
2384 fDoHighPtQtGammaSelection=kFALSE;
2386 fPtBorderForQt=100.;
2389 AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
2394 ///________________________________________________________________________
2395 Bool_t AliConversionCuts::SetChi2GammaCut(Int_t chi2GammaCut)
2398 switch(chi2GammaCut){
2400 fChi2CutConversion = 100.;
2403 fChi2CutConversion = 50.;
2406 fChi2CutConversion = 30.;
2409 fChi2CutConversion = 200.;
2412 fChi2CutConversion = 500.;
2415 fChi2CutConversion = 100000.;
2418 fChi2CutConversion = 5.;
2421 fChi2CutConversion = 10.;
2424 fChi2CutConversion = 20.;
2427 fChi2CutConversion = 15.;
2430 AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
2435 ///________________________________________________________________________
2436 Bool_t AliConversionCuts::SetPsiPairCut(Int_t psiCut) {
2440 fPsiPairCut = 10000; //
2443 fPsiPairCut = 0.1; //
2446 fPsiPairCut = 0.05; // Standard
2449 fPsiPairCut = 0.035; //
2452 fPsiPairCut = 0.15; //
2455 fPsiPairCut = 0.2; //
2458 fPsiPairCut = 0.03; //
2461 fPsiPairCut = 0.025; //
2464 fPsiPairCut = 0.01; //
2467 fPsiPairCut = 0.5; //
2470 AliError(Form("PsiPairCut not defined %d",psiCut));
2476 ///________________________________________________________________________
2477 Bool_t AliConversionCuts::SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut){
2479 switch(doPhotonAsymmetryCut){
2481 fDoPhotonAsymmetryCut=0;
2482 fMinPPhotonAsymmetryCut=100.;
2483 fMinPhotonAsymmetry=0.;
2486 fDoPhotonAsymmetryCut=1;
2487 fMinPPhotonAsymmetryCut=3.5;
2488 fMinPhotonAsymmetry=0.04;
2491 fDoPhotonAsymmetryCut=1;
2492 fMinPPhotonAsymmetryCut=3.5;
2493 fMinPhotonAsymmetry=0.06;
2496 AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
2499 fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
2502 ///________________________________________________________________________
2503 Bool_t AliConversionCuts::SetCosPAngleCut(Int_t cosCut) {
2507 fCosPAngleCut = TMath::Pi(); // -1
2510 fCosPAngleCut = 0.1; // 0.99500
2513 fCosPAngleCut = 0.05; // 0.99875
2516 fCosPAngleCut = 0.025; // 0.99969
2519 fCosPAngleCut = 0.01; // 0.99995
2522 fCosPAngleCut = 0.2; // 0.98007
2525 fCosPAngleCut = 0.5; // 0.87758
2528 fCosPAngleCut = 0.075; // 0.73169
2531 AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
2537 ///________________________________________________________________________
2538 Bool_t AliConversionCuts::SetSharedElectronCut(Int_t sharedElec) {
2542 fDoSharedElecCut = kFALSE;
2545 fDoSharedElecCut = kTRUE;
2548 AliError(Form("Shared Electron Cut not defined %d",sharedElec));
2554 ///________________________________________________________________________
2555 Bool_t AliConversionCuts::SetToCloseV0sCut(Int_t toClose) {
2559 fDoToCloseV0sCut = kFALSE;
2563 fDoToCloseV0sCut = kTRUE;
2567 fDoToCloseV0sCut = kTRUE;
2571 fDoToCloseV0sCut = kTRUE;
2575 AliError(Form("Shared Electron Cut not defined %d",toClose));
2580 ///________________________________________________________________________
2581 Bool_t AliConversionCuts::SetTRDElectronCut(Int_t TRDElectronCut)
2583 switch(TRDElectronCut){
2589 fPIDTRDEfficiency=0.1;
2593 fPIDTRDEfficiency=0.8;
2597 fPIDTRDEfficiency=0.9;
2600 AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
2606 //-------------------------------------------------------------
2607 Double_t AliConversionCuts::GetCentrality(AliVEvent *event)
2608 { // Get Event Centrality
2610 AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
2612 AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
2614 if(fDetectorCentrality==0){
2615 if (fIsHeavyIon==2){
2616 return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
2619 return fESDCentrality->GetCentralityPercentile("V0M"); // default
2622 if(fDetectorCentrality==1){
2623 return fESDCentrality->GetCentralityPercentile("CL1");
2627 AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
2629 if(aodEvent->GetHeader()){return aodEvent->GetHeader()->GetCentrality();}
2634 //-------------------------------------------------------------
2635 Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEvent)
2636 { // Centrality Selection
2637 if(!fIsHeavyIon)return kTRUE;
2639 if(fCentralityMin == 0 && fCentralityMax == 0) return kTRUE;//0-100%
2640 if(fCentralityMin >= fCentralityMax) return kTRUE;//0-100%
2642 Double_t centrality=GetCentrality(event);
2643 if(centrality<0)return kFALSE;
2645 Int_t centralityC=0;
2646 if (fModCentralityClass == 0){
2647 centralityC= Int_t(centrality/10);
2648 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2652 else if (fModCentralityClass ==1){
2653 centralityC= Int_t(centrality);
2654 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2656 } else return kFALSE;
2658 else if (fModCentralityClass ==2){
2659 centralityC= Int_t(centrality);
2660 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2665 // Use strict V0 amplitude cut for MC centrality
2666 Float_t nv0amplitude = event->GetVZEROData()->GetMTotV0A()+event->GetVZEROData()->GetMTotV0C();
2667 Float_t V0Amplitude10[10] = {9999999.0,13670,9345,6209,3944,2352,1272,611,255, 83};
2668 // 0 10 20 30 40 50 60 70 80 90%
2669 Float_t V0Amplitude5a[10] = {9999999.0,16612,13670,11290,9345,7650,6209,4984,3944,3074};
2670 // 0 5 10 15 20 25 30 35 40 45%
2671 Float_t V0Amplitude5b[10] = {3074,2352,1725,1272,899,611,402,255,152,83};
2672 // 45 50 55 60 65 70 75 80 85 90%
2674 if (fModCentralityClass == 3){
2676 if(nv0amplitude > V0Amplitude10[fCentralityMax] && nv0amplitude <= V0Amplitude10[fCentralityMin])
2681 centralityC= Int_t(centrality/10);
2682 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2687 else if (fModCentralityClass ==4){
2689 if(nv0amplitude > V0Amplitude5a[fCentralityMax] && nv0amplitude <= V0Amplitude5a[fCentralityMin])
2694 centralityC= Int_t(centrality);
2695 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2697 } else return kFALSE;
2700 else if (fModCentralityClass ==5){
2702 if(nv0amplitude > V0Amplitude5b[fCentralityMax] && nv0amplitude <= V0Amplitude5b[fCentralityMin])
2707 centralityC= Int_t(centrality);
2708 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2716 ///________________________________________________________________________
2717 Bool_t AliConversionCuts::VertexZCut(AliVEvent *event){
2718 // Cut on z position of primary vertex
2719 Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2721 if(abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2723 if (fIsHeavyIon == 2){
2724 if(fUtils->IsFirstEventInChunk(event)) return kFALSE;
2725 if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
2731 ///________________________________________________________________________
2733 Int_t AliConversionCuts::GetNumberOfContributorsVtx(AliVEvent *event){
2734 // returns number of contributors to the vertex
2736 AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2738 if (fESDEvent->GetPrimaryVertex() != NULL){
2739 if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2740 return fESDEvent->GetPrimaryVertex()->GetNContributors();
2744 if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2745 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2746 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2748 AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2754 AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2756 if (fAODEvent->GetPrimaryVertex() != NULL){
2757 if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2758 return fAODEvent->GetPrimaryVertex()->GetNContributors();
2761 if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2762 if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2763 return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2765 AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
2774 ///________________________________________________________________________
2776 Bool_t AliConversionCuts::IsTriggerSelected()
2779 AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
2781 UInt_t isSelected = AliVEvent::kAny;
2782 if (fInputHandler==NULL) return kFALSE;
2783 if( fInputHandler->GetEventSelection()) {
2784 // Get the actual offline trigger mask for the event and AND it with the
2785 // requested mask. If no mask requested select by default the event.
2786 if (fOfflineTriggerMask)
2787 isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
2789 fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
2793 if (fIsSDDFired) hTriggerClass->Fill(32);
2794 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
2795 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
2796 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
2797 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
2798 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
2799 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
2800 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
2801 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
2802 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
2803 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
2804 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
2805 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
2806 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
2807 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
2808 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
2809 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
2810 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
2811 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
2812 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
2813 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
2814 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
2815 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
2816 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
2817 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
2818 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
2819 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
2820 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
2821 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
2822 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
2823 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
2824 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
2825 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
2826 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
2827 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
2828 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
2829 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
2830 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(28);
2831 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(29);
2832 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(30);
2833 if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(33);
2836 if(hTriggerClassSelected && isSelected){
2837 if (!fIsSDDFired) hTriggerClassSelected->Fill(32);
2838 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
2839 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
2840 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
2841 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
2842 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
2843 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
2844 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
2845 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
2846 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
2847 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
2848 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
2849 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
2850 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
2851 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
2852 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
2853 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
2854 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
2855 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
2856 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
2857 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
2858 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
2859 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
2860 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
2861 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
2862 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
2863 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
2864 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
2865 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
2866 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
2867 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
2868 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
2869 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
2870 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
2871 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
2872 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
2873 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
2874 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(28);
2875 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(29);
2876 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(30);
2879 if(!isSelected)return kFALSE;
2885 ///________________________________________________________________________
2886 Int_t AliConversionCuts::GetFirstTPCRow(Double_t radius){
2887 // Get first TPC row
2888 Int_t firstTPCRow = 0;
2889 Double_t radiusI = 84.8;
2890 Double_t radiusO = 134.6;
2891 Double_t radiusOB = 198.;
2892 Double_t rSizeI = 0.75;
2893 Double_t rSizeO = 1.;
2894 Double_t rSizeOB = 1.5;
2898 if(radius <= radiusI){
2901 if(radius>radiusI && radius<=radiusO){
2902 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
2904 if(radius>radiusO && radius<=radiusOB){
2905 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
2908 if(radius>radiusOB){
2909 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
2915 Bool_t AliConversionCuts::CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const {
2916 ///Check if passes cosine of pointing angle cut
2917 if(GetCosineOfPointingAngle(photon, event) < (TMath::Cos(fCosPAngleCut))){
2923 Double_t AliConversionCuts::GetCosineOfPointingAngle( const AliConversionPhotonBase * photon, AliVEvent * event) const{
2924 // calculates the pointing angle of the recalculated V0
2926 Double_t momV0[3] = {0,0,0};
2927 if(event->IsA()==AliESDEvent::Class()){
2928 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
2929 if(!esdEvent) return -999;
2930 AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
2931 if(!v0) return -999;
2932 v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
2934 if(event->IsA()==AliAODEvent::Class()){
2935 momV0[0] = photon->GetPx();
2936 momV0[1] = photon->GetPy();
2937 momV0[2] = photon->GetPz();
2940 //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
2941 Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
2942 photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
2943 photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
2945 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
2946 Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
2949 Double_t cosinePointingAngle = -999;
2950 if(momV02*PosV02 > 0.0)
2951 cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
2953 return cosinePointingAngle;
2956 ///________________________________________________________________________
2957 Bool_t AliConversionCuts::PsiPairCut(const AliConversionPhotonBase * photon) const {
2959 if(photon->GetPsiPair() > fPsiPairCut){
2965 ///________________________________________________________________________
2966 TString AliConversionCuts::GetCutNumber(){
2967 // returns TString with current cut number
2969 for(Int_t ii=0;ii<kNCuts;ii++){
2970 a.Append(Form("%d",fCuts[ii]));
2975 ///________________________________________________________________________
2976 void AliConversionCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
2978 Int_t posLabel = photon->GetTrackLabelPositive();
2979 Int_t negLabel = photon->GetTrackLabelNegative();
2981 fElectronLabelArray[nV0*2] = posLabel;
2982 fElectronLabelArray[(nV0*2)+1] = negLabel;
2984 ///________________________________________________________________________
2985 Bool_t AliConversionCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
2987 Int_t posLabel = photon->GetTrackLabelPositive();
2988 Int_t negLabel = photon->GetTrackLabelNegative();
2990 for(Int_t i = 0; i<nV0s*2;i++){
2991 if(i==nV0*2) continue;
2992 if(i==(nV0*2)+1) continue;
2993 if(fElectronLabelArray[i] == posLabel){
2995 if(fElectronLabelArray[i] == negLabel){
3001 ///________________________________________________________________________
3002 Bool_t AliConversionCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
3005 Double_t posX = photon->GetConversionX();
3006 Double_t posY = photon->GetConversionY();
3007 Double_t posZ = photon->GetConversionZ();
3009 for(Int_t i = 0;i<photons->GetEntries();i++){
3010 if(nV0 == i) continue;
3011 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
3012 Double_t posCompX = photonComp->GetConversionX();
3013 Double_t posCompY = photonComp->GetConversionY();
3014 Double_t posCompZ = photonComp->GetConversionZ();
3016 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
3018 if(dist < fminV0Dist*fminV0Dist){
3019 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
3027 ///________________________________________________________________________
3028 void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliMCEvent *MCEvent){
3030 if(fNotRejectedStart){
3031 delete[] fNotRejectedStart;
3032 fNotRejectedStart = NULL;
3034 if(fNotRejectedEnd){
3035 delete[] fNotRejectedEnd;
3036 fNotRejectedEnd = NULL;
3038 if(fGeneratorNames){
3039 delete[] fGeneratorNames;
3040 fGeneratorNames = NULL;
3043 if(rejection == 0) return; // No Rejection
3044 AliGenCocktailEventHeader *cHeader = dynamic_cast<AliGenCocktailEventHeader*>(MCEvent->GenEventHeader());
3046 TList *genHeaders = cHeader->GetHeaders();
3047 AliGenEventHeader* gh = 0;
3049 if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
3050 if(rejection == 2){ // TList of Headers Names
3051 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3052 gh = (AliGenEventHeader*)genHeaders->At(i);
3053 TString GeneratorName = gh->GetName();
3054 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3055 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3056 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3064 fNotRejectedStart = new Int_t[fnHeaders];
3065 fNotRejectedEnd = new Int_t[fnHeaders];
3066 fGeneratorNames = new TString[fnHeaders];
3068 if(rejection == 1 || rejection == 3){
3069 fNotRejectedStart[0] = 0;
3070 fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
3071 fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
3075 Int_t firstindex = 0;
3076 Int_t lastindex = -1;
3078 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3079 gh = (AliGenEventHeader*)genHeaders->At(i);
3080 TString GeneratorName = gh->GetName();
3081 lastindex = lastindex + gh->NProduced();
3082 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3083 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3084 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3085 fNotRejectedStart[nummer] = firstindex;
3086 fNotRejectedEnd[nummer] = lastindex;
3087 fGeneratorNames[nummer] = GeneratorName;
3088 // cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3093 firstindex = firstindex + gh->NProduced();
3095 } else { // No Cocktail Header Found
3096 fNotRejectedStart = new Int_t[1];
3097 fNotRejectedEnd = new Int_t[1];
3100 fNotRejectedStart[0] = 0;
3101 fNotRejectedEnd[0] = MCEvent->Stack()->GetNprimary()-1;
3102 // if(rejection == 2){
3103 fGeneratorNames = new TString[1];
3104 fGeneratorNames[0] = "NoCocktailGeneratorFound";
3107 AliGenPythiaEventHeader *mcHeaderPythia = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent->GenEventHeader());
3108 if (mcHeaderPythia) fGeneratorNames[0] = "NoCocktailGeneratorFound_Pythia";
3109 AliGenDPMjetEventHeader *mcHeaderPhojet = dynamic_cast<AliGenDPMjetEventHeader*>(MCEvent->GenEventHeader());
3110 if (mcHeaderPhojet) fGeneratorNames[0] = "NoCocktailGeneratorFound_Phojet";
3111 AliGenHijingEventHeader *mcHeaderHijing = dynamic_cast<AliGenHijingEventHeader*>(MCEvent->GenEventHeader());
3112 if (mcHeaderHijing) fGeneratorNames[0] = "NoCocktailGeneratorFound_Hijing";
3114 SetRejectExtraSignalsCut(0);
3118 //_________________________________________________________________________
3119 Int_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack){
3121 // Not Accepted == kFALSE == 0
3122 // Accepted == kTRUE == 1
3123 // FirstHeader == kTRUE == 3
3125 if(index < 0) return 0; // No Particle
3128 if( index >= MCStack->GetNprimary()){ // Secondary Particle
3129 if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother??
3130 return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack);
3132 for(Int_t i = 0;i<fnHeaders;i++){
3133 if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3135 if(i == 0) accepted = 2; // MB Header
3141 //_________________________________________________________________________
3142 Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Bool_t isHeavyIon){
3144 if(isHeavyIon && !(IsCentralitySelected(InputEvent,MCEvent)))
3145 return 1; // Check Centrality --> Not Accepted => eventQuality = 1
3147 if(!isHeavyIon && GetIsFromPileup()){
3148 if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
3149 return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3153 Bool_t hasV0And = ReaderCuts->HasV0AND();
3154 Bool_t isSDDFired = ReaderCuts->IsSDDFired();
3155 if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent)
3156 return 7; // With SDD requested but no fired
3158 if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
3159 return 8; // V0AND requested but no fired
3165 Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliStack *MCStack){
3166 if (!(period.CompareTo("LHC12f1a") == 0 || period.CompareTo("LHC12f1b") == 0 || period.CompareTo("LHC12i3") == 0 )) return 1.;
3169 for (Int_t i = 0; i < fnHeaders; i++){
3170 if (index >= fNotRejectedStart[i] && index < fNotRejectedEnd[i]+1){
3171 // cout << fGeneratorNames[i].Data() << endl;
3172 if (fGeneratorNames[i].CompareTo("Pythia") == 0){
3174 } else if (fGeneratorNames[i].CompareTo("DPMJET") == 0){
3176 } else if (fGeneratorNames[i].CompareTo("HIJING") == 0){
3178 } else if (fGeneratorNames[i].CompareTo("BOX") == 0){
3180 } else if (fGeneratorNames[i].CompareTo("PARAM") == 0){
3182 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound") == 0){
3184 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Pythia") == 0){
3186 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Phojet") == 0){
3188 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Hijing") == 0){
3191 // cout << "resulting kCaseGen :" << kCaseGen << endl;
3195 Double_t mesonPt = ((TParticle*)MCStack->Particle(index))->Pt();
3197 Double_t mesonMass = ((TParticle*)MCStack->Particle(index))->GetCalcMass();
3198 Float_t functionResult = 1.;
3200 Float_t dNdyMC = 2.1462;
3201 Float_t nMC = 7.06055;
3202 Float_t tMC = 0.12533;
3203 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3207 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3212 functionResult = 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);
3213 } else if (kCaseGen == 2){
3214 Float_t dNdyMC = 2.35978;
3215 Float_t nMC = 6.81795;
3216 Float_t tMC = 0.11492;
3217 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3221 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3226 functionResult = 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);
3227 } else if (kCaseGen == 4){
3228 // functionResult = 1./sqrt(1.-mesonMass*mesonMass/((mesonMass*mesonMass+mesonPt*mesonPt)*cosh(mesonY)*cosh(mesonY)));
3229 Float_t a = 0.23437;
3231 Float_t c = -1430.5863;
3232 Float_t d = -0.6966624;
3233 Float_t e = 252.3742;
3234 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3240 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3247 functionResult = a*TMath::Power(mesonPt,-1.*(b+c/(TMath::Power(mesonPt,d)+e)))*1./mesonPt *1./1.6 *1./(2.* TMath::Pi());
3250 Float_t dNdyData = 2.2328;
3251 Float_t nData = 7.1473;
3252 Float_t tData = 0.1346;
3253 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3257 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3258 dNdyData = 0.38992; //be careful this fit is not optimal, eta in data still has problems
3262 Float_t tsallisData = 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);
3263 // cout << "tsallisData/functionResult: " << tsallisData/functionResult << endl;
3264 return tsallisData/functionResult;
3268 ///________________________________________________________________________
3269 AliConversionCuts* AliConversionCuts::GetStandardCuts2010PbPb(){
3270 //Create and return standard 2010 PbPb cuts
3271 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
3272 if(!cuts->InitializeCutsFromCutString("1000002042092970023220000")){
3273 cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
3277 ///________________________________________________________________________
3278 AliConversionCuts* AliConversionCuts::GetStandardCuts2010pp(){
3279 //Create and return standard 2010 PbPb cuts
3280 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010pp","StandardCuts2010pp");
3281 if(!cuts->InitializeCutsFromCutString("0000011002093663003800000")){
3282 cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}