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),
177 hTPCdEdxbefore(NULL),
179 hTPCdEdxSigbefore(NULL),
180 hTPCdEdxSigafter(NULL),
186 hInvMassbefore(NULL),
187 hArmenterosbefore(NULL),
189 hArmenterosafter(NULL),
190 hAcceptanceCuts(NULL),
196 hTriggerClassSelected(NULL)
199 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
200 fCutString=new TObjString((GetCutNumber()).Data());
202 fElectronLabelArray = new Int_t[fElectronArraySize];
206 //________________________________________________________________________
207 AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
208 AliAnalysisCuts(ref),
210 fHeaderList(ref.fHeaderList),
212 fEventQuality(ref.fEventQuality),
215 fEtaCut(ref.fEtaCut),
216 fEtaCutMin(ref.fEtaCutMin),
218 fSinglePtCut(ref.fSinglePtCut),
220 fMinClsTPC(ref.fMinClsTPC),
221 fMinClsTPCToF(ref.fMinClsTPCToF),
222 fLineCutZRSlope(ref.fLineCutZRSlope),
223 fLineCutZValue(ref.fLineCutZValue),
224 fLineCutZRSlopeMin(ref.fLineCutZRSlopeMin),
225 fLineCutZValueMin(ref.fLineCutZValueMin),
226 fChi2CutConversion(ref.fChi2CutConversion),
227 fPIDProbabilityCutNegativeParticle(ref.fPIDProbabilityCutNegativeParticle),
228 fPIDProbabilityCutPositiveParticle(ref.fPIDProbabilityCutPositiveParticle),
229 fDodEdxSigmaCut(ref. fDodEdxSigmaCut),
230 fDoTOFsigmaCut(ref.fDoTOFsigmaCut),
231 fPIDTRDEfficiency(ref.fPIDTRDEfficiency),
232 fDoTRDPID(ref.fDoTRDPID),
233 fPIDnSigmaAboveElectronLine(ref.fPIDnSigmaAboveElectronLine),
234 fPIDnSigmaBelowElectronLine(ref.fPIDnSigmaBelowElectronLine),
235 fTofPIDnSigmaAboveElectronLine(ref.fTofPIDnSigmaAboveElectronLine),
236 fTofPIDnSigmaBelowElectronLine(ref.fTofPIDnSigmaBelowElectronLine),
237 fPIDnSigmaAbovePionLine(ref.fPIDnSigmaAbovePionLine),
238 fPIDnSigmaAbovePionLineHighPt(ref.fPIDnSigmaAbovePionLineHighPt),
239 fPIDMinPnSigmaAbovePionLine(ref.fPIDMinPnSigmaAbovePionLine),
240 fPIDMaxPnSigmaAbovePionLine(ref.fPIDMaxPnSigmaAbovePionLine),
241 fDoKaonRejectionLowP(ref.fDoKaonRejectionLowP),
242 fDoProtonRejectionLowP(ref.fDoProtonRejectionLowP),
243 fDoPionRejectionLowP(ref.fDoPionRejectionLowP),
244 fPIDnSigmaAtLowPAroundKaonLine(ref.fPIDnSigmaAtLowPAroundKaonLine),
245 fPIDnSigmaAtLowPAroundProtonLine(ref.fPIDnSigmaAtLowPAroundProtonLine),
246 fPIDnSigmaAtLowPAroundPionLine(ref.fPIDnSigmaAtLowPAroundPionLine),
247 fPIDMinPKaonRejectionLowP(ref.fPIDMinPKaonRejectionLowP),
248 fPIDMinPProtonRejectionLowP(ref.fPIDMinPProtonRejectionLowP),
249 fPIDMinPPionRejectionLowP(ref.fPIDMinPPionRejectionLowP),
250 fDoQtGammaSelection(ref.fDoQtGammaSelection),
251 fDoHighPtQtGammaSelection(ref.fDoHighPtQtGammaSelection),
253 fHighPtQtMax(ref.fHighPtQtMax),
254 fPtBorderForQt(ref.fPtBorderForQt),
255 fXVertexCut(ref.fXVertexCut),
256 fYVertexCut(ref.fYVertexCut),
257 fZVertexCut(ref.fZVertexCut),
258 fNSigmaMass(ref.fNSigmaMass),
259 fUseEtaMinCut(ref.fUseEtaMinCut),
260 fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
261 fDoPhotonAsymmetryCut(fDoPhotonAsymmetryCut),
262 fMinPPhotonAsymmetryCut(ref.fMinPPhotonAsymmetryCut),
263 fMinPhotonAsymmetry(ref.fMinPhotonAsymmetry),
264 fIsHeavyIon(ref.fIsHeavyIon),
265 fDetectorCentrality(ref.fDetectorCentrality),
266 fModCentralityClass(ref.fModCentralityClass),
267 fMaxVertexZ(ref.fMaxVertexZ),
268 fCentralityMin(ref.fCentralityMin),
269 fCentralityMax(ref.fCentralityMax),
270 fUseCorrectedTPCClsInfo(ref.fUseCorrectedTPCClsInfo),
271 fUseTOFpid(ref.fUseTOFpid),
272 fMultiplicityMethod(ref.fMultiplicityMethod),
273 fSpecialTrigger(ref.fSpecialTrigger),
274 fRemovePileUp(ref.fRemovePileUp),
275 fOpeningAngle(ref.fOpeningAngle),
276 fPsiPairCut(ref.fPsiPairCut),
277 fCosPAngleCut(ref.fCosPAngleCut),
278 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
279 fRejectExtraSignals(ref.fRejectExtraSignals),
280 fminV0Dist(ref.fminV0Dist),
281 fDoSharedElecCut(ref.fDoSharedElecCut),
282 fOfflineTriggerMask(ref.fOfflineTriggerMask),
283 fHasV0AND(ref.fHasV0AND),
284 fIsSDDFired(ref.fIsSDDFired),
285 fRandom(ref.fRandom),
286 fElectronArraySize(ref.fElectronArraySize),
287 fElectronLabelArray(NULL),
288 fConversionPointXArray(ref.fConversionPointXArray),
289 fConversionPointYArray(ref.fConversionPointYArray),
290 fConversionPointZArray(ref.fConversionPointZArray),
291 fnHeaders(ref.fnHeaders),
292 fNotRejectedStart(NULL),
293 fNotRejectedEnd(NULL),
294 fGeneratorNames(ref.fGeneratorNames),
297 hTPCdEdxbefore(NULL),
299 hTPCdEdxSigbefore(NULL),
300 hTPCdEdxSigafter(NULL),
306 hInvMassbefore(NULL),
307 hArmenterosbefore(NULL),
309 hArmenterosafter(NULL),
310 hAcceptanceCuts(NULL),
316 hTriggerClassSelected(NULL)
319 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
320 fCutString=new TObjString((GetCutNumber()).Data());
321 fElectronLabelArray = new Int_t[fElectronArraySize];
322 // dont copy histograms (if you like histograms, call InitCutHistograms())
326 //________________________________________________________________________
327 AliConversionCuts::~AliConversionCuts() {
329 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
331 // delete fHistograms;
332 // fHistograms = NULL;
333 if(fCutString != NULL){
337 if(fElectronLabelArray){
338 delete fElectronLabelArray;
339 fElectronLabelArray = NULL;
341 if(fNotRejectedStart){
342 delete[] fNotRejectedStart;
343 fNotRejectedStart = NULL;
346 delete[] fNotRejectedEnd;
347 fNotRejectedEnd = NULL;
350 delete[] fGeneratorNames;
351 fGeneratorNames = NULL;
355 //________________________________________________________________________
356 void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
358 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
360 if(fHistograms != NULL){
364 if(fHistograms==NULL){
365 fHistograms=new TList();
366 if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
367 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
371 hCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",10,-0.5,9.5);
372 hCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
373 hCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
374 hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
375 hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
376 hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
377 hCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
378 hCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
379 hCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
380 fHistograms->Add(hCutIndex);
383 hTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
384 hTrackCuts->GetXaxis()->SetBinLabel(1,"in");
385 hTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
386 hTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
387 hTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
388 hTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
389 hTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
390 hTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
391 hTrackCuts->GetXaxis()->SetBinLabel(8,"out");
392 fHistograms->Add(hTrackCuts);
395 hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",12,-0.5,11.5);
396 hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
397 hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
398 hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
399 hPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
400 hPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
401 hPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
402 hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
403 hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
404 hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
405 hPhotonCuts->GetXaxis()->SetBinLabel(10,"out");
406 fHistograms->Add(hPhotonCuts);
409 hInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
410 fHistograms->Add(hInvMassbefore);
411 hArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
412 fHistograms->Add(hArmenterosbefore);
414 hInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
415 fHistograms->Add(hInvMassafter);
416 hArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
417 fHistograms->Add(hArmenterosafter);
419 hAcceptanceCuts=new TH1F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts",10,-0.5,9.5);
420 hAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
421 hAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
422 hAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
423 hAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
424 hAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
425 hAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
426 hAcceptanceCuts->GetXaxis()->SetBinLabel(7,"minpt");
427 hAcceptanceCuts->GetXaxis()->SetBinLabel(8,"out");
428 fHistograms->Add(hAcceptanceCuts);
431 hdEdxCuts=new TH1F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts",10,-0.5,9.5);
432 hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
433 hdEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
434 hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
435 hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
436 hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
437 hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
438 hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
439 hdEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
440 hdEdxCuts->GetXaxis()->SetBinLabel(9,"TRDelectron");
441 hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
442 fHistograms->Add(hdEdxCuts);
444 TAxis *AxisBeforedEdx = NULL;
445 TAxis *AxisBeforedEdxSig = NULL;
446 TAxis *AxisBeforeTOF = NULL;
447 TAxis *AxisBeforeTOFSig = NULL;
449 hTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
450 fHistograms->Add(hTPCdEdxbefore);
451 AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
452 hTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
453 fHistograms->Add(hTPCdEdxSigbefore);
454 AxisBeforedEdxSig = hTPCdEdxSigbefore->GetXaxis();
456 hTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
457 fHistograms->Add(hTOFbefore);
458 AxisBeforeTOF = hTOFbefore->GetXaxis();
459 hTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
460 fHistograms->Add(hTOFSigbefore);
461 AxisBeforeTOFSig = hTOFSigbefore->GetXaxis();
464 hTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
465 fHistograms->Add(hTPCdEdxSigafter);
467 hTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
468 fHistograms->Add(hTPCdEdxafter);
470 hTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
471 fHistograms->Add(hTOFSigafter);
473 TAxis *AxisAfter = hTPCdEdxSigafter->GetXaxis();
474 Int_t bins = AxisAfter->GetNbins();
475 Double_t from = AxisAfter->GetXmin();
476 Double_t to = AxisAfter->GetXmax();
477 Double_t *newBins = new Double_t[bins+1];
479 Double_t factor = TMath::Power(to/from, 1./bins);
480 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
481 AxisAfter->Set(bins, newBins);
482 AxisAfter = hTOFSigafter->GetXaxis();
483 AxisAfter->Set(bins, newBins);
484 AxisAfter = hTPCdEdxafter->GetXaxis();
485 AxisAfter->Set(bins, newBins);
487 AxisBeforedEdx->Set(bins, newBins);
488 AxisBeforeTOF->Set(bins, newBins);
489 AxisBeforedEdxSig->Set(bins, newBins);
490 AxisBeforeTOFSig->Set(bins, newBins);
494 // Event Cuts and Info
496 hV0EventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",7,-0.5,6.5);
497 hV0EventCuts->GetXaxis()->SetBinLabel(1,"in");
498 hV0EventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
499 hV0EventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
500 hV0EventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
501 hV0EventCuts->GetXaxis()->SetBinLabel(5,"pileup");
502 hV0EventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
503 hV0EventCuts->GetXaxis()->SetBinLabel(7,"out");
504 fHistograms->Add(hV0EventCuts);
506 hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",100,0,100);
507 fHistograms->Add(hCentrality);
508 hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
509 fHistograms->Add(hVertexZ);
511 hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",34,-0.5,33.5);
512 hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
513 hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
514 hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
515 hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
516 hTriggerClass->GetXaxis()->SetBinLabel( 5,"kKEMC1");
517 hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
518 hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
519 hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
520 hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
521 hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
522 hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
523 hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
524 hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
525 hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
526 hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
527 hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
528 hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
529 hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
530 hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
531 hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
532 hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
533 hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
534 hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
535 hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
536 hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
537 hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
538 hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
539 hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
540 hTriggerClass->GetXaxis()->SetBinLabel(29,"kFastOnly");
541 hTriggerClass->GetXaxis()->SetBinLabel(30,"kAnyINT");
542 hTriggerClass->GetXaxis()->SetBinLabel(31,"kAny");
543 hTriggerClass->GetXaxis()->SetBinLabel(32,"V0AND");
544 hTriggerClass->GetXaxis()->SetBinLabel(33,"NOT kFastOnly");
545 hTriggerClass->GetXaxis()->SetBinLabel(34,"failed Physics Selection");
546 fHistograms->Add(hTriggerClass);
548 hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",33,-0.5,32.5);
549 hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB");
550 hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7");
551 hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON");
552 hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult");
553 hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kKEMC1");
554 hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5");
555 hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
556 hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
557 hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
558 hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
559 hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
560 hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7");
561 hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1");
562 hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
563 hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE");
564 hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA");
565 hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral");
566 hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral");
567 hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5");
568 hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED");
569 hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
570 hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8");
571 hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
572 hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
573 hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
574 hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
575 hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
576 hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined");
577 hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kFastOnly");
578 hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kAnyINT");
579 hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAny");
580 hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"V0AND");
581 hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"NOT kFastOnly");
582 fHistograms->Add(hTriggerClassSelected);
586 //________________________________________________________________________
587 Bool_t AliConversionCuts::InitPIDResponse(){
588 // Set Pointer to AliPIDResponse
590 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
592 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
593 fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
594 if(fPIDResponse)return kTRUE;
601 ///________________________________________________________________________
602 Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent){
603 // Process Event Selection
606 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
609 // Check for MC event
611 // Check if MC event is correctly loaded
612 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
617 if (!mcHandler->InitOk() ){
621 if (!mcHandler->TreeK() ){
625 if (!mcHandler->TreeTR() ) {
632 if(!IsTriggerSelected()){
633 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
639 if(fInputEvent->IsA()==AliESDEvent::Class()){
640 AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
641 fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
642 if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(31);
645 // Number of Contributors Cut
646 if(GetNumberOfContributorsVtx(fInputEvent)<=0) {
647 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
653 // Z Vertex Position Cut
654 if(!VertexZCut(fInputEvent)){
655 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
664 if(fInputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
665 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
672 // Centrality Selection
673 if(!IsCentralitySelected(fInputEvent,fMCEvent)){
674 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
680 // Fill Event Histograms
681 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
682 if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
683 if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent));
689 ///________________________________________________________________________
690 Bool_t AliConversionCuts::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
691 // MonteCarlo Photon Selection
693 if(!fMCStack)return kFALSE;
695 if (particle->GetPdgCode() == 22){
697 if(particle->R() > fMaxR) return kFALSE;
698 if(abs(particle->Eta())> fEtaCut || abs(particle->Eta())< fEtaCutMin) return kFALSE;
700 if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
701 return kFALSE; // no photon as mothers!
704 if(particle->GetMother(0) >= fMCStack->GetNprimary()){
705 return kFALSE; // the gamma has a mother, and it is not a primary particle
708 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
710 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
711 TParticle* ePos = NULL;
712 TParticle* eNeg = NULL;
714 if(particle->GetNDaughters() >= 2){
715 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
716 TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
717 if(tmpDaughter->GetUniqueID() == 5){
718 if(tmpDaughter->GetPdgCode() == 11){
720 } else if(tmpDaughter->GetPdgCode() == -11){
727 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
731 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
732 return kFALSE; // no reconstruction below the Pt cut
735 if( abs(ePos->Eta())> fEtaCut || abs(ePos->Eta())< fEtaCutMin ||
736 abs(eNeg->Eta())> fEtaCut || abs(eNeg->Eta())< fEtaCutMin ) {
741 return kFALSE; // cuts on distance from collision point
744 if(abs(ePos->Vz()) > fMaxZ){
745 return kFALSE; // outside material
747 if(abs(eNeg->Vz()) > fMaxZ){
748 return kFALSE; // outside material
751 if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
752 return kFALSE; // line cut to exclude regions where we do not reconstruct
753 } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
757 if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
758 return kFALSE; // line cut to exclude regions where we do not reconstruct
759 } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
764 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
770 ///________________________________________________________________________
771 Bool_t AliConversionCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event)
772 { // Specific Photon Cuts
775 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex);
778 // Fill Histos before Cuts
779 if(hInvMassbefore)hInvMassbefore->Fill(photon->GetMass());
781 if(hArmenterosbefore)hArmenterosbefore->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
783 // Gamma selection based on QT from Armenteros
784 if(fDoQtGammaSelection == kTRUE){
785 if(!ArmenterosQtCut(photon)){
786 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //1
793 if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
795 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //2
801 // Reconstruction Acceptance Cuts
802 if(!AcceptanceCuts(photon)){
803 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //3
809 if(fDoPhotonAsymmetryCut == kTRUE){
810 if(!AsymmetryCut(photon,event)){
811 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //4
816 //Check the pid probability
818 if(!PIDProbabilityCut(photon, event)) {
819 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //5
824 if(!CorrectedTPCClusterCut(photon, event)) {
825 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //6
831 if(!PsiPairCut(photon)) {
832 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //7
837 if(!CosinePAngleCut(photon, event)) {
838 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //8
843 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
846 if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
847 if(hArmenterosafter)hArmenterosafter->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
854 ///________________________________________________________________________
855 Bool_t AliConversionCuts::CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event)
856 { //Cut on corrected TPC Cluster Info
858 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
859 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
861 if(!negTrack||!posTrack)return kFALSE;
863 Double_t negclsToF=0;
865 if (!fUseCorrectedTPCClsInfo ){
866 if(negTrack->GetTPCNclsF()!=0){
867 negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
870 negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
873 Double_t posclsToF = 0.;
874 if (!fUseCorrectedTPCClsInfo ){
875 if(posTrack->GetTPCNclsF()!=0){
876 posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
879 posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
882 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
889 ///________________________________________________________________________
890 Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent * event)
892 //Selection of Reconstructed Photons
894 FillPhotonCutIndex(kPhotonIn);
897 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
898 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
900 if(!negTrack || !posTrack) {
901 FillPhotonCutIndex(kNoTracks);
906 if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
907 FillPhotonCutIndex(kdEdxCuts);
912 if(!TracksAreSelected(negTrack, posTrack)){
913 FillPhotonCutIndex(kTrackCuts);
918 if(!PhotonCuts(photon,event)){
919 FillPhotonCutIndex(kPhotonCuts);
923 // Photon passed cuts
924 FillPhotonCutIndex(kPhotonOut);
928 ///________________________________________________________________________
929 Bool_t AliConversionCuts::ArmenterosQtCut(AliConversionPhotonBase *photon)
930 { // Armenteros Qt Cut
932 if(fDoHighPtQtGammaSelection){
933 if(photon->GetPhotonPt() < fPtBorderForQt){
934 if(photon->GetArmenterosQt()>fQtMax){
938 if(photon->GetArmenterosQt()>fHighPtQtMax){
944 if(photon->GetArmenterosQt()>fQtMax){
952 ///________________________________________________________________________
953 Bool_t AliConversionCuts::AcceptanceCuts(AliConversionPhotonBase *photon) {
954 // Exclude certain areas for photon reconstruction
957 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
960 if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
961 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
966 if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
967 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
972 if(photon->GetConversionRadius() <= ((abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
973 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
976 else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
977 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
982 if(abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
983 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
989 if(abs(photon->GetPhotonEta())> fEtaCut || abs(photon->GetPhotonEta())< fEtaCutMin){
990 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
996 if(photon->GetPhotonPt()<fPtCut){
997 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1002 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1008 ///________________________________________________________________________
1009 Bool_t AliConversionCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
1010 // Track Cuts which require AOD/ESD specific implementation
1012 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1013 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1018 AliAODVertex * NegVtxType=negTrack->GetProdVertex();
1019 AliAODVertex * PosVtxType=posTrack->GetProdVertex();
1020 if((NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
1021 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1029 ///________________________________________________________________________
1030 Bool_t AliConversionCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
1031 // Track Cuts which require AOD/ESD specific implementation
1033 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1034 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1039 if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
1040 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1048 ///________________________________________________________________________
1049 Bool_t AliConversionCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1050 // Track Selection for Photon Reconstruction
1053 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1057 if(negTrack->Charge() == posTrack->Charge()) {
1058 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1063 // Number of TPC Clusters
1064 if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1065 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1072 if(abs(negTrack->Eta()) > fEtaCut || abs(negTrack->Eta()) < fEtaCutMin ||
1073 abs(posTrack->Eta())> fEtaCut || abs(posTrack->Eta())< fEtaCutMin) {
1074 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1080 if( negTrack->Pt()< fSinglePtCut || posTrack->Pt()< fSinglePtCut){
1081 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1086 // AOD ESD specific cuts
1087 Bool_t passCuts = kTRUE;
1089 if(negTrack->IsA()==AliAODTrack::Class()) {
1090 passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1092 passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1096 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1101 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1107 ///________________________________________________________________________
1108 Bool_t AliConversionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
1109 // Electron Identification Cuts for Photon reconstruction
1111 if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1112 if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1115 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1116 if(hTPCdEdxSigbefore)hTPCdEdxSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1117 if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1121 if(fDodEdxSigmaCut == kTRUE){
1122 // TPC Electron Line
1123 if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1124 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
1126 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1132 if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1133 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1134 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1135 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1137 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1144 if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1145 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1146 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine &&
1147 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1149 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1157 if(fDoKaonRejectionLowP == kTRUE){
1158 if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1159 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1161 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1168 if(fDoProtonRejectionLowP == kTRUE){
1169 if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1170 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1172 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1179 if(fDoPionRejectionLowP == kTRUE){
1180 if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1181 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1183 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1191 // cout<<"Start"<<endl;
1192 // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1194 // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1195 // {cout<<"TOF DA"<<endl;}
1196 // if(status == AliPIDResponse::kDetPidOk){
1197 // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1198 // cout<<"--> "<<probMis<<endl;
1199 // if(probMis > 0.01){
1204 if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1206 Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1208 fCurrentTrack->GetIntegratedTimes(times);
1209 Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1210 Double_t dT = TOFsignal - t0 - times[0];
1211 hTOFbefore->Fill(fCurrentTrack->P(),dT);
1213 if(hTOFSigbefore) hTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1215 if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1216 fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1217 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1221 if(hTOFSigafter)hTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1227 if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1228 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1234 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1235 if(hTPCdEdxSigafter)hTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1236 if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1240 ///________________________________________________________________________
1241 Bool_t AliConversionCuts::AsymmetryCut(AliConversionPhotonBase * photon,AliVEvent *event) {
1242 // Cut on Energy Assymetry
1244 for(Int_t ii=0;ii<2;ii++){
1246 AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1248 if( track->P() > fMinPPhotonAsymmetryCut ){
1249 Double_t trackNegAsy=0;
1250 if (photon->GetPhotonP()!=0.){
1251 trackNegAsy= track->P()/photon->GetPhotonP();
1254 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1263 ///________________________________________________________________________
1264 AliVTrack *AliConversionCuts::GetTrack(AliVEvent * event, Int_t label){
1265 //Returns pointer to the track with given ESD label
1266 //(Important for AOD implementation, since Track array in AOD data is different
1267 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1269 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1271 if(label > event->GetNumberOfTracks() ) return NULL;
1272 AliESDtrack * track = esdEvent->GetTrack(label);
1276 for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1277 AliVTrack * track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1280 if(track->GetID() == label) {
1287 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1291 ///________________________________________________________________________
1292 AliESDtrack *AliConversionCuts::GetESDTrack(AliESDEvent * event, Int_t label){
1293 //Returns pointer to the track with given ESD label
1294 //(Important for AOD implementation, since Track array in AOD data is different
1295 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1298 if(label > event->GetNumberOfTracks() ) return NULL;
1299 AliESDtrack * track = event->GetTrack(label);
1302 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1308 ///________________________________________________________________________
1309 Bool_t AliConversionCuts::PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event){
1310 // Cut on Electron Probability for Photon Reconstruction
1312 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1316 Bool_t iResult=kFALSE;
1318 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1319 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1321 AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1322 AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1324 if(negProbArray && posProbArray){
1326 negTrack->GetTPCpid(negProbArray);
1327 posTrack->GetTPCpid(posProbArray);
1329 if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1334 delete [] posProbArray;
1335 delete [] negProbArray;
1339 ///Not possible for AODs
1349 ///________________________________________________________________________
1350 Bool_t AliConversionCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1351 // MC Acceptance Cuts
1352 //(Certain areas were excluded for photon reconstruction)
1354 if(particle->R()>fMaxR){
1357 if(ePos->R()>fMaxR){
1361 if(ePos->R()<fMinR){
1365 if( ePos->R() <= ((abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1368 else if (fUseEtaMinCut && ePos->R() >= ((abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1372 if(abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1376 if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1380 if(abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1384 if(abs(particle->Eta())> fEtaCut || abs(particle->Eta())< fEtaCutMin){
1388 if(abs(ePos->Eta())> fEtaCut || abs(ePos->Eta())< fEtaCutMin){
1392 if(abs(eNeg->Eta())> fEtaCut || abs(eNeg->Eta())< fEtaCutMin){
1396 if( ePos->Pt()< fSinglePtCut || eNeg->Pt()< fSinglePtCut){
1400 if(particle->Pt()<fPtCut){
1406 ///________________________________________________________________________
1407 Bool_t AliConversionCuts::UpdateCutString() {
1408 ///Update the cut string (if it has been created yet)
1410 if(fCutString && fCutString->GetString().Length() == kNCuts) {
1411 fCutString->SetString(GetCutNumber());
1418 ///________________________________________________________________________
1419 Bool_t AliConversionCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
1420 // Initialize Cuts from a given Cut string
1422 AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1423 if(analysisCutSelection.Length()!=kNCuts) {
1424 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1427 if(!analysisCutSelection.IsDigit()){
1428 AliError("Cut selection contains characters");
1432 const char *cutSelection = analysisCutSelection.Data();
1433 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
1434 for(Int_t ii=0;ii<kNCuts;ii++){
1438 // Set Individual Cuts
1439 for(Int_t ii=0;ii<kNCuts;ii++){
1440 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1445 // Set StandardTriggers
1447 if(fIsHeavyIon)SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
1448 else SelectCollisionCandidates(AliVEvent::kMB);
1452 ///________________________________________________________________________
1453 Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
1454 ///Set individual cut ID
1459 if( SetV0Finder(value)) {
1460 fCuts[kv0FinderType] = value;
1463 } else return kFALSE;
1465 case kededxSigmaCut:
1466 if( SetTPCdEdxCutElectronLine(value)) {
1467 fCuts[kededxSigmaCut] = value;
1470 } else return kFALSE;
1472 case kpidedxSigmaCut:
1473 if( SetTPCdEdxCutPionLine(value)) {
1474 fCuts[kpidedxSigmaCut] = value;
1477 } else return kFALSE;
1479 case kpiMomdedxSigmaCut:
1480 if( SetMinMomPiondEdxCut(value)) {
1481 fCuts[kpiMomdedxSigmaCut] = value;
1484 } else return kFALSE;
1487 if( SetChi2GammaCut(value)) {
1488 fCuts[kchi2GammaCut] = value;
1491 } else return kFALSE;
1494 if( SetSinglePtCut(value)) {
1495 fCuts[ksinglePtCut] = value;
1498 } else return kFALSE;
1501 if( SetTPCClusterCut(value)) {
1502 fCuts[kclsTPCCut] = value;
1505 } else return kFALSE;
1508 if( SetEtaCut(value)) {
1509 fCuts[ketaCut] = value;
1512 } else return kFALSE;
1514 case kLowPRejectionSigmaCut:
1515 if( SetLowPRejectionCuts(value)) {
1516 fCuts[kLowPRejectionSigmaCut] = value;
1519 } else return kFALSE;
1522 if( SetQtMaxCut(value)) {
1523 fCuts[kQtMaxCut] = value;
1526 } else return kFALSE;
1528 case kpiMaxMomdedxSigmaCut:
1529 if( SetMaxMomPiondEdxCut(value)) {
1530 fCuts[kpiMaxMomdedxSigmaCut] = value;
1533 } else return kFALSE;
1536 if( SetRCut(value)) {
1537 fCuts[kRCut] = value;
1540 } else return kFALSE;
1543 if( SetRemovePileUp(value)) {
1544 fCuts[kremovePileUp] = value;
1547 } else return kFALSE;
1550 if( SetSelectSpecialTrigger(value)) {
1551 fCuts[kselectV0AND] = value;
1554 } else return kFALSE;
1556 case kmultiplicityMethod:
1557 if( SetMultiplicityMethod(value)) {
1558 fCuts[kmultiplicityMethod] = value;
1561 } else return kFALSE;
1564 if( SetIsHeavyIon(value)) {
1565 fCuts[kisHeavyIon] = value;
1568 } else return kFALSE;
1570 case kCentralityMin:
1571 if( SetCentralityMin(value)) {
1572 fCuts[kCentralityMin] = value;
1575 } else return kFALSE;
1577 case kCentralityMax:
1578 if( SetCentralityMax(value)) {
1579 fCuts[kCentralityMax] = value;
1582 } else return kFALSE;
1584 case kTOFelectronPID:
1585 if( SetTOFElectronPIDCut(value)) {
1586 fCuts[kTOFelectronPID] = value;
1589 } else return kFALSE;
1591 case kdoPhotonAsymmetryCut:
1592 if( SetPhotonAsymmetryCut(value)) {
1593 fCuts[kdoPhotonAsymmetryCut] = value;
1596 } else return kFALSE;
1599 if( SetPsiPairCut(value)) {
1600 fCuts[kPsiPair] = value;
1603 } else return kFALSE;
1606 if( SetCosPAngleCut(value)) {
1607 fCuts[kCosPAngle] = value;
1610 } else return kFALSE;
1614 if( SetSharedElectronCut(value)) {
1615 fCuts[kElecShare] = value;
1618 } else return kFALSE;
1621 if( SetToCloseV0sCut(value)) {
1622 fCuts[kToCloseV0s] = value;
1625 } else return kFALSE;
1628 if( SetRejectExtraSignalsCut(value)) {
1629 fCuts[kExtraSignals] = value;
1632 } else return kFALSE;
1635 AliError("Cut id out of range");
1639 AliError("Cut id %d not recognized");
1644 ///________________________________________________________________________
1645 void AliConversionCuts::PrintCuts() {
1646 // Print out current Cut Selection
1647 for(Int_t ic = 0; ic < kNCuts; ic++) {
1648 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
1651 ///________________________________________________________________________
1652 Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
1660 fDetectorCentrality=0;
1664 fDetectorCentrality=1;
1666 case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1668 fDetectorCentrality=0;
1669 fModCentralityClass=1;
1671 case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1673 fDetectorCentrality=0;
1674 fModCentralityClass=2;
1676 case 5: //strict cut on v0 tracks for MC
1678 fDetectorCentrality=0;
1679 fModCentralityClass=3;
1681 case 6: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1682 //strict cut on v0 tracks for MC
1684 fDetectorCentrality=0;
1685 fModCentralityClass=4;
1687 case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1688 //strict cut on v0 tracks for MC
1690 fDetectorCentrality=0;
1691 fModCentralityClass=5;
1694 AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1699 //___________________________________________________________________
1700 Bool_t AliConversionCuts::SetCentralityMin(Int_t minCentrality)
1703 if(minCentrality<0||minCentrality>9){
1704 AliError(Form("minCentrality not defined %d",minCentrality));
1708 fCentralityMin=minCentrality;
1711 //___________________________________________________________________
1712 Bool_t AliConversionCuts::SetCentralityMax(Int_t maxCentrality)
1715 if(maxCentrality<0||maxCentrality>9){
1716 AliError(Form("maxCentrality not defined %d",maxCentrality));
1719 fCentralityMax=maxCentrality;
1722 ///________________________________________________________________________
1723 Int_t AliConversionCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger)
1726 switch(selectSpecialTrigger){
1728 fSpecialTrigger=0; // dont care
1731 fSpecialTrigger=1; // V0AND
1734 fSpecialTrigger=2; // with SDD requested
1737 fSpecialTrigger=3; // V0AND plus with SDD requested
1741 AliError("Warning: Special Trigger Not known");
1746 ///________________________________________________________________________
1747 Bool_t AliConversionCuts::SetMultiplicityMethod(Int_t multiplicityMethod)
1750 fMultiplicityMethod=multiplicityMethod;
1752 // 0 Photon Multiplicity
1753 // 1 TPC Track multiplicity
1759 ///________________________________________________________________________
1760 Bool_t AliConversionCuts::SetRemovePileUp(Int_t removePileUp)
1762 switch(removePileUp){
1764 fRemovePileUp=kFALSE;
1767 fRemovePileUp=kTRUE;
1770 AliError("RemovePileUpCut not defined");
1775 ///________________________________________________________________________
1776 Bool_t AliConversionCuts::SetRejectExtraSignalsCut(Int_t extraSignal) {
1778 switch(extraSignal){
1780 fRejectExtraSignals = 0;
1781 break; // No Rejection
1783 fRejectExtraSignals = 1;
1784 break; // MinBias Header
1786 fRejectExtraSignals = 2;
1787 break; // User String Array
1789 fRejectExtraSignals = 3;
1790 break; // Rejection for Gamma Correction only
1792 AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
1797 ///________________________________________________________________________
1798 Bool_t AliConversionCuts::SetV0Finder(Int_t v0FinderType)
1800 switch (v0FinderType){
1801 case 0: // on fly V0 finder
1802 fUseOnFlyV0Finder=kTRUE;
1804 case 1: // offline V0 finder
1805 fUseOnFlyV0Finder=kFALSE;
1808 AliError(Form(" v0FinderType not defined %d",v0FinderType));
1813 ///________________________________________________________________________
1814 Bool_t AliConversionCuts::SetEtaCut(Int_t etaCut)
1817 //Set Standard LineCutZValues
1818 fLineCutZValueMin = -2;
1819 fLineCutZValue = 7.;
1824 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1826 fLineCutZRSlopeMin = 0.;
1830 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1832 fLineCutZRSlopeMin = 0.;
1836 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1838 fLineCutZRSlopeMin = 0.;
1842 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1844 fLineCutZRSlopeMin = 0.;
1848 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1850 fLineCutZRSlopeMin = 0.;
1852 case 5: // 0.9 - 1.4
1854 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1856 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1860 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1862 fLineCutZRSlopeMin = 0.;
1864 case 7: // 0.1 - 0.8
1866 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1868 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1870 case 8: // 0.1 - 0.8
1872 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1874 fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1878 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1880 fLineCutZRSlopeMin = 0.;
1883 AliError(Form(" EtaCut not defined %d",etaCut));
1888 ///________________________________________________________________________
1889 Bool_t AliConversionCuts::SetRCut(Int_t RCut){
1912 // High purity cuts for PbPb (remove first layers of material)
1935 AliError("RCut not defined");
1940 ///________________________________________________________________________
1941 Bool_t AliConversionCuts::SetSinglePtCut(Int_t singlePtCut)
1943 switch(singlePtCut){
1944 case 0: // 0.050 GeV
1945 fSinglePtCut = 0.050;
1947 case 1: // 0.100 GeV
1948 fSinglePtCut = 0.100;
1950 case 2: // 0.150 GeV
1951 fSinglePtCut = 0.150;
1953 case 3: // 0.200 GeV
1954 fSinglePtCut = 0.200;
1956 case 4: // 0.075 GeV
1957 fSinglePtCut = 0.075;
1959 case 5: // 0.125 GeV
1960 fSinglePtCut = 0.125;
1963 fSinglePtCut = 0.040;
1969 AliError(Form("singlePtCut not defined %d",singlePtCut));
1974 ///________________________________________________________________________
1975 Bool_t AliConversionCuts::SetTPCClusterCut(Int_t clsTPCCut)
1990 case 4: // 60% of findable clusters
1992 fUseCorrectedTPCClsInfo=0;
1994 case 5: // 0% of findable clusters
1996 fUseCorrectedTPCClsInfo=1;
1998 case 6: // 70% of findable clusters
2000 fUseCorrectedTPCClsInfo=1;
2002 case 7: // 0% of findable clusters
2003 fMinClsTPCToF= 0.35;
2004 fUseCorrectedTPCClsInfo=0;
2007 fMinClsTPCToF= 0.35;
2008 fUseCorrectedTPCClsInfo=1;
2012 fUseCorrectedTPCClsInfo=1;
2015 AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2020 ///________________________________________________________________________
2021 Bool_t AliConversionCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
2023 switch(ededxSigmaCut){
2025 fPIDnSigmaBelowElectronLine=-10;
2026 fPIDnSigmaAboveElectronLine=10;
2029 fPIDnSigmaBelowElectronLine=-5;
2030 fPIDnSigmaAboveElectronLine=5;
2033 fPIDnSigmaBelowElectronLine=-3;
2034 fPIDnSigmaAboveElectronLine=5;
2037 fPIDnSigmaBelowElectronLine=-4;
2038 fPIDnSigmaAboveElectronLine=5;
2041 fPIDnSigmaBelowElectronLine=-6;
2042 fPIDnSigmaAboveElectronLine=7;
2045 fPIDnSigmaBelowElectronLine=-4;
2046 fPIDnSigmaAboveElectronLine=4;
2049 fPIDnSigmaBelowElectronLine=-2.5;
2050 fPIDnSigmaAboveElectronLine=4;
2053 fPIDnSigmaBelowElectronLine=-2;
2054 fPIDnSigmaAboveElectronLine=3.5;
2057 AliError("TPCdEdxCutElectronLine not defined");
2063 ///________________________________________________________________________
2064 Bool_t AliConversionCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
2067 switch(pidedxSigmaCut){
2069 fPIDnSigmaAbovePionLine=-10;
2070 fPIDnSigmaAbovePionLineHighPt=-10;
2073 fPIDnSigmaAbovePionLine=0;
2074 fPIDnSigmaAbovePionLineHighPt=-10;
2077 fPIDnSigmaAbovePionLine=1;
2078 fPIDnSigmaAbovePionLineHighPt=-10;
2081 fPIDnSigmaAbovePionLine=2.5;
2082 fPIDnSigmaAbovePionLineHighPt=-10;
2085 fPIDnSigmaAbovePionLine=0.5;
2086 fPIDnSigmaAbovePionLineHighPt=-10;
2089 fPIDnSigmaAbovePionLine=2.;
2090 fPIDnSigmaAbovePionLineHighPt=-10;
2093 fPIDnSigmaAbovePionLine=2.;
2094 fPIDnSigmaAbovePionLineHighPt=0.5;
2097 fPIDnSigmaAbovePionLine=3.5;
2098 fPIDnSigmaAbovePionLineHighPt=-10;
2101 fPIDnSigmaAbovePionLine=2.;
2102 fPIDnSigmaAbovePionLineHighPt=1.;
2105 fPIDnSigmaAbovePionLine=3.0; // We need a bit less tight cut on dE/dx
2106 fPIDnSigmaAbovePionLineHighPt=-10;
2109 AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2114 ///________________________________________________________________________
2115 Bool_t AliConversionCuts::SetMinMomPiondEdxCut(Int_t piMomdedxSigmaCut)
2117 switch(piMomdedxSigmaCut){
2119 fPIDMinPnSigmaAbovePionLine=0.5;
2122 fPIDMinPnSigmaAbovePionLine=1.;
2125 fPIDMinPnSigmaAbovePionLine=1.5;
2128 fPIDMinPnSigmaAbovePionLine=20.;
2131 fPIDMinPnSigmaAbovePionLine=50.;
2134 fPIDMinPnSigmaAbovePionLine=0.3;
2137 fPIDMinPnSigmaAbovePionLine=0.25;
2140 fPIDMinPnSigmaAbovePionLine=0.4;
2143 fPIDMinPnSigmaAbovePionLine=0.2;
2146 AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2151 ///________________________________________________________________________
2152 Bool_t AliConversionCuts::SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
2154 switch(piMaxMomdedxSigmaCut){
2156 fPIDMaxPnSigmaAbovePionLine=100.;
2159 fPIDMaxPnSigmaAbovePionLine=5.;
2162 fPIDMaxPnSigmaAbovePionLine=4.;
2165 fPIDMaxPnSigmaAbovePionLine=3.5;
2168 fPIDMaxPnSigmaAbovePionLine=3.;
2171 fPIDMaxPnSigmaAbovePionLine=7.;
2174 AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2179 ///________________________________________________________________________
2180 Bool_t AliConversionCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
2182 switch(LowPRejectionSigmaCut){
2184 fPIDnSigmaAtLowPAroundKaonLine=0;
2185 fPIDnSigmaAtLowPAroundProtonLine=0;
2186 fPIDnSigmaAtLowPAroundPionLine=0;
2187 fDoKaonRejectionLowP = kFALSE;
2188 fDoProtonRejectionLowP = kFALSE;
2189 fDoPionRejectionLowP = kFALSE;
2190 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2193 fPIDnSigmaAtLowPAroundKaonLine=0.5;
2194 fPIDnSigmaAtLowPAroundProtonLine=0.5;
2195 fPIDnSigmaAtLowPAroundPionLine=0.5;
2196 fDoKaonRejectionLowP = kTRUE;
2197 fDoProtonRejectionLowP = kTRUE;
2198 fDoPionRejectionLowP = kTRUE;
2199 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2202 fPIDnSigmaAtLowPAroundKaonLine=1;
2203 fPIDnSigmaAtLowPAroundProtonLine=1;
2204 fPIDnSigmaAtLowPAroundPionLine=1;
2205 fDoKaonRejectionLowP = kTRUE;
2206 fDoProtonRejectionLowP = kTRUE;
2207 fDoPionRejectionLowP = kTRUE;
2208 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2211 fPIDnSigmaAtLowPAroundKaonLine=2.;
2212 fPIDnSigmaAtLowPAroundProtonLine=2.;
2213 fPIDnSigmaAtLowPAroundPionLine=2.;
2214 fDoKaonRejectionLowP = kTRUE;
2215 fDoProtonRejectionLowP = kTRUE;
2216 fDoPionRejectionLowP = kTRUE;
2217 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2220 fPIDnSigmaAtLowPAroundKaonLine=0.;
2221 fPIDnSigmaAtLowPAroundProtonLine=0.;
2222 fPIDnSigmaAtLowPAroundPionLine=1;
2223 fDoKaonRejectionLowP = kFALSE;
2224 fDoProtonRejectionLowP = kFALSE;
2225 fDoPionRejectionLowP = kTRUE;
2226 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2229 fPIDnSigmaAtLowPAroundKaonLine=0.;
2230 fPIDnSigmaAtLowPAroundProtonLine=0.;
2231 fPIDnSigmaAtLowPAroundPionLine=1.5;
2232 fDoKaonRejectionLowP = kFALSE;
2233 fDoProtonRejectionLowP = kFALSE;
2234 fDoPionRejectionLowP = kTRUE;
2235 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2238 fPIDnSigmaAtLowPAroundKaonLine=0.;
2239 fPIDnSigmaAtLowPAroundProtonLine=0.;
2240 fPIDnSigmaAtLowPAroundPionLine=2.;
2241 fDoKaonRejectionLowP = kFALSE;
2242 fDoProtonRejectionLowP = kFALSE;
2243 fDoPionRejectionLowP = kTRUE;
2244 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2247 fPIDnSigmaAtLowPAroundKaonLine=0.;
2248 fPIDnSigmaAtLowPAroundProtonLine=0.;
2249 fPIDnSigmaAtLowPAroundPionLine=0.5;
2250 fDoKaonRejectionLowP = kFALSE;
2251 fDoProtonRejectionLowP = kFALSE;
2252 fDoPionRejectionLowP = kTRUE;
2253 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2256 AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
2261 ///________________________________________________________________________
2262 Bool_t AliConversionCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
2264 switch(TOFelectronPID){
2266 fUseTOFpid = kFALSE;
2267 fTofPIDnSigmaBelowElectronLine=-100;
2268 fTofPIDnSigmaAboveElectronLine=100;
2272 fTofPIDnSigmaBelowElectronLine=-7;
2273 fTofPIDnSigmaAboveElectronLine=7;
2277 fTofPIDnSigmaBelowElectronLine=-5;
2278 fTofPIDnSigmaAboveElectronLine=5;
2282 fTofPIDnSigmaBelowElectronLine=-3;
2283 fTofPIDnSigmaAboveElectronLine=5;
2287 fTofPIDnSigmaBelowElectronLine=-2;
2288 fTofPIDnSigmaAboveElectronLine=3;
2292 fTofPIDnSigmaBelowElectronLine=-3;
2293 fTofPIDnSigmaAboveElectronLine=3;
2296 AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
2301 ///________________________________________________________________________
2302 Bool_t AliConversionCuts::SetQtMaxCut(Int_t QtMaxCut)
2307 fDoQtGammaSelection=kFALSE;
2308 fDoHighPtQtGammaSelection=kFALSE;
2310 fPtBorderForQt=100.;
2314 fDoHighPtQtGammaSelection=kFALSE;
2316 fPtBorderForQt=100.;
2320 fDoHighPtQtGammaSelection=kFALSE;
2322 fPtBorderForQt=100.;
2326 fDoHighPtQtGammaSelection=kFALSE;
2328 fPtBorderForQt=100.;
2332 fDoHighPtQtGammaSelection=kFALSE;
2334 fPtBorderForQt=100.;
2338 fDoHighPtQtGammaSelection=kFALSE;
2340 fPtBorderForQt=100.;
2344 fDoHighPtQtGammaSelection=kTRUE;
2350 fDoHighPtQtGammaSelection=kFALSE;
2352 fPtBorderForQt=100.;
2355 AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
2360 ///________________________________________________________________________
2361 Bool_t AliConversionCuts::SetChi2GammaCut(Int_t chi2GammaCut)
2364 switch(chi2GammaCut){
2366 fChi2CutConversion = 100.;
2369 fChi2CutConversion = 50.;
2372 fChi2CutConversion = 30.;
2375 fChi2CutConversion = 200.;
2378 fChi2CutConversion = 500.;
2381 fChi2CutConversion = 100000.;
2384 fChi2CutConversion = 5.;
2387 fChi2CutConversion = 10.;
2390 fChi2CutConversion = 20.;
2393 fChi2CutConversion = 15.;
2396 AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
2401 ///________________________________________________________________________
2402 Bool_t AliConversionCuts::SetPsiPairCut(Int_t psiCut) {
2406 fPsiPairCut = 10000; //
2409 fPsiPairCut = 0.1; //
2412 fPsiPairCut = 0.05; // Standard
2415 fPsiPairCut = 0.035; //
2418 fPsiPairCut = 0.15; //
2421 fPsiPairCut = 0.2; //
2424 fPsiPairCut = 0.03; //
2427 fPsiPairCut = 0.025; //
2430 fPsiPairCut = 0.01; //
2433 fPsiPairCut = 0.5; //
2436 AliError(Form("PsiPairCut not defined %d",psiCut));
2442 ///________________________________________________________________________
2443 Bool_t AliConversionCuts::SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut){
2445 switch(doPhotonAsymmetryCut){
2447 fDoPhotonAsymmetryCut=0;
2448 fMinPPhotonAsymmetryCut=100.;
2449 fMinPhotonAsymmetry=0.;
2452 fDoPhotonAsymmetryCut=1;
2453 fMinPPhotonAsymmetryCut=3.5;
2454 fMinPhotonAsymmetry=0.04;
2457 fDoPhotonAsymmetryCut=1;
2458 fMinPPhotonAsymmetryCut=3.5;
2459 fMinPhotonAsymmetry=0.06;
2462 AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
2465 fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
2468 ///________________________________________________________________________
2469 Bool_t AliConversionCuts::SetCosPAngleCut(Int_t cosCut) {
2473 fCosPAngleCut = TMath::Pi(); // -1
2476 fCosPAngleCut = 0.1; // 0.99500
2479 fCosPAngleCut = 0.05; // 0.99875
2482 fCosPAngleCut = 0.025; // 0.99969
2485 fCosPAngleCut = 0.01; // 0.99995
2488 fCosPAngleCut = 0.2; // 0.98007
2491 fCosPAngleCut = 0.5; // 0.87758
2494 fCosPAngleCut = 0.075; // 0.73169
2497 AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
2503 ///________________________________________________________________________
2504 Bool_t AliConversionCuts::SetSharedElectronCut(Int_t sharedElec) {
2508 fDoSharedElecCut = kFALSE;
2511 fDoSharedElecCut = kTRUE;
2514 AliError(Form("Shared Electron Cut not defined %d",sharedElec));
2520 ///________________________________________________________________________
2521 Bool_t AliConversionCuts::SetToCloseV0sCut(Int_t toClose) {
2525 fDoToCloseV0sCut = kFALSE;
2529 fDoToCloseV0sCut = kTRUE;
2533 fDoToCloseV0sCut = kTRUE;
2537 fDoToCloseV0sCut = kTRUE;
2541 AliError(Form("Shared Electron Cut not defined %d",toClose));
2546 ///________________________________________________________________________
2547 Bool_t AliConversionCuts::SetTRDElectronCut(Int_t TRDElectronCut)
2549 switch(TRDElectronCut){
2555 fPIDTRDEfficiency=0.1;
2559 fPIDTRDEfficiency=0.8;
2563 fPIDTRDEfficiency=0.9;
2566 AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
2572 //-------------------------------------------------------------
2573 Double_t AliConversionCuts::GetCentrality(AliVEvent *event)
2574 { // Get Event Centrality
2576 AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
2578 AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
2580 if(fDetectorCentrality==0){
2581 return fESDCentrality->GetCentralityPercentile("V0M"); // default
2583 if(fDetectorCentrality==1){
2584 return fESDCentrality->GetCentralityPercentile("CL1");
2588 AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
2590 if(aodEvent->GetHeader()){return aodEvent->GetHeader()->GetCentrality();}
2595 //-------------------------------------------------------------
2596 Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEvent)
2597 { // Centrality Selection
2598 if(!fIsHeavyIon)return kTRUE;
2600 if(fCentralityMin == 0 && fCentralityMax == 0) return kTRUE;//0-100%
2601 if(fCentralityMin >= fCentralityMax) return kTRUE;//0-100%
2603 Double_t centrality=GetCentrality(event);
2604 if(centrality<0)return kFALSE;
2606 Int_t centralityC=0;
2607 if (fModCentralityClass == 0){
2608 centralityC= Int_t(centrality/10);
2609 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2613 else if (fModCentralityClass ==1){
2614 centralityC= Int_t(centrality);
2615 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2617 } else return kFALSE;
2619 else if (fModCentralityClass ==2){
2620 centralityC= Int_t(centrality);
2621 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2626 // Use strict V0 amplitude cut for MC centrality
2627 Float_t nv0amplitude = event->GetVZEROData()->GetMTotV0A()+event->GetVZEROData()->GetMTotV0C();
2628 Float_t V0Amplitude10[10] = {9999999.0,13670,9345,6209,3944,2352,1272,611,255, 83};
2629 // 0 10 20 30 40 50 60 70 80 90%
2630 Float_t V0Amplitude5a[10] = {9999999.0,16612,13670,11290,9345,7650,6209,4984,3944,3074};
2631 // 0 5 10 15 20 25 30 35 40 45%
2632 Float_t V0Amplitude5b[10] = {3074,2352,1725,1272,899,611,402,255,152,83};
2633 // 45 50 55 60 65 70 75 80 85 90%
2635 if (fModCentralityClass == 3){
2637 if(nv0amplitude > V0Amplitude10[fCentralityMax] && nv0amplitude <= V0Amplitude10[fCentralityMin])
2642 centralityC= Int_t(centrality/10);
2643 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2648 else if (fModCentralityClass ==4){
2650 if(nv0amplitude > V0Amplitude5a[fCentralityMax] && nv0amplitude <= V0Amplitude5a[fCentralityMin])
2655 centralityC= Int_t(centrality);
2656 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2658 } else return kFALSE;
2661 else if (fModCentralityClass ==5){
2663 if(nv0amplitude > V0Amplitude5b[fCentralityMax] && nv0amplitude <= V0Amplitude5b[fCentralityMin])
2668 centralityC= Int_t(centrality);
2669 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2677 ///________________________________________________________________________
2678 Bool_t AliConversionCuts::VertexZCut(AliVEvent *event){
2679 // Cut on z position of primary vertex
2680 Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2682 if(abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2685 ///________________________________________________________________________
2687 Int_t AliConversionCuts::GetNumberOfContributorsVtx(AliVEvent *event){
2688 // returns number of contributors to the vertex
2690 AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2692 if (fESDEvent->GetPrimaryVertex() != NULL){
2693 if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2694 return fESDEvent->GetPrimaryVertex()->GetNContributors();
2698 if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2699 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2700 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2702 AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2708 AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2710 if (fAODEvent->GetPrimaryVertex() != NULL){
2711 if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2712 return fAODEvent->GetPrimaryVertex()->GetNContributors();
2715 if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2716 if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2717 return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2719 AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
2728 ///________________________________________________________________________
2730 Bool_t AliConversionCuts::IsTriggerSelected()
2733 AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
2735 UInt_t isSelected = AliVEvent::kAny;
2736 if( fInputHandler && fInputHandler->GetEventSelection()) {
2737 // Get the actual offline trigger mask for the event and AND it with the
2738 // requested mask. If no mask requested select by default the event.
2739 if (fOfflineTriggerMask)
2740 isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
2742 fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
2746 if (fIsSDDFired) hTriggerClass->Fill(32);
2747 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
2748 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
2749 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
2750 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
2751 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
2752 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
2753 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
2754 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
2755 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
2756 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
2757 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
2758 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
2759 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
2760 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
2761 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
2762 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
2763 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
2764 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
2765 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
2766 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
2767 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
2768 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
2769 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
2770 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
2771 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
2772 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
2773 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
2774 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
2775 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
2776 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
2777 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
2778 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
2779 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
2780 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
2781 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
2782 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
2783 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(28);
2784 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(29);
2785 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(30);
2786 if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(33);
2789 if(hTriggerClassSelected && isSelected){
2790 if (!fIsSDDFired) hTriggerClassSelected->Fill(32);
2791 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
2792 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
2793 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
2794 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
2795 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
2796 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
2797 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
2798 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
2799 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
2800 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
2801 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
2802 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
2803 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
2804 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
2805 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
2806 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
2807 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
2808 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
2809 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
2810 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
2811 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
2812 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
2813 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
2814 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
2815 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
2816 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
2817 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
2818 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
2819 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
2820 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
2821 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
2822 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
2823 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
2824 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
2825 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
2826 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
2827 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(28);
2828 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(29);
2829 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(30);
2832 if(!isSelected)return kFALSE;
2838 ///________________________________________________________________________
2839 Int_t AliConversionCuts::GetFirstTPCRow(Double_t radius){
2840 // Get first TPC row
2841 Int_t firstTPCRow = 0;
2842 Double_t radiusI = 84.8;
2843 Double_t radiusO = 134.6;
2844 Double_t radiusOB = 198.;
2845 Double_t rSizeI = 0.75;
2846 Double_t rSizeO = 1.;
2847 Double_t rSizeOB = 1.5;
2851 if(radius <= radiusI){
2854 if(radius>radiusI && radius<=radiusO){
2855 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
2857 if(radius>radiusO && radius<=radiusOB){
2858 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
2861 if(radius>radiusOB){
2862 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
2868 Bool_t AliConversionCuts::CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const {
2869 ///Check if passes cosine of pointing angle cut
2870 if(GetCosineOfPointingAngle(photon, event) < (TMath::Cos(fCosPAngleCut))){
2876 Double_t AliConversionCuts::GetCosineOfPointingAngle( const AliConversionPhotonBase * photon, AliVEvent * event) const{
2877 // calculates the pointing angle of the recalculated V0
2879 Double_t momV0[3] = {0,0,0};
2880 if(event->IsA()==AliESDEvent::Class()){
2881 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
2882 if(!esdEvent) return -999;
2883 AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
2884 if(!v0) return -999;
2885 v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
2887 if(event->IsA()==AliAODEvent::Class()){
2888 momV0[0] = photon->GetPx();
2889 momV0[1] = photon->GetPy();
2890 momV0[2] = photon->GetPz();
2893 //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
2894 Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
2895 photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
2896 photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
2898 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
2899 Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
2902 Double_t cosinePointingAngle = -999;
2903 if(momV02*PosV02 > 0.0)
2904 cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
2906 return cosinePointingAngle;
2909 ///________________________________________________________________________
2910 Bool_t AliConversionCuts::PsiPairCut(const AliConversionPhotonBase * photon) const {
2912 if(photon->GetPsiPair() > fPsiPairCut){
2918 ///________________________________________________________________________
2919 TString AliConversionCuts::GetCutNumber(){
2920 // returns TString with current cut number
2922 for(Int_t ii=0;ii<kNCuts;ii++){
2923 a.Append(Form("%d",fCuts[ii]));
2928 ///________________________________________________________________________
2929 void AliConversionCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
2931 Int_t posLabel = photon->GetTrackLabelPositive();
2932 Int_t negLabel = photon->GetTrackLabelNegative();
2934 fElectronLabelArray[nV0*2] = posLabel;
2935 fElectronLabelArray[(nV0*2)+1] = negLabel;
2937 ///________________________________________________________________________
2938 Bool_t AliConversionCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
2940 Int_t posLabel = photon->GetTrackLabelPositive();
2941 Int_t negLabel = photon->GetTrackLabelNegative();
2943 for(Int_t i = 0; i<nV0s*2;i++){
2944 if(i==nV0*2) continue;
2945 if(i==(nV0*2)+1) continue;
2946 if(fElectronLabelArray[i] == posLabel){
2948 if(fElectronLabelArray[i] == negLabel){
2954 ///________________________________________________________________________
2955 Bool_t AliConversionCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
2958 Double_t posX = photon->GetConversionX();
2959 Double_t posY = photon->GetConversionY();
2960 Double_t posZ = photon->GetConversionZ();
2962 for(Int_t i = 0;i<photons->GetEntries();i++){
2963 if(nV0 == i) continue;
2964 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
2965 Double_t posCompX = photonComp->GetConversionX();
2966 Double_t posCompY = photonComp->GetConversionY();
2967 Double_t posCompZ = photonComp->GetConversionZ();
2969 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
2971 if(dist < fminV0Dist*fminV0Dist){
2972 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
2980 ///________________________________________________________________________
2981 void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliMCEvent *MCEvent){
2983 if(fNotRejectedStart){
2984 delete[] fNotRejectedStart;
2985 fNotRejectedStart = NULL;
2987 if(fNotRejectedEnd){
2988 delete[] fNotRejectedEnd;
2989 fNotRejectedEnd = NULL;
2991 if(fGeneratorNames){
2992 delete[] fGeneratorNames;
2993 fGeneratorNames = NULL;
2996 if(rejection == 0) return; // No Rejection
2997 AliGenCocktailEventHeader *cHeader = dynamic_cast<AliGenCocktailEventHeader*>(MCEvent->GenEventHeader());
2999 TList *genHeaders = cHeader->GetHeaders();
3000 AliGenEventHeader* gh = 0;
3002 if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
3003 if(rejection == 2){ // TList of Headers Names
3004 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3005 gh = (AliGenEventHeader*)genHeaders->At(i);
3006 TString GeneratorName = gh->GetName();
3007 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3008 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3009 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3017 fNotRejectedStart = new Int_t[fnHeaders];
3018 fNotRejectedEnd = new Int_t[fnHeaders];
3019 fGeneratorNames = new TString[fnHeaders];
3021 if(rejection == 1 || rejection == 3){
3022 fNotRejectedStart[0] = 0;
3023 fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
3024 fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
3028 Int_t firstindex = 0;
3029 Int_t lastindex = -1;
3031 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3032 gh = (AliGenEventHeader*)genHeaders->At(i);
3033 TString GeneratorName = gh->GetName();
3034 lastindex = lastindex + gh->NProduced();
3035 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3036 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3037 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3038 fNotRejectedStart[nummer] = firstindex;
3039 fNotRejectedEnd[nummer] = lastindex;
3040 fGeneratorNames[nummer] = GeneratorName;
3041 // cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3046 firstindex = firstindex + gh->NProduced();
3048 } else { // No Cocktail Header Found
3049 fNotRejectedStart = new Int_t[1];
3050 fNotRejectedEnd = new Int_t[1];
3053 fNotRejectedStart[0] = 0;
3054 fNotRejectedEnd[0] = MCEvent->Stack()->GetNprimary()-1;
3055 // if(rejection == 2){
3056 fGeneratorNames = new TString[1];
3057 fGeneratorNames[0] = "NoCocktailGeneratorFound";
3060 AliGenPythiaEventHeader *mcHeaderPythia = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent->GenEventHeader());
3061 if (mcHeaderPythia) fGeneratorNames[0] = "NoCocktailGeneratorFound_Pythia";
3062 AliGenDPMjetEventHeader *mcHeaderPhojet = dynamic_cast<AliGenDPMjetEventHeader*>(MCEvent->GenEventHeader());
3063 if (mcHeaderPhojet) fGeneratorNames[0] = "NoCocktailGeneratorFound_Phojet";
3064 AliGenHijingEventHeader *mcHeaderHijing = dynamic_cast<AliGenHijingEventHeader*>(MCEvent->GenEventHeader());
3065 if (mcHeaderHijing) fGeneratorNames[0] = "NoCocktailGeneratorFound_Hijing";
3067 SetRejectExtraSignalsCut(0);
3071 //_________________________________________________________________________
3072 Int_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack){
3074 // Not Accepted == kFALSE == 0
3075 // Accepted == kTRUE == 1
3076 // FirstHeader == kTRUE == 3
3078 if(index < 0) return 0; // No Particle
3081 if( index >= MCStack->GetNprimary()){ // Secondary Particle
3082 if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother??
3083 return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack);
3085 for(Int_t i = 0;i<fnHeaders;i++){
3086 if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3088 if(i == 0) accepted = 2; // MB Header
3094 //_________________________________________________________________________
3095 Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Bool_t isHeavyIon){
3097 if(isHeavyIon && !(IsCentralitySelected(InputEvent,MCEvent)))
3098 return 1; // Check Centrality --> Not Accepted => eventQuality = 1
3100 if(!isHeavyIon && GetIsFromPileup()){
3101 if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
3102 return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3106 Bool_t hasV0And = ReaderCuts->HasV0AND();
3107 Bool_t isSDDFired = ReaderCuts->IsSDDFired();
3108 if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent)
3109 return 7; // With SDD requested but no fired
3111 if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
3112 return 8; // V0AND requested but no fired
3118 Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliStack *MCStack){
3119 if (!(period.CompareTo("LHC12f1a") == 0 || period.CompareTo("LHC12f1b") == 0 || period.CompareTo("LHC12i3") == 0 )) return 1.;
3122 for (Int_t i = 0; i < fnHeaders; i++){
3123 if (index >= fNotRejectedStart[i] && index < fNotRejectedEnd[i]+1){
3124 // cout << fGeneratorNames[i].Data() << endl;
3125 if (fGeneratorNames[i].CompareTo("Pythia") == 0){
3127 } else if (fGeneratorNames[i].CompareTo("DPMJET") == 0){
3129 } else if (fGeneratorNames[i].CompareTo("HIJING") == 0){
3131 } else if (fGeneratorNames[i].CompareTo("BOX") == 0){
3133 } else if (fGeneratorNames[i].CompareTo("PARAM") == 0){
3135 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound") == 0){
3137 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Pythia") == 0){
3139 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Phojet") == 0){
3141 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Hijing") == 0){
3144 // cout << "resulting kCaseGen :" << kCaseGen << endl;
3148 Double_t mesonPt = ((TParticle*)MCStack->Particle(index))->Pt();
3150 // Double_t mesonY = 10.;
3151 // if(((TParticle*)MCStack->Particle(index))->Energy() - ((TParticle*)MCStack->Particle(index))->Pz() == 0 || ((TParticle*)MCStack->Particle(index))->Energy() + ((TParticle*)MCStack->Particle(index))->Pz() == 0){
3154 // mesonY = 0.5*(TMath::Log((((TParticle*)MCStack->Particle(index))->Energy()+((TParticle*)MCStack->Particle(index))->Pz()) / (((TParticle*)MCStack->Particle(index))->Energy()-((TParticle*)MCStack->Particle(index))->Pz())));
3156 Double_t mesonMass = ((TParticle*)MCStack->Particle(index))->GetCalcMass();
3157 Float_t functionResult = 1.;
3159 Float_t dNdyMC = 2.1462;
3160 Float_t nMC = 7.06055;
3161 Float_t tMC = 0.12533;
3162 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3166 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3171 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);
3172 } else if (kCaseGen == 2){
3173 Float_t dNdyMC = 2.35978;
3174 Float_t nMC = 6.81795;
3175 Float_t tMC = 0.11492;
3176 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3180 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3185 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);
3186 } else if (kCaseGen == 4){
3187 // functionResult = 1./sqrt(1.-mesonMass*mesonMass/((mesonMass*mesonMass+mesonPt*mesonPt)*cosh(mesonY)*cosh(mesonY)));
3188 Float_t a = 0.23437;
3190 Float_t c = -1430.5863;
3191 Float_t d = -0.6966624;
3192 Float_t e = 252.3742;
3193 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3199 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3206 functionResult = a*TMath::Power(mesonPt,-1.*(b+c/(TMath::Power(mesonPt,d)+e)))*1./mesonPt *1./1.6 *1./(2.* TMath::Pi());
3209 Float_t dNdyData = 2.2328;
3210 Float_t nData = 7.1473;
3211 Float_t tData = 0.1346;
3212 if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 111){
3216 } else if ( ((TParticle*)MCStack->Particle(index))->GetPdgCode() == 221){
3217 dNdyData = 0.38992; //be careful this fit is not optimal, eta in data still has problems
3221 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);
3222 // cout << "tsallisData/functionResult: " << tsallisData/functionResult << endl;
3223 return tsallisData/functionResult;
3227 ///________________________________________________________________________
3228 AliConversionCuts* AliConversionCuts::GetStandardCuts2010PbPb(){
3229 //Create and return standard 2010 PbPb cuts
3230 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
3231 if(!cuts->InitializeCutsFromCutString("1000002042092970023220000")){
3232 cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
3236 ///________________________________________________________________________
3237 AliConversionCuts* AliConversionCuts::GetStandardCuts2010pp(){
3238 //Create and return standard 2010 PbPb cuts
3239 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010pp","StandardCuts2010pp");
3240 if(!cuts->InitializeCutsFromCutString("0000011002093663003800000")){
3241 cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}