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"
44 #include "AliGenCocktailEventHeader.h"
45 #include "AliGenDPMjetEventHeader.h"
46 #include "AliGenPythiaEventHeader.h"
47 #include "AliGenHijingEventHeader.h"
48 #include "AliTriggerAnalysis.h"
49 #include "AliV0ReaderV1.h"
50 #include "AliAODMCParticle.h"
51 #include "AliAODMCHeader.h"
57 ClassImp(AliConversionCuts)
60 const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
76 "piMaxMomdedxSigmaCut",
77 "LowPRejectionSigmaCut",
82 "DoPhotonAsymmetryCut",
83 "CosinePointingAngle",
89 //________________________________________________________________________
90 AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
91 AliAnalysisCuts(name,title),
107 fLineCutZRSlopeMin(0.),
108 fLineCutZValueMin(0),
109 fChi2CutConversion(1000),
110 fPIDProbabilityCutNegativeParticle(0),
111 fPIDProbabilityCutPositiveParticle(0),
112 fDodEdxSigmaCut(kTRUE),
113 fDoTOFsigmaCut(kFALSE),
114 fPIDTRDEfficiency(1),
116 fPIDnSigmaAboveElectronLine(100),
117 fPIDnSigmaBelowElectronLine(-100),
118 fTofPIDnSigmaAboveElectronLine(100),
119 fTofPIDnSigmaBelowElectronLine(-100),
120 fPIDnSigmaAbovePionLine(0),
121 fPIDnSigmaAbovePionLineHighPt(-100),
122 fPIDMinPnSigmaAbovePionLine(0),
123 fPIDMaxPnSigmaAbovePionLine(0),
124 fDoKaonRejectionLowP(kFALSE),
125 fDoProtonRejectionLowP(kFALSE),
126 fDoPionRejectionLowP(kFALSE),
127 fPIDnSigmaAtLowPAroundKaonLine(0),
128 fPIDnSigmaAtLowPAroundProtonLine(0),
129 fPIDnSigmaAtLowPAroundPionLine(0),
130 fPIDMinPKaonRejectionLowP(1.5),
131 fPIDMinPProtonRejectionLowP(2),
132 fPIDMinPPionRejectionLowP(0),
133 fDoQtGammaSelection(kTRUE),
134 fDoHighPtQtGammaSelection(kFALSE),
142 fUseEtaMinCut(kFALSE),
143 fUseOnFlyV0Finder(kTRUE),
144 fDoPhotonAsymmetryCut(kTRUE),
145 fMinPPhotonAsymmetryCut(100.),
146 fMinPhotonAsymmetry(0.),
148 fDetectorCentrality(0),
149 fModCentralityClass(0),
153 fUseCorrectedTPCClsInfo(kFALSE),
155 fMultiplicityMethod(0),
157 fRemovePileUp(kFALSE),
158 fOpeningAngle(0.005),
160 fCosPAngleCut(10000),
161 fDoToCloseV0sCut(kFALSE),
162 fRejectExtraSignals(0),
164 fDoSharedElecCut(kFALSE),
165 fOfflineTriggerMask(0),
169 fElectronArraySize(500),
170 fElectronLabelArray(NULL),
171 fConversionPointXArray(0.0),
172 fConversionPointYArray(0.0),
173 fConversionPointZArray(0.0),
175 fNotRejectedStart(NULL),
176 fNotRejectedEnd(NULL),
177 fGeneratorNames(NULL),
182 fDoReweightHistoMCPi0(kFALSE),
183 fDoReweightHistoMCEta(kFALSE),
184 fDoReweightHistoMCK0s(kFALSE),
185 fPathTrFReweighting(""),
186 fNameHistoReweightingPi0(""),
187 fNameHistoReweightingEta(""),
188 fNameHistoReweightingK0s(""),
190 hTPCdEdxbefore(NULL),
192 hTPCdEdxSigbefore(NULL),
193 hTPCdEdxSigafter(NULL),
199 hInvMassbefore(NULL),
200 hArmenterosbefore(NULL),
202 hArmenterosafter(NULL),
203 hAcceptanceCuts(NULL),
209 hTriggerClassSelected(NULL),
210 hReweightMCHistPi0(NULL),
211 hReweightMCHistEta(NULL),
212 hReweightMCHistK0s(NULL),
214 fTriggerSelectedManually(kFALSE),
215 fSpecialTriggerName("")
219 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
220 fCutString=new TObjString((GetCutNumber()).Data());
222 fElectronLabelArray = new Int_t[fElectronArraySize];
223 fUtils = new AliAnalysisUtils();
224 //if you do not want to apply the cut on the distance between the SPD and TRK vertex:
225 //fUtils->SetCutOnZVertexSPD(kFALSE);
230 //________________________________________________________________________
231 AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
232 AliAnalysisCuts(ref),
234 fHeaderList(ref.fHeaderList),
236 fEventQuality(ref.fEventQuality),
239 fEtaCut(ref.fEtaCut),
240 fEtaCutMin(ref.fEtaCutMin),
242 fSinglePtCut(ref.fSinglePtCut),
244 fMinClsTPC(ref.fMinClsTPC),
245 fMinClsTPCToF(ref.fMinClsTPCToF),
246 fLineCutZRSlope(ref.fLineCutZRSlope),
247 fLineCutZValue(ref.fLineCutZValue),
248 fLineCutZRSlopeMin(ref.fLineCutZRSlopeMin),
249 fLineCutZValueMin(ref.fLineCutZValueMin),
250 fChi2CutConversion(ref.fChi2CutConversion),
251 fPIDProbabilityCutNegativeParticle(ref.fPIDProbabilityCutNegativeParticle),
252 fPIDProbabilityCutPositiveParticle(ref.fPIDProbabilityCutPositiveParticle),
253 fDodEdxSigmaCut(ref. fDodEdxSigmaCut),
254 fDoTOFsigmaCut(ref.fDoTOFsigmaCut),
255 fPIDTRDEfficiency(ref.fPIDTRDEfficiency),
256 fDoTRDPID(ref.fDoTRDPID),
257 fPIDnSigmaAboveElectronLine(ref.fPIDnSigmaAboveElectronLine),
258 fPIDnSigmaBelowElectronLine(ref.fPIDnSigmaBelowElectronLine),
259 fTofPIDnSigmaAboveElectronLine(ref.fTofPIDnSigmaAboveElectronLine),
260 fTofPIDnSigmaBelowElectronLine(ref.fTofPIDnSigmaBelowElectronLine),
261 fPIDnSigmaAbovePionLine(ref.fPIDnSigmaAbovePionLine),
262 fPIDnSigmaAbovePionLineHighPt(ref.fPIDnSigmaAbovePionLineHighPt),
263 fPIDMinPnSigmaAbovePionLine(ref.fPIDMinPnSigmaAbovePionLine),
264 fPIDMaxPnSigmaAbovePionLine(ref.fPIDMaxPnSigmaAbovePionLine),
265 fDoKaonRejectionLowP(ref.fDoKaonRejectionLowP),
266 fDoProtonRejectionLowP(ref.fDoProtonRejectionLowP),
267 fDoPionRejectionLowP(ref.fDoPionRejectionLowP),
268 fPIDnSigmaAtLowPAroundKaonLine(ref.fPIDnSigmaAtLowPAroundKaonLine),
269 fPIDnSigmaAtLowPAroundProtonLine(ref.fPIDnSigmaAtLowPAroundProtonLine),
270 fPIDnSigmaAtLowPAroundPionLine(ref.fPIDnSigmaAtLowPAroundPionLine),
271 fPIDMinPKaonRejectionLowP(ref.fPIDMinPKaonRejectionLowP),
272 fPIDMinPProtonRejectionLowP(ref.fPIDMinPProtonRejectionLowP),
273 fPIDMinPPionRejectionLowP(ref.fPIDMinPPionRejectionLowP),
274 fDoQtGammaSelection(ref.fDoQtGammaSelection),
275 fDoHighPtQtGammaSelection(ref.fDoHighPtQtGammaSelection),
277 fHighPtQtMax(ref.fHighPtQtMax),
278 fPtBorderForQt(ref.fPtBorderForQt),
279 fXVertexCut(ref.fXVertexCut),
280 fYVertexCut(ref.fYVertexCut),
281 fZVertexCut(ref.fZVertexCut),
282 fNSigmaMass(ref.fNSigmaMass),
283 fUseEtaMinCut(ref.fUseEtaMinCut),
284 fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
285 fDoPhotonAsymmetryCut(ref.fDoPhotonAsymmetryCut),
286 fMinPPhotonAsymmetryCut(ref.fMinPPhotonAsymmetryCut),
287 fMinPhotonAsymmetry(ref.fMinPhotonAsymmetry),
288 fIsHeavyIon(ref.fIsHeavyIon),
289 fDetectorCentrality(ref.fDetectorCentrality),
290 fModCentralityClass(ref.fModCentralityClass),
291 fMaxVertexZ(ref.fMaxVertexZ),
292 fCentralityMin(ref.fCentralityMin),
293 fCentralityMax(ref.fCentralityMax),
294 fUseCorrectedTPCClsInfo(ref.fUseCorrectedTPCClsInfo),
295 fUseTOFpid(ref.fUseTOFpid),
296 fMultiplicityMethod(ref.fMultiplicityMethod),
297 fSpecialTrigger(ref.fSpecialTrigger),
298 fRemovePileUp(ref.fRemovePileUp),
299 fOpeningAngle(ref.fOpeningAngle),
300 fPsiPairCut(ref.fPsiPairCut),
301 fCosPAngleCut(ref.fCosPAngleCut),
302 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
303 fRejectExtraSignals(ref.fRejectExtraSignals),
304 fminV0Dist(ref.fminV0Dist),
305 fDoSharedElecCut(ref.fDoSharedElecCut),
306 fOfflineTriggerMask(ref.fOfflineTriggerMask),
307 fHasV0AND(ref.fHasV0AND),
308 fIsSDDFired(ref.fIsSDDFired),
309 fRandom(ref.fRandom),
310 fElectronArraySize(ref.fElectronArraySize),
311 fElectronLabelArray(NULL),
312 fConversionPointXArray(ref.fConversionPointXArray),
313 fConversionPointYArray(ref.fConversionPointYArray),
314 fConversionPointZArray(ref.fConversionPointZArray),
315 fnHeaders(ref.fnHeaders),
316 fNotRejectedStart(NULL),
317 fNotRejectedEnd(NULL),
318 fGeneratorNames(ref.fGeneratorNames),
321 fEtaShift(ref.fEtaShift),
322 fDoEtaShift(ref.fDoEtaShift),
323 fDoReweightHistoMCPi0(ref.fDoReweightHistoMCPi0),
324 fDoReweightHistoMCEta(ref.fDoReweightHistoMCEta),
325 fDoReweightHistoMCK0s(ref.fDoReweightHistoMCK0s),
326 fPathTrFReweighting(ref.fPathTrFReweighting),
327 fNameHistoReweightingPi0(ref.fNameHistoReweightingPi0),
328 fNameHistoReweightingEta(ref.fNameHistoReweightingEta),
329 fNameHistoReweightingK0s(ref.fNameHistoReweightingK0s),
331 hTPCdEdxbefore(NULL),
333 hTPCdEdxSigbefore(NULL),
334 hTPCdEdxSigafter(NULL),
340 hInvMassbefore(NULL),
341 hArmenterosbefore(NULL),
343 hArmenterosafter(NULL),
344 hAcceptanceCuts(NULL),
350 hTriggerClassSelected(NULL),
351 hReweightMCHistPi0(NULL),
352 hReweightMCHistEta(NULL),
353 hReweightMCHistK0s(NULL),
354 fPreSelCut(ref.fPreSelCut),
355 fTriggerSelectedManually(ref.fTriggerSelectedManually),
356 fSpecialTriggerName(ref.fSpecialTriggerName)
359 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
360 fCutString=new TObjString((GetCutNumber()).Data());
361 fElectronLabelArray = new Int_t[fElectronArraySize];
362 fUtils = new AliAnalysisUtils();
363 // dont copy histograms (if you like histograms, call InitCutHistograms())
368 //________________________________________________________________________
369 AliConversionCuts::~AliConversionCuts() {
371 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
373 // delete fHistograms;
374 // fHistograms = NULL;
375 if(fCutString != NULL){
379 if(fElectronLabelArray){
380 delete fElectronLabelArray;
381 fElectronLabelArray = NULL;
383 if(fNotRejectedStart){
384 delete[] fNotRejectedStart;
385 fNotRejectedStart = NULL;
388 delete[] fNotRejectedEnd;
389 fNotRejectedEnd = NULL;
392 delete[] fGeneratorNames;
393 fGeneratorNames = NULL;
402 //________________________________________________________________________
403 void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
405 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
406 TH1::AddDirectory(kFALSE);
408 if(fHistograms != NULL){
412 if(fHistograms==NULL){
413 fHistograms=new TList();
414 fHistograms->SetOwner(kTRUE);
415 if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
416 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
419 if (hReweightMCHistPi0) fHistograms->Add(hReweightMCHistPi0);
420 if (hReweightMCHistEta) fHistograms->Add(hReweightMCHistEta);
421 if (hReweightMCHistK0s) fHistograms->Add(hReweightMCHistK0s);
424 hCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",10,-0.5,9.5);
425 hCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
426 hCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
427 hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
428 hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
429 hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
430 hCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
431 hCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
432 hCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
433 fHistograms->Add(hCutIndex);
436 hTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
437 hTrackCuts->GetXaxis()->SetBinLabel(1,"in");
438 hTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
439 hTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
440 hTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
441 hTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
442 hTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
443 hTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
444 hTrackCuts->GetXaxis()->SetBinLabel(8,"out");
445 fHistograms->Add(hTrackCuts);
448 hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",12,-0.5,11.5);
449 hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
450 hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
451 hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
452 hPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
453 hPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
454 hPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
455 hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
456 hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
457 hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
458 hPhotonCuts->GetXaxis()->SetBinLabel(10,"out");
459 fHistograms->Add(hPhotonCuts);
462 hInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
463 fHistograms->Add(hInvMassbefore);
464 hArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
465 fHistograms->Add(hArmenterosbefore);
467 hInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
468 fHistograms->Add(hInvMassafter);
469 hArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
470 fHistograms->Add(hArmenterosafter);
472 hAcceptanceCuts=new TH1F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts",10,-0.5,9.5);
473 hAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
474 hAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
475 hAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
476 hAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
477 hAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
478 hAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
479 hAcceptanceCuts->GetXaxis()->SetBinLabel(7,"minpt");
480 hAcceptanceCuts->GetXaxis()->SetBinLabel(8,"out");
481 fHistograms->Add(hAcceptanceCuts);
484 hdEdxCuts=new TH1F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts",10,-0.5,9.5);
485 hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
486 hdEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
487 hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
488 hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
489 hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
490 hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
491 hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
492 hdEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
493 hdEdxCuts->GetXaxis()->SetBinLabel(9,"TRDelectron");
494 hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
495 fHistograms->Add(hdEdxCuts);
497 TAxis *AxisBeforedEdx = NULL;
498 TAxis *AxisBeforedEdxSig = NULL;
499 TAxis *AxisBeforeTOF = NULL;
500 TAxis *AxisBeforeTOFSig = NULL;
502 hTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
503 fHistograms->Add(hTPCdEdxbefore);
504 AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
505 hTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
506 fHistograms->Add(hTPCdEdxSigbefore);
507 AxisBeforedEdxSig = hTPCdEdxSigbefore->GetXaxis();
509 hTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
510 fHistograms->Add(hTOFbefore);
511 AxisBeforeTOF = hTOFbefore->GetXaxis();
512 hTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
513 fHistograms->Add(hTOFSigbefore);
514 AxisBeforeTOFSig = hTOFSigbefore->GetXaxis();
517 hTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
518 fHistograms->Add(hTPCdEdxSigafter);
520 hTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
521 fHistograms->Add(hTPCdEdxafter);
523 hTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
524 fHistograms->Add(hTOFSigafter);
526 TAxis *AxisAfter = hTPCdEdxSigafter->GetXaxis();
527 Int_t bins = AxisAfter->GetNbins();
528 Double_t from = AxisAfter->GetXmin();
529 Double_t to = AxisAfter->GetXmax();
530 Double_t *newBins = new Double_t[bins+1];
532 Double_t factor = TMath::Power(to/from, 1./bins);
533 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
534 AxisAfter->Set(bins, newBins);
535 AxisAfter = hTOFSigafter->GetXaxis();
536 AxisAfter->Set(bins, newBins);
537 AxisAfter = hTPCdEdxafter->GetXaxis();
538 AxisAfter->Set(bins, newBins);
540 AxisBeforedEdx->Set(bins, newBins);
541 AxisBeforeTOF->Set(bins, newBins);
542 AxisBeforedEdxSig->Set(bins, newBins);
543 AxisBeforeTOFSig->Set(bins, newBins);
547 // Event Cuts and Info
549 hV0EventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",7,-0.5,6.5);
550 hV0EventCuts->GetXaxis()->SetBinLabel(1,"in");
551 hV0EventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
552 hV0EventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
553 hV0EventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
554 hV0EventCuts->GetXaxis()->SetBinLabel(5,"pileup");
555 hV0EventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
556 hV0EventCuts->GetXaxis()->SetBinLabel(7,"out");
557 fHistograms->Add(hV0EventCuts);
559 hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",100,0,100);
560 fHistograms->Add(hCentrality);
561 hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
562 fHistograms->Add(hVertexZ);
564 hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",35,-0.5,34.5);
565 hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
566 hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
567 hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
568 hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
569 hTriggerClass->GetXaxis()->SetBinLabel( 5,"kKEMC1");
570 hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
571 hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
572 hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
573 hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
574 hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
575 hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
576 hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
577 hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
578 hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
579 hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
580 hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
581 hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
582 hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
583 hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
584 hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
585 hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
586 hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
587 hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
588 hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
589 hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
590 hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
591 hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
592 hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
593 hTriggerClass->GetXaxis()->SetBinLabel(29,"kTRD");
594 hTriggerClass->GetXaxis()->SetBinLabel(30,"kFastOnly");
595 hTriggerClass->GetXaxis()->SetBinLabel(31,"kAnyINT");
596 hTriggerClass->GetXaxis()->SetBinLabel(32,"kAny");
597 hTriggerClass->GetXaxis()->SetBinLabel(33,"V0AND");
598 hTriggerClass->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
599 hTriggerClass->GetXaxis()->SetBinLabel(35,"failed Physics Selection");
600 fHistograms->Add(hTriggerClass);
603 hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",34,-0.5,33.5);
604 hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB");
605 hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7");
606 hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON");
607 hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult");
608 hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kKEMC1");
609 hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5");
610 hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
611 hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
612 hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
613 hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
614 hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
615 hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7");
616 hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1");
617 hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
618 hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE");
619 hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA");
620 hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral");
621 hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral");
622 hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5");
623 hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED");
624 hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
625 hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8");
626 hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
627 hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
628 hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
629 hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
630 hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
631 hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined");
632 hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kTRD");
633 hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kFastOnly");
634 hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAnyINT");
635 hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"kAny");
636 hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"V0AND");
637 hTriggerClassSelected->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
638 fHistograms->Add(hTriggerClassSelected);
640 TH1::AddDirectory(kTRUE);
643 //________________________________________________________________________
644 Bool_t AliConversionCuts::InitPIDResponse(){
645 // Set Pointer to AliPIDResponse
647 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
649 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
650 fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
651 if(fPIDResponse)return kTRUE;
658 ///________________________________________________________________________
659 Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent){
660 // Process Event Selection
663 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
666 // Check for MC event
667 if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
668 // Check if MC event is correctly loaded
669 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
674 if (!mcHandler->InitOk() ){
678 if (!mcHandler->TreeK() ){
682 if (!mcHandler->TreeTR() ) {
689 if(!IsTriggerSelected(fInputEvent)){
690 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
696 if(fInputEvent->IsA()==AliESDEvent::Class()){
697 AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
698 fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
699 if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(32);
701 // cout << "event number " << ((AliESDEvent*)fInputEvent)->GetEventNumberInFile() << " entered"<< endl;
704 // Number of Contributors Cut
705 if(GetNumberOfContributorsVtx(fInputEvent)<=0) {
706 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
712 // Z Vertex Position Cut
713 if(!VertexZCut(fInputEvent)){
714 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
723 if(fInputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
724 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
731 // Centrality Selection
732 if(!IsCentralitySelected(fInputEvent,fMCEvent)){
733 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
739 // Fill Event Histograms
740 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
741 if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
742 if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent));
748 ///________________________________________________________________________
749 Bool_t AliConversionCuts::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
750 // MonteCarlo Photon Selection
752 if(!fMCStack)return kFALSE;
754 if (particle->GetPdgCode() == 22){
757 if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )
760 if( particle->Eta() < (fEtaCutMin + fEtaShift) && particle->Eta() > (-fEtaCutMin + fEtaShift) )
764 if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
765 return kFALSE; // no photon as mothers!
768 if(particle->GetMother(0) >= fMCStack->GetNprimary()){
769 return kFALSE; // the gamma has a mother, and it is not a primary particle
772 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
774 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
775 TParticle* ePos = NULL;
776 TParticle* eNeg = NULL;
778 if(particle->GetNDaughters() >= 2){
779 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
780 TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
781 if(tmpDaughter->GetUniqueID() == 5){
782 if(tmpDaughter->GetPdgCode() == 11){
784 } else if(tmpDaughter->GetPdgCode() == -11){
791 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
795 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
796 return kFALSE; // no reconstruction below the Pt cut
799 if( ePos->Eta() > (fEtaCut + fEtaShift) || ePos->Eta() < (-fEtaCut + fEtaShift) ||
800 eNeg->Eta() > (fEtaCut + fEtaShift) || eNeg->Eta() < (-fEtaCut + fEtaShift) )
803 if(fEtaCutMin > -0.1){
804 if( (ePos->Eta() < (fEtaCutMin + fEtaShift) && ePos->Eta() > (-fEtaCutMin + fEtaShift)) ||
805 (eNeg->Eta() < (fEtaCutMin + fEtaShift) && eNeg->Eta() > (-fEtaCutMin + fEtaShift)) )
810 return kFALSE; // cuts on distance from collision point
813 if(abs(ePos->Vz()) > fMaxZ){
814 return kFALSE; // outside material
816 if(abs(eNeg->Vz()) > fMaxZ){
817 return kFALSE; // outside material
820 if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
821 return kFALSE; // line cut to exclude regions where we do not reconstruct
822 } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
826 if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
827 return kFALSE; // line cut to exclude regions where we do not reconstruct
828 } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
833 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
837 ///________________________________________________________________________
838 Bool_t AliConversionCuts::PhotonIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){
839 // MonteCarlo Photon Selection
841 if(!aodmcArray)return kFALSE;
843 if (particle->GetPdgCode() == 22){
844 if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )
847 if( particle->Eta() < (fEtaCutMin + fEtaShift) && particle->Eta() > (-fEtaCutMin + fEtaShift) )
851 if(particle->GetMother() > -1){
852 if((static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
853 return kFALSE; // no photon as mothers!
855 if(!(static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother()))->IsPrimary())){
856 return kFALSE; // the gamma has a mother, and it is not a primary particle
860 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
862 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
863 AliAODMCParticle* ePos = NULL;
864 AliAODMCParticle* eNeg = NULL;
866 if(particle->GetNDaughters() >= 2){
867 for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
868 AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(aodmcArray->At(daughterIndex));
869 if(!tmpDaughter) continue;
870 if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
871 if(tmpDaughter->GetPdgCode() == 11){
873 } else if(tmpDaughter->GetPdgCode() == -11){
880 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
884 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
885 return kFALSE; // no reconstruction below the Pt cut
888 if( ePos->Eta() > (fEtaCut + fEtaShift) || ePos->Eta() < (-fEtaCut + fEtaShift) ||
889 eNeg->Eta() > (fEtaCut + fEtaShift) || eNeg->Eta() < (-fEtaCut + fEtaShift) )
892 if(fEtaCutMin > -0.1){
893 if( (ePos->Eta() < (fEtaCutMin + fEtaShift) && ePos->Eta() > (-fEtaCutMin + fEtaShift)) ||
894 (eNeg->Eta() < (fEtaCutMin + fEtaShift) && eNeg->Eta() > (-fEtaCutMin + fEtaShift)) )
898 Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) );
899 Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) );
902 return kFALSE; // cuts on distance from collision point
904 if(abs(ePos->Zv()) > fMaxZ){
905 return kFALSE; // outside material
907 if(abs(eNeg->Zv()) > fMaxZ){
908 return kFALSE; // outside material
911 if( rPos <= ((abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
912 return kFALSE; // line cut to exclude regions where we do not reconstruct
913 } else if ( fEtaCutMin != -0.1 && rPos >= ((abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
917 if( rNeg <= ((abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
918 return kFALSE; // line cut to exclude regions where we do not reconstruct
919 } else if ( fEtaCutMin != -0.1 && rNeg >= ((abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
924 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
928 ///________________________________________________________________________
929 Bool_t AliConversionCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event)
930 { // Specific Photon Cuts
933 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex);
936 // Fill Histos before Cuts
937 if(hInvMassbefore)hInvMassbefore->Fill(photon->GetMass());
939 if(hArmenterosbefore)hArmenterosbefore->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
941 // Gamma selection based on QT from Armenteros
942 if(fDoQtGammaSelection == kTRUE){
943 if(!ArmenterosQtCut(photon)){
944 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //1
951 if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
953 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //2
959 // Reconstruction Acceptance Cuts
960 if(!AcceptanceCuts(photon)){
961 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //3
967 if(fDoPhotonAsymmetryCut == kTRUE){
968 if(!AsymmetryCut(photon,event)){
969 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //4
974 //Check the pid probability
976 if(!PIDProbabilityCut(photon, event)) {
977 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //5
982 if(!CorrectedTPCClusterCut(photon, event)) {
983 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //6
989 if(!PsiPairCut(photon)) {
990 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //7
995 if(!CosinePAngleCut(photon, event)) {
996 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //8
1001 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
1003 // Histos after Cuts
1004 if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
1005 if(hArmenterosafter)hArmenterosafter->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
1012 ///________________________________________________________________________
1013 Bool_t AliConversionCuts::CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event)
1014 { //Cut on corrected TPC Cluster Info
1016 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1017 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1019 if(!negTrack||!posTrack)return kFALSE;
1021 Double_t negclsToF=0;
1023 if (!fUseCorrectedTPCClsInfo ){
1024 if(negTrack->GetTPCNclsF()!=0){
1025 negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
1028 negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1031 Double_t posclsToF = 0.;
1032 if (!fUseCorrectedTPCClsInfo ){
1033 if(posTrack->GetTPCNclsF()!=0){
1034 posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
1037 posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1040 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
1047 ///________________________________________________________________________
1048 Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent * event)
1050 //Selection of Reconstructed Photons
1052 FillPhotonCutIndex(kPhotonIn);
1054 if(event->IsA()==AliESDEvent::Class()) {
1055 if(!SelectV0Finder( ( ((AliESDEvent*)event)->GetV0(photon->GetV0Index()))->GetOnFlyStatus() ) ){
1056 FillPhotonCutIndex(kOnFly);
1060 // else if(event->IsA()==AliAODEvent::Class()) {
1061 // if(!SelectV0Finder( ( ((AliAODEvent*)event)->GetV0(photon->GetV0Index())) ) ){
1062 // FillPhotonCutIndex(kOnFly);
1068 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1069 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1071 if(!negTrack || !posTrack) {
1072 FillPhotonCutIndex(kNoTracks);
1077 if(!TracksAreSelected(negTrack, posTrack)){
1078 FillPhotonCutIndex(kTrackCuts);
1083 if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
1084 FillPhotonCutIndex(kdEdxCuts);
1089 if(!PhotonCuts(photon,event)){
1090 FillPhotonCutIndex(kPhotonCuts);
1094 // Photon passed cuts
1095 FillPhotonCutIndex(kPhotonOut);
1099 ///________________________________________________________________________
1100 Bool_t AliConversionCuts::ArmenterosQtCut(AliConversionPhotonBase *photon)
1101 { // Armenteros Qt Cut
1103 if(fDoHighPtQtGammaSelection){
1104 if(photon->GetPhotonPt() < fPtBorderForQt){
1105 if(photon->GetArmenterosQt()>fQtMax){
1109 if(photon->GetArmenterosQt()>fHighPtQtMax){
1115 if(photon->GetArmenterosQt()>fQtMax){
1123 ///________________________________________________________________________
1124 Bool_t AliConversionCuts::AcceptanceCuts(AliConversionPhotonBase *photon) {
1125 // Exclude certain areas for photon reconstruction
1128 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1131 if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
1132 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1137 if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
1138 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1143 if(photon->GetConversionRadius() <= ((abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
1144 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1147 else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1148 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1153 if(abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1154 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1160 if( photon->GetPhotonEta() > (fEtaCut + fEtaShift) || photon->GetPhotonEta() < (-fEtaCut + fEtaShift) ){
1161 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1164 if(fEtaCutMin>-0.1){
1165 if( photon->GetPhotonEta() < (fEtaCutMin + fEtaShift) && photon->GetPhotonEta() > (-fEtaCutMin + fEtaShift) ){
1166 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1172 if(photon->GetPhotonPt()<fPtCut){
1173 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1178 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1184 ///________________________________________________________________________
1185 Bool_t AliConversionCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
1186 // Track Cuts which require AOD/ESD specific implementation
1188 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1189 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1194 AliAODVertex * NegVtxType=negTrack->GetProdVertex();
1195 AliAODVertex * PosVtxType=posTrack->GetProdVertex();
1196 if((NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
1197 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1205 ///________________________________________________________________________
1206 Bool_t AliConversionCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
1207 // Track Cuts which require AOD/ESD specific implementation
1209 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1210 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1215 if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
1216 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1224 ///________________________________________________________________________
1225 Bool_t AliConversionCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1226 // Track Selection for Photon Reconstruction
1229 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1233 if(negTrack->Charge() == posTrack->Charge()) {
1234 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1239 // Number of TPC Clusters
1240 if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1241 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1247 if( posTrack->Eta() > (fEtaCut + fEtaShift) || posTrack->Eta() < (-fEtaCut + fEtaShift) ||
1248 negTrack->Eta() > (fEtaCut + fEtaShift) || negTrack->Eta() < (-fEtaCut + fEtaShift) ){
1249 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1252 if(fEtaCutMin>-0.1){
1253 if( (posTrack->Eta() < (fEtaCutMin + fEtaShift) && posTrack->Eta() > (-fEtaCutMin + fEtaShift)) ||
1254 (negTrack->Eta() < (fEtaCutMin + fEtaShift) && negTrack->Eta() > (-fEtaCutMin + fEtaShift)) ){
1255 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1262 if( negTrack->Pt()< fSinglePtCut || posTrack->Pt()< fSinglePtCut){
1263 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1268 // AOD ESD specific cuts
1269 Bool_t passCuts = kTRUE;
1271 if(negTrack->IsA()==AliAODTrack::Class()) {
1272 passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1274 passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1278 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1283 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1289 ///________________________________________________________________________
1290 Bool_t AliConversionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
1291 // Electron Identification Cuts for Photon reconstruction
1293 if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1294 if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1297 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1298 if(hTPCdEdxSigbefore)hTPCdEdxSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1299 if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1303 if(fDodEdxSigmaCut == kTRUE){
1304 // TPC Electron Line
1305 if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1306 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
1308 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1314 if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1315 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1316 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1317 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1319 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1326 if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1327 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1328 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine &&
1329 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1331 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1339 if(fDoKaonRejectionLowP == kTRUE){
1340 if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1341 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1343 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1350 if(fDoProtonRejectionLowP == kTRUE){
1351 if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1352 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1354 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1361 if(fDoPionRejectionLowP == kTRUE){
1362 if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1363 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1365 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1373 // cout<<"Start"<<endl;
1374 // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1376 // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1377 // {cout<<"TOF DA"<<endl;}
1378 // if(status == AliPIDResponse::kDetPidOk){
1379 // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1380 // cout<<"--> "<<probMis<<endl;
1381 // if(probMis > 0.01){
1386 if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1388 Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1390 fCurrentTrack->GetIntegratedTimes(times);
1391 Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1392 Double_t dT = TOFsignal - t0 - times[0];
1393 hTOFbefore->Fill(fCurrentTrack->P(),dT);
1395 if(hTOFSigbefore) hTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1397 if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1398 fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1399 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1403 if(hTOFSigafter)hTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1409 if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1410 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1416 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1417 if(hTPCdEdxSigafter)hTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1418 if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1422 ///________________________________________________________________________
1423 Bool_t AliConversionCuts::AsymmetryCut(AliConversionPhotonBase * photon,AliVEvent *event) {
1424 // Cut on Energy Assymetry
1426 for(Int_t ii=0;ii<2;ii++){
1428 AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1430 if( track->P() > fMinPPhotonAsymmetryCut ){
1431 Double_t trackNegAsy=0;
1432 if (photon->GetPhotonP()!=0.){
1433 trackNegAsy= track->P()/photon->GetPhotonP();
1436 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1445 ///________________________________________________________________________
1446 AliVTrack *AliConversionCuts::GetTrack(AliVEvent * event, Int_t label){
1447 //Returns pointer to the track with given ESD label
1448 //(Important for AOD implementation, since Track array in AOD data is different
1449 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1451 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1453 if(label > event->GetNumberOfTracks() ) return NULL;
1454 AliESDtrack * track = esdEvent->GetTrack(label);
1458 AliVTrack * track = 0x0;
1459 if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->AreAODsRelabeled()){
1460 track = dynamic_cast<AliVTrack*>(event->GetTrack(label));
1464 for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1465 track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1467 if(track->GetID() == label) {
1474 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1478 ///________________________________________________________________________
1479 AliESDtrack *AliConversionCuts::GetESDTrack(AliESDEvent * event, Int_t label){
1480 //Returns pointer to the track with given ESD label
1481 //(Important for AOD implementation, since Track array in AOD data is different
1482 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1485 if(label > event->GetNumberOfTracks() ) return NULL;
1486 AliESDtrack * track = event->GetTrack(label);
1489 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1495 ///________________________________________________________________________
1496 Bool_t AliConversionCuts::PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event){
1497 // Cut on Electron Probability for Photon Reconstruction
1499 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1503 Bool_t iResult=kFALSE;
1505 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1506 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1508 AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1509 AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1511 if(negProbArray && posProbArray){
1513 negTrack->GetTPCpid(negProbArray);
1514 posTrack->GetTPCpid(posProbArray);
1516 if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1521 delete [] posProbArray;
1522 delete [] negProbArray;
1526 ///Not possible for AODs
1536 ///________________________________________________________________________
1537 Bool_t AliConversionCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1538 // MC Acceptance Cuts
1539 //(Certain areas were excluded for photon reconstruction)
1541 if(particle->R()>fMaxR){
1544 if(ePos->R()>fMaxR){
1548 if(ePos->R()<fMinR){
1552 if( ePos->R() <= ((abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1555 else if (fUseEtaMinCut && ePos->R() >= ((abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1559 if(abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1563 if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1567 if(abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1572 if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) ){
1575 if( ePos->Eta() > (fEtaCut + fEtaShift) || ePos->Eta() < (-fEtaCut + fEtaShift) ){
1578 if( eNeg->Eta() > (fEtaCut + fEtaShift) || eNeg->Eta() < (-fEtaCut + fEtaShift) ){
1581 if(fEtaCutMin>-0.1){
1582 if( particle->Eta() < (fEtaCutMin + fEtaShift) && particle->Eta() > (-fEtaCutMin + fEtaShift) ){
1585 if( ePos->Eta() < (fEtaCutMin + fEtaShift) && ePos->Eta() > (-fEtaCutMin + fEtaShift) ){
1588 if( eNeg->Eta() < (fEtaCutMin + fEtaShift) && eNeg->Eta() > (-fEtaCutMin + fEtaShift) ){
1593 if( ePos->Pt()< fSinglePtCut || eNeg->Pt()< fSinglePtCut){
1597 if(particle->Pt()<fPtCut){
1603 ///________________________________________________________________________
1604 Bool_t AliConversionCuts::UpdateCutString() {
1605 ///Update the cut string (if it has been created yet)
1607 if(fCutString && fCutString->GetString().Length() == kNCuts) {
1608 fCutString->SetString(GetCutNumber());
1615 void AliConversionCuts::LoadReweightingHistosMCFromFile() {
1617 AliInfo("Entering loading of histograms for weighting");
1618 TFile *f = TFile::Open(fPathTrFReweighting.Data());
1620 AliError(Form("file for weighting %s not found",fPathTrFReweighting.Data()));
1623 if (fNameHistoReweightingPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
1624 hReweightMCHistPi0 = (TH1D*)f->Get(fNameHistoReweightingPi0.Data());
1625 if (hReweightMCHistPi0) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingPi0.Data(),fPathTrFReweighting.Data() ));
1626 else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameHistoReweightingPi0.Data() ));
1628 if (fNameHistoReweightingEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
1629 hReweightMCHistEta = (TH1D*)f->Get(fNameHistoReweightingEta.Data());
1630 if (hReweightMCHistEta) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
1631 else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameHistoReweightingEta.Data() ));
1634 if (fNameHistoReweightingK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
1635 hReweightMCHistK0s = (TH1D*)f->Get(fNameHistoReweightingK0s.Data());
1636 if (hReweightMCHistK0s) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
1637 else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameHistoReweightingK0s.Data() ));
1644 ///________________________________________________________________________
1645 Bool_t AliConversionCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
1646 // Initialize Cuts from a given Cut string
1647 if(fDoReweightHistoMCPi0 || fDoReweightHistoMCEta || fDoReweightHistoMCK0s) LoadReweightingHistosMCFromFile();
1649 AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1650 if(analysisCutSelection.Length()!=kNCuts) {
1651 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1654 if(!analysisCutSelection.IsDigit()){
1655 AliError("Cut selection contains characters");
1659 const char *cutSelection = analysisCutSelection.Data();
1660 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
1661 for(Int_t ii=0;ii<kNCuts;ii++){
1665 // Set Individual Cuts
1666 for(Int_t ii=0;ii<kNCuts;ii++){
1667 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1674 ///________________________________________________________________________
1675 Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
1676 ///Set individual cut ID
1681 if( SetV0Finder(value)) {
1682 fCuts[kv0FinderType] = value;
1685 } else return kFALSE;
1687 case kededxSigmaCut:
1688 if( SetTPCdEdxCutElectronLine(value)) {
1689 fCuts[kededxSigmaCut] = value;
1692 } else return kFALSE;
1694 case kpidedxSigmaCut:
1695 if( SetTPCdEdxCutPionLine(value)) {
1696 fCuts[kpidedxSigmaCut] = value;
1699 } else return kFALSE;
1701 case kpiMomdedxSigmaCut:
1702 if( SetMinMomPiondEdxCut(value)) {
1703 fCuts[kpiMomdedxSigmaCut] = value;
1706 } else return kFALSE;
1709 if( SetChi2GammaCut(value)) {
1710 fCuts[kchi2GammaCut] = value;
1713 } else return kFALSE;
1716 if( SetSinglePtCut(value)) {
1717 fCuts[ksinglePtCut] = value;
1720 } else return kFALSE;
1723 if( SetTPCClusterCut(value)) {
1724 fCuts[kclsTPCCut] = value;
1727 } else return kFALSE;
1730 if( SetEtaCut(value)) {
1731 fCuts[ketaCut] = value;
1734 } else return kFALSE;
1736 case kLowPRejectionSigmaCut:
1737 if( SetLowPRejectionCuts(value)) {
1738 fCuts[kLowPRejectionSigmaCut] = value;
1741 } else return kFALSE;
1744 if( SetQtMaxCut(value)) {
1745 fCuts[kQtMaxCut] = value;
1748 } else return kFALSE;
1750 case kpiMaxMomdedxSigmaCut:
1751 if( SetMaxMomPiondEdxCut(value)) {
1752 fCuts[kpiMaxMomdedxSigmaCut] = value;
1755 } else return kFALSE;
1758 if( SetRCut(value)) {
1759 fCuts[kRCut] = value;
1762 } else return kFALSE;
1765 if( SetRemovePileUp(value)) {
1766 fCuts[kremovePileUp] = value;
1769 } else return kFALSE;
1772 if( SetSelectSpecialTrigger(value)) {
1773 fCuts[kselectV0AND] = value;
1776 } else return kFALSE;
1778 case kmultiplicityMethod:
1779 if( SetMultiplicityMethod(value)) {
1780 fCuts[kmultiplicityMethod] = value;
1783 } else return kFALSE;
1786 if( SetIsHeavyIon(value)) {
1787 fCuts[kisHeavyIon] = value;
1790 } else return kFALSE;
1792 case kCentralityMin:
1793 if( SetCentralityMin(value)) {
1794 fCuts[kCentralityMin] = value;
1797 } else return kFALSE;
1799 case kCentralityMax:
1800 if( SetCentralityMax(value)) {
1801 fCuts[kCentralityMax] = value;
1804 } else return kFALSE;
1806 case kTOFelectronPID:
1807 if( SetTOFElectronPIDCut(value)) {
1808 fCuts[kTOFelectronPID] = value;
1811 } else return kFALSE;
1813 case kdoPhotonAsymmetryCut:
1814 if( SetPhotonAsymmetryCut(value)) {
1815 fCuts[kdoPhotonAsymmetryCut] = value;
1818 } else return kFALSE;
1821 if( SetPsiPairCut(value)) {
1822 fCuts[kPsiPair] = value;
1825 } else return kFALSE;
1828 if( SetCosPAngleCut(value)) {
1829 fCuts[kCosPAngle] = value;
1832 } else return kFALSE;
1836 if( SetSharedElectronCut(value)) {
1837 fCuts[kElecShare] = value;
1840 } else return kFALSE;
1843 if( SetToCloseV0sCut(value)) {
1844 fCuts[kToCloseV0s] = value;
1847 } else return kFALSE;
1850 if( SetRejectExtraSignalsCut(value)) {
1851 fCuts[kExtraSignals] = value;
1854 } else return kFALSE;
1857 AliError("Cut id out of range");
1861 AliError("Cut id %d not recognized");
1866 ///________________________________________________________________________
1867 void AliConversionCuts::PrintCuts() {
1868 // Print out current Cut Selection
1869 for(Int_t ic = 0; ic < kNCuts; ic++) {
1870 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
1873 ///________________________________________________________________________
1874 Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
1882 fDetectorCentrality=0;
1886 fDetectorCentrality=1;
1888 case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1890 fDetectorCentrality=0;
1891 fModCentralityClass=1;
1893 case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1895 fDetectorCentrality=0;
1896 fModCentralityClass=2;
1898 case 5: //strict cut on v0 tracks for MC
1900 fDetectorCentrality=0;
1901 fModCentralityClass=3;
1903 case 6: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1904 //strict cut on v0 tracks for MC
1906 fDetectorCentrality=0;
1907 fModCentralityClass=4;
1909 case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1910 //strict cut on v0 tracks for MC
1912 fDetectorCentrality=0;
1913 fModCentralityClass=5;
1917 fDetectorCentrality=0;
1921 fDetectorCentrality=1;
1924 AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1930 //___________________________________________________________________
1931 Bool_t AliConversionCuts::SetCentralityMin(Int_t minCentrality)
1934 if(minCentrality<0||minCentrality>9){
1935 AliError(Form("minCentrality not defined %d",minCentrality));
1939 fCentralityMin=minCentrality;
1942 //___________________________________________________________________
1943 Bool_t AliConversionCuts::SetCentralityMax(Int_t maxCentrality)
1946 if(maxCentrality<0||maxCentrality>9){
1947 AliError(Form("maxCentrality not defined %d",maxCentrality));
1950 fCentralityMax=maxCentrality;
1953 ///________________________________________________________________________
1954 Int_t AliConversionCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger)
1957 switch(selectSpecialTrigger){
1959 fSpecialTrigger=0; // dont care
1962 fSpecialTrigger=1; // V0AND
1965 fSpecialTrigger=2; // with SDD requested
1968 fSpecialTrigger=3; // V0AND plus with SDD requested
1970 // allows to run MB & 6 other different trigger classes in parallel with the same photon cut
1972 fSpecialTrigger=4; // different trigger class as MB
1973 fTriggerSelectedManually = kTRUE;
1976 fSpecialTrigger=4; // different trigger class as MB
1977 fTriggerSelectedManually = kTRUE;
1980 fSpecialTrigger=4; // different trigger class as MB
1981 fTriggerSelectedManually = kTRUE;
1984 fSpecialTrigger=4; // different trigger class as MB
1985 fTriggerSelectedManually = kTRUE;
1988 fSpecialTrigger=4; // different trigger class as MB
1989 fTriggerSelectedManually = kTRUE;
1992 fSpecialTrigger=4; // different trigger class as MB
1993 fTriggerSelectedManually = kTRUE;
1996 AliError("Warning: Special Trigger Not known");
2001 ///________________________________________________________________________
2002 Bool_t AliConversionCuts::SetMultiplicityMethod(Int_t multiplicityMethod)
2005 fMultiplicityMethod=multiplicityMethod;
2007 // 0 Photon Multiplicity
2008 // 1 TPC Track multiplicity
2014 ///________________________________________________________________________
2015 Bool_t AliConversionCuts::SetRemovePileUp(Int_t removePileUp)
2017 switch(removePileUp){
2019 fRemovePileUp=kFALSE;
2022 fRemovePileUp=kTRUE;
2025 AliError("RemovePileUpCut not defined");
2030 ///________________________________________________________________________
2031 Bool_t AliConversionCuts::SetRejectExtraSignalsCut(Int_t extraSignal) {
2033 switch(extraSignal){
2035 fRejectExtraSignals = 0;
2036 break; // No Rejection
2038 fRejectExtraSignals = 1;
2039 break; // MinBias Header
2041 fRejectExtraSignals = 2;
2042 break; // User String Array
2044 fRejectExtraSignals = 3;
2045 break; // Rejection for Gamma Correction only
2047 AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
2052 ///________________________________________________________________________
2053 Bool_t AliConversionCuts::SetV0Finder(Int_t v0FinderType)
2055 switch (v0FinderType){
2056 case 0: // on fly V0 finder
2057 cout << "have chosen onfly V0" << endl;
2058 fUseOnFlyV0Finder=kTRUE;
2060 case 1: // offline V0 finder
2061 cout << "have chosen offline V0" << endl;
2062 fUseOnFlyV0Finder=kFALSE;
2065 AliError(Form(" v0FinderType not defined %d",v0FinderType));
2070 ///________________________________________________________________________
2071 Bool_t AliConversionCuts::SetEtaCut(Int_t etaCut)
2074 //Set Standard LineCutZValues
2075 fLineCutZValueMin = -2;
2076 fLineCutZValue = 7.;
2081 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2083 fLineCutZRSlopeMin = 0.;
2085 case 1: // 1.2 // changed from 1.2 to 0.6 on 2013.06.10
2087 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2089 fLineCutZRSlopeMin = 0.;
2093 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2095 fLineCutZRSlopeMin = 0.;
2099 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2101 fLineCutZRSlopeMin = 0.;
2105 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2107 fLineCutZRSlopeMin = 0.;
2111 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2113 fLineCutZRSlopeMin = 0.;
2117 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2119 fLineCutZRSlopeMin = 0.;
2123 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2125 fLineCutZRSlopeMin = 0.;
2127 // case 8: // 0.1 - 0.8
2129 // fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2130 // fEtaCutMin = 0.1;
2131 // fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2135 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2137 fLineCutZRSlopeMin = 0.;
2141 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2143 fLineCutZRSlopeMin = 0.;
2146 AliError(Form(" EtaCut not defined %d",etaCut));
2151 ///________________________________________________________________________
2152 Bool_t AliConversionCuts::SetRCut(Int_t RCut){
2175 // High purity cuts for PbPb (remove first layers of material)
2198 AliError("RCut not defined");
2203 ///________________________________________________________________________
2204 Bool_t AliConversionCuts::SetSinglePtCut(Int_t singlePtCut)
2206 switch(singlePtCut){
2207 case 0: // 0.050 GeV
2208 fSinglePtCut = 0.050;
2210 case 1: // 0.100 GeV
2211 fSinglePtCut = 0.100;
2213 case 2: // 0.150 GeV
2214 fSinglePtCut = 0.150;
2216 case 3: // 0.200 GeV
2217 fSinglePtCut = 0.200;
2219 case 4: // 0.075 GeV
2220 fSinglePtCut = 0.075;
2222 case 5: // 0.125 GeV
2223 fSinglePtCut = 0.125;
2226 fSinglePtCut = 0.040;
2232 AliError(Form("singlePtCut not defined %d",singlePtCut));
2237 ///________________________________________________________________________
2238 Bool_t AliConversionCuts::SetTPCClusterCut(Int_t clsTPCCut)
2253 case 4: // 95% of findable clusters
2254 fMinClsTPCToF= 0.95;
2255 fUseCorrectedTPCClsInfo=1;
2257 case 5: // 0% of findable clusters
2259 fUseCorrectedTPCClsInfo=1;
2261 case 6: // 70% of findable clusters
2263 fUseCorrectedTPCClsInfo=1;
2265 case 7: // 0% of findable clusters
2266 fMinClsTPCToF= 0.35;
2267 fUseCorrectedTPCClsInfo=0;
2270 fMinClsTPCToF= 0.35;
2271 fUseCorrectedTPCClsInfo=1;
2275 fUseCorrectedTPCClsInfo=1;
2278 AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2283 ///________________________________________________________________________
2284 Bool_t AliConversionCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
2286 switch(ededxSigmaCut){
2288 fPIDnSigmaBelowElectronLine=-10;
2289 fPIDnSigmaAboveElectronLine=10;
2292 fPIDnSigmaBelowElectronLine=-5;
2293 fPIDnSigmaAboveElectronLine=5;
2296 fPIDnSigmaBelowElectronLine=-3;
2297 fPIDnSigmaAboveElectronLine=5;
2300 fPIDnSigmaBelowElectronLine=-4;
2301 fPIDnSigmaAboveElectronLine=5;
2304 fPIDnSigmaBelowElectronLine=-6;
2305 fPIDnSigmaAboveElectronLine=7;
2308 fPIDnSigmaBelowElectronLine=-4;
2309 fPIDnSigmaAboveElectronLine=4;
2312 fPIDnSigmaBelowElectronLine=-2.5;
2313 fPIDnSigmaAboveElectronLine=4;
2316 fPIDnSigmaBelowElectronLine=-2;
2317 fPIDnSigmaAboveElectronLine=3.5;
2320 AliError("TPCdEdxCutElectronLine not defined");
2326 ///________________________________________________________________________
2327 Bool_t AliConversionCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
2330 switch(pidedxSigmaCut){
2332 fPIDnSigmaAbovePionLine=-10;
2333 fPIDnSigmaAbovePionLineHighPt=-10;
2336 fPIDnSigmaAbovePionLine=0;
2337 fPIDnSigmaAbovePionLineHighPt=-10;
2340 fPIDnSigmaAbovePionLine=1;
2341 fPIDnSigmaAbovePionLineHighPt=-10;
2344 fPIDnSigmaAbovePionLine=2.5;
2345 fPIDnSigmaAbovePionLineHighPt=-10;
2348 fPIDnSigmaAbovePionLine=0.5;
2349 fPIDnSigmaAbovePionLineHighPt=-10;
2352 fPIDnSigmaAbovePionLine=2.;
2353 fPIDnSigmaAbovePionLineHighPt=-10;
2356 fPIDnSigmaAbovePionLine=2.;
2357 fPIDnSigmaAbovePionLineHighPt=0.5;
2360 fPIDnSigmaAbovePionLine=3.5;
2361 fPIDnSigmaAbovePionLineHighPt=-10;
2364 fPIDnSigmaAbovePionLine=2.;
2365 fPIDnSigmaAbovePionLineHighPt=1.;
2368 fPIDnSigmaAbovePionLine=3.0; // We need a bit less tight cut on dE/dx
2369 fPIDnSigmaAbovePionLineHighPt=-10;
2372 AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2377 ///________________________________________________________________________
2378 Bool_t AliConversionCuts::SetMinMomPiondEdxCut(Int_t piMomdedxSigmaCut)
2380 switch(piMomdedxSigmaCut){
2382 fPIDMinPnSigmaAbovePionLine=0.5;
2385 fPIDMinPnSigmaAbovePionLine=1.;
2388 fPIDMinPnSigmaAbovePionLine=1.5;
2391 fPIDMinPnSigmaAbovePionLine=20.;
2394 fPIDMinPnSigmaAbovePionLine=50.;
2397 fPIDMinPnSigmaAbovePionLine=0.3;
2400 fPIDMinPnSigmaAbovePionLine=0.25;
2403 fPIDMinPnSigmaAbovePionLine=0.4;
2406 fPIDMinPnSigmaAbovePionLine=0.2;
2409 AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2414 ///________________________________________________________________________
2415 Bool_t AliConversionCuts::SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
2417 switch(piMaxMomdedxSigmaCut){
2419 fPIDMaxPnSigmaAbovePionLine=100.;
2422 fPIDMaxPnSigmaAbovePionLine=5.;
2425 fPIDMaxPnSigmaAbovePionLine=4.;
2428 fPIDMaxPnSigmaAbovePionLine=3.5;
2431 fPIDMaxPnSigmaAbovePionLine=3.;
2434 fPIDMaxPnSigmaAbovePionLine=7.;
2437 AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2442 ///________________________________________________________________________
2443 Bool_t AliConversionCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
2445 switch(LowPRejectionSigmaCut){
2447 fPIDnSigmaAtLowPAroundKaonLine=0;
2448 fPIDnSigmaAtLowPAroundProtonLine=0;
2449 fPIDnSigmaAtLowPAroundPionLine=0;
2450 fDoKaonRejectionLowP = kFALSE;
2451 fDoProtonRejectionLowP = kFALSE;
2452 fDoPionRejectionLowP = kFALSE;
2453 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2456 fPIDnSigmaAtLowPAroundKaonLine=0.5;
2457 fPIDnSigmaAtLowPAroundProtonLine=0.5;
2458 fPIDnSigmaAtLowPAroundPionLine=0.5;
2459 fDoKaonRejectionLowP = kTRUE;
2460 fDoProtonRejectionLowP = kTRUE;
2461 fDoPionRejectionLowP = kTRUE;
2462 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2465 fPIDnSigmaAtLowPAroundKaonLine=1;
2466 fPIDnSigmaAtLowPAroundProtonLine=1;
2467 fPIDnSigmaAtLowPAroundPionLine=1;
2468 fDoKaonRejectionLowP = kTRUE;
2469 fDoProtonRejectionLowP = kTRUE;
2470 fDoPionRejectionLowP = kTRUE;
2471 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2474 fPIDnSigmaAtLowPAroundKaonLine=2.;
2475 fPIDnSigmaAtLowPAroundProtonLine=2.;
2476 fPIDnSigmaAtLowPAroundPionLine=2.;
2477 fDoKaonRejectionLowP = kTRUE;
2478 fDoProtonRejectionLowP = kTRUE;
2479 fDoPionRejectionLowP = kTRUE;
2480 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2483 fPIDnSigmaAtLowPAroundKaonLine=0.;
2484 fPIDnSigmaAtLowPAroundProtonLine=0.;
2485 fPIDnSigmaAtLowPAroundPionLine=1;
2486 fDoKaonRejectionLowP = kFALSE;
2487 fDoProtonRejectionLowP = kFALSE;
2488 fDoPionRejectionLowP = kTRUE;
2489 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2492 fPIDnSigmaAtLowPAroundKaonLine=0.;
2493 fPIDnSigmaAtLowPAroundProtonLine=0.;
2494 fPIDnSigmaAtLowPAroundPionLine=1.5;
2495 fDoKaonRejectionLowP = kFALSE;
2496 fDoProtonRejectionLowP = kFALSE;
2497 fDoPionRejectionLowP = kTRUE;
2498 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2501 fPIDnSigmaAtLowPAroundKaonLine=0.;
2502 fPIDnSigmaAtLowPAroundProtonLine=0.;
2503 fPIDnSigmaAtLowPAroundPionLine=2.;
2504 fDoKaonRejectionLowP = kFALSE;
2505 fDoProtonRejectionLowP = kFALSE;
2506 fDoPionRejectionLowP = kTRUE;
2507 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2510 fPIDnSigmaAtLowPAroundKaonLine=0.;
2511 fPIDnSigmaAtLowPAroundProtonLine=0.;
2512 fPIDnSigmaAtLowPAroundPionLine=0.5;
2513 fDoKaonRejectionLowP = kFALSE;
2514 fDoProtonRejectionLowP = kFALSE;
2515 fDoPionRejectionLowP = kTRUE;
2516 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2519 AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
2524 ///________________________________________________________________________
2525 Bool_t AliConversionCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
2527 switch(TOFelectronPID){
2529 fUseTOFpid = kFALSE;
2530 fTofPIDnSigmaBelowElectronLine=-100;
2531 fTofPIDnSigmaAboveElectronLine=100;
2535 fTofPIDnSigmaBelowElectronLine=-7;
2536 fTofPIDnSigmaAboveElectronLine=7;
2540 fTofPIDnSigmaBelowElectronLine=-5;
2541 fTofPIDnSigmaAboveElectronLine=5;
2545 fTofPIDnSigmaBelowElectronLine=-3;
2546 fTofPIDnSigmaAboveElectronLine=5;
2550 fTofPIDnSigmaBelowElectronLine=-2;
2551 fTofPIDnSigmaAboveElectronLine=3;
2555 fTofPIDnSigmaBelowElectronLine=-3;
2556 fTofPIDnSigmaAboveElectronLine=3;
2559 AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
2564 ///________________________________________________________________________
2565 Bool_t AliConversionCuts::SetQtMaxCut(Int_t QtMaxCut)
2570 fDoQtGammaSelection=kFALSE;
2571 fDoHighPtQtGammaSelection=kFALSE;
2573 fPtBorderForQt=100.;
2577 fDoHighPtQtGammaSelection=kFALSE;
2579 fPtBorderForQt=100.;
2583 fDoHighPtQtGammaSelection=kFALSE;
2585 fPtBorderForQt=100.;
2589 fDoHighPtQtGammaSelection=kFALSE;
2591 fPtBorderForQt=100.;
2595 fDoHighPtQtGammaSelection=kFALSE;
2597 fPtBorderForQt=100.;
2601 fDoHighPtQtGammaSelection=kFALSE;
2603 fPtBorderForQt=100.;
2607 fDoHighPtQtGammaSelection=kTRUE;
2613 fDoHighPtQtGammaSelection=kFALSE;
2615 fPtBorderForQt=100.;
2618 AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
2623 ///________________________________________________________________________
2624 Bool_t AliConversionCuts::SetChi2GammaCut(Int_t chi2GammaCut)
2627 switch(chi2GammaCut){
2629 fChi2CutConversion = 100.;
2632 fChi2CutConversion = 50.;
2635 fChi2CutConversion = 30.;
2638 fChi2CutConversion = 200.;
2641 fChi2CutConversion = 500.;
2644 fChi2CutConversion = 100000.;
2647 fChi2CutConversion = 5.;
2650 fChi2CutConversion = 10.;
2653 fChi2CutConversion = 20.;
2656 fChi2CutConversion = 15.;
2659 AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
2664 ///________________________________________________________________________
2665 Bool_t AliConversionCuts::SetPsiPairCut(Int_t psiCut) {
2669 fPsiPairCut = 10000; //
2672 fPsiPairCut = 0.1; //
2675 fPsiPairCut = 0.05; // Standard
2678 fPsiPairCut = 0.035; //
2681 fPsiPairCut = 0.15; //
2684 fPsiPairCut = 0.2; //
2687 fPsiPairCut = 0.03; //
2690 fPsiPairCut = 0.025; //
2693 fPsiPairCut = 0.01; //
2696 fPsiPairCut = 0.5; //
2699 AliError(Form("PsiPairCut not defined %d",psiCut));
2705 ///________________________________________________________________________
2706 Bool_t AliConversionCuts::SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut){
2708 switch(doPhotonAsymmetryCut){
2710 fDoPhotonAsymmetryCut=0;
2711 fMinPPhotonAsymmetryCut=100.;
2712 fMinPhotonAsymmetry=0.;
2715 fDoPhotonAsymmetryCut=1;
2716 fMinPPhotonAsymmetryCut=3.5;
2717 fMinPhotonAsymmetry=0.04;
2720 fDoPhotonAsymmetryCut=1;
2721 fMinPPhotonAsymmetryCut=3.5;
2722 fMinPhotonAsymmetry=0.06;
2725 AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
2728 fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
2731 ///________________________________________________________________________
2732 Bool_t AliConversionCuts::SetCosPAngleCut(Int_t cosCut) {
2736 fCosPAngleCut = TMath::Pi(); // -1
2739 fCosPAngleCut = 0.1; // 0.99500
2742 fCosPAngleCut = 0.05; // 0.99875
2745 fCosPAngleCut = 0.025; // 0.99969
2748 fCosPAngleCut = 0.01; // 0.99995
2751 fCosPAngleCut = 0.2; // 0.98007
2754 fCosPAngleCut = 0.5; // 0.87758
2757 fCosPAngleCut = 0.075; // 0.73169
2760 AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
2766 ///________________________________________________________________________
2767 Bool_t AliConversionCuts::SetSharedElectronCut(Int_t sharedElec) {
2771 fDoSharedElecCut = kFALSE;
2774 fDoSharedElecCut = kTRUE;
2777 AliError(Form("Shared Electron Cut not defined %d",sharedElec));
2783 ///________________________________________________________________________
2784 Bool_t AliConversionCuts::SetToCloseV0sCut(Int_t toClose) {
2788 fDoToCloseV0sCut = kFALSE;
2792 fDoToCloseV0sCut = kTRUE;
2796 fDoToCloseV0sCut = kTRUE;
2800 fDoToCloseV0sCut = kTRUE;
2804 AliError(Form("Shared Electron Cut not defined %d",toClose));
2809 ///________________________________________________________________________
2810 Bool_t AliConversionCuts::SetTRDElectronCut(Int_t TRDElectronCut)
2812 switch(TRDElectronCut){
2818 fPIDTRDEfficiency=0.1;
2822 fPIDTRDEfficiency=0.8;
2826 fPIDTRDEfficiency=0.9;
2829 AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
2835 //-------------------------------------------------------------
2836 Double_t AliConversionCuts::GetCentrality(AliVEvent *event)
2837 { // Get Event Centrality
2839 AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
2841 AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
2843 if(fDetectorCentrality==0){
2844 if (fIsHeavyIon==2){
2845 return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
2847 return fESDCentrality->GetCentralityPercentile("V0M"); // default
2850 if(fDetectorCentrality==1){
2851 return fESDCentrality->GetCentralityPercentile("CL1");
2855 AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
2857 if(aodEvent->GetHeader()){return aodEvent->GetHeader()->GetCentrality();}
2862 //-------------------------------------------------------------
2863 Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEvent)
2864 { // Centrality Selection
2865 if(!fIsHeavyIon)return kTRUE;
2867 if(fCentralityMin == 0 && fCentralityMax == 0) return kTRUE;//0-100%
2868 if(fCentralityMin >= fCentralityMax ){
2869 if(fCentralityMax==0 && fModCentralityClass ==0) fCentralityMax=10; //CentralityRange = fCentralityMin-100%
2870 else return kTRUE;//0-100%
2872 Double_t centrality=GetCentrality(event);
2873 if(centrality<0)return kFALSE;
2875 Int_t centralityC=0;
2876 if (fModCentralityClass == 0){
2877 centralityC= Int_t(centrality/10);
2878 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2882 else if (fModCentralityClass ==1){
2883 centralityC= Int_t(centrality);
2884 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2886 } else return kFALSE;
2888 else if (fModCentralityClass ==2){
2889 centralityC= Int_t(centrality);
2890 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2895 // Use strict V0 amplitude cut for MC centrality
2896 Float_t nv0amplitude = event->GetVZEROData()->GetMTotV0A()+event->GetVZEROData()->GetMTotV0C();
2897 Float_t V0Amplitude10[10] = {9999999.0,13670,9345,6209,3944,2352,1272,611,255, 83};
2898 // 0 10 20 30 40 50 60 70 80 90%
2899 Float_t V0Amplitude5a[10] = {9999999.0,16612,13670,11290,9345,7650,6209,4984,3944,3074};
2900 // 0 5 10 15 20 25 30 35 40 45%
2901 Float_t V0Amplitude5b[10] = {3074,2352,1725,1272,899,611,402,255,152,83};
2902 // 45 50 55 60 65 70 75 80 85 90%
2904 if (fModCentralityClass == 3){
2906 if(nv0amplitude > V0Amplitude10[fCentralityMax] && nv0amplitude <= V0Amplitude10[fCentralityMin])
2911 centralityC= Int_t(centrality/10);
2912 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2917 else if (fModCentralityClass ==4){
2919 if(nv0amplitude > V0Amplitude5a[fCentralityMax] && nv0amplitude <= V0Amplitude5a[fCentralityMin])
2924 centralityC= Int_t(centrality);
2925 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2927 } else return kFALSE;
2930 else if (fModCentralityClass ==5){
2932 if(nv0amplitude > V0Amplitude5b[fCentralityMax] && nv0amplitude <= V0Amplitude5b[fCentralityMin])
2937 centralityC= Int_t(centrality);
2938 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2946 ///________________________________________________________________________
2947 Bool_t AliConversionCuts::VertexZCut(AliVEvent *event){
2948 // Cut on z position of primary vertex
2949 Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2951 if(abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2953 if (fIsHeavyIon == 2){
2954 if(fUtils->IsFirstEventInChunk(event)) return kFALSE;
2955 if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
2961 ///________________________________________________________________________
2963 Int_t AliConversionCuts::GetNumberOfContributorsVtx(AliVEvent *event){
2964 // returns number of contributors to the vertex
2966 AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2968 if (fESDEvent->GetPrimaryVertex() != NULL){
2969 if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2970 // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl;
2971 return fESDEvent->GetPrimaryVertex()->GetNContributors();
2975 if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2976 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2977 // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl;
2978 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2980 AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2981 // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2987 AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2989 if (fAODEvent->GetPrimaryVertex() != NULL){
2990 if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2991 return fAODEvent->GetPrimaryVertex()->GetNContributors();
2994 if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2995 if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2996 return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2998 AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
3003 // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
3007 ///________________________________________________________________________
3009 Bool_t AliConversionCuts::IsTriggerSelected(AliVEvent *fInputEvent)
3012 AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
3014 UInt_t isSelected = AliVEvent::kAny;
3015 if (fInputHandler==NULL) return kFALSE;
3016 if( fInputHandler->GetEventSelection() || fInputEvent->IsA()==AliAODEvent::Class()) {
3017 if (!fTriggerSelectedManually){
3018 if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny;
3020 if (fIsHeavyIon == 1) fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
3021 else if (fIsHeavyIon == 2) fOfflineTriggerMask = AliVEvent::kINT7;
3022 else fOfflineTriggerMask = AliVEvent::kMB;
3025 // Get the actual offline trigger mask for the event and AND it with the
3026 // requested mask. If no mask requested select by default the event.
3027 // if (fPreSelCut) cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask for Precut: " << fOfflineTriggerMask << endl;
3028 // else cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask: " << fOfflineTriggerMask << endl;
3030 if (fOfflineTriggerMask)
3031 isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
3033 fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
3037 if (fIsSDDFired) hTriggerClass->Fill(33);
3038 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
3039 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
3040 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
3041 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
3042 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
3043 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
3044 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
3045 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
3046 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
3047 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
3048 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
3049 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
3050 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
3051 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
3052 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
3053 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
3054 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
3055 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
3056 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
3057 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
3058 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
3059 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
3060 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
3061 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
3062 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
3063 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
3064 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
3065 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
3066 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
3067 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
3068 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
3069 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
3070 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
3071 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
3072 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
3073 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
3074 if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28);
3075 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29);
3076 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(30);
3077 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(31);
3078 if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(34);
3081 if(hTriggerClassSelected && isSelected){
3082 if (!fIsSDDFired) hTriggerClassSelected->Fill(33);
3083 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
3084 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
3085 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
3086 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
3087 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
3088 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
3089 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
3090 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
3091 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
3092 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
3093 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
3094 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
3095 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
3096 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
3097 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
3098 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
3099 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
3100 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
3101 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
3102 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
3103 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
3104 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
3105 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
3106 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
3107 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
3108 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
3109 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
3110 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
3111 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
3112 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
3113 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
3114 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
3115 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
3116 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
3117 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
3118 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
3119 if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28);
3120 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29);
3121 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30);
3122 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31);
3125 if(!isSelected)return kFALSE;
3131 ///________________________________________________________________________
3132 Int_t AliConversionCuts::GetFirstTPCRow(Double_t radius){
3133 // Get first TPC row
3134 Int_t firstTPCRow = 0;
3135 Double_t radiusI = 84.8;
3136 Double_t radiusO = 134.6;
3137 Double_t radiusOB = 198.;
3138 Double_t rSizeI = 0.75;
3139 Double_t rSizeO = 1.;
3140 Double_t rSizeOB = 1.5;
3144 if(radius <= radiusI){
3147 if(radius>radiusI && radius<=radiusO){
3148 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
3150 if(radius>radiusO && radius<=radiusOB){
3151 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
3154 if(radius>radiusOB){
3155 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
3161 Bool_t AliConversionCuts::CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const {
3162 ///Check if passes cosine of pointing angle cut
3163 if(GetCosineOfPointingAngle(photon, event) < (TMath::Cos(fCosPAngleCut))){
3169 Double_t AliConversionCuts::GetCosineOfPointingAngle( const AliConversionPhotonBase * photon, AliVEvent * event) const{
3170 // calculates the pointing angle of the recalculated V0
3172 Double_t momV0[3] = {0,0,0};
3173 if(event->IsA()==AliESDEvent::Class()){
3174 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
3175 if(!esdEvent) return -999;
3176 AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
3177 if(!v0) return -999;
3178 v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
3180 if(event->IsA()==AliAODEvent::Class()){
3181 momV0[0] = photon->GetPx();
3182 momV0[1] = photon->GetPy();
3183 momV0[2] = photon->GetPz();
3186 //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
3187 Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
3188 photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
3189 photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
3191 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
3192 Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
3195 Double_t cosinePointingAngle = -999;
3196 if(momV02*PosV02 > 0.0)
3197 cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
3199 return cosinePointingAngle;
3202 ///________________________________________________________________________
3203 Bool_t AliConversionCuts::PsiPairCut(const AliConversionPhotonBase * photon) const {
3205 if(photon->GetPsiPair() > fPsiPairCut){
3211 ///________________________________________________________________________
3212 TString AliConversionCuts::GetCutNumber(){
3213 // returns TString with current cut number
3215 for(Int_t ii=0;ii<kNCuts;ii++){
3216 a.Append(Form("%d",fCuts[ii]));
3221 ///________________________________________________________________________
3222 void AliConversionCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
3224 Int_t posLabel = photon->GetTrackLabelPositive();
3225 Int_t negLabel = photon->GetTrackLabelNegative();
3227 fElectronLabelArray[nV0*2] = posLabel;
3228 fElectronLabelArray[(nV0*2)+1] = negLabel;
3230 ///________________________________________________________________________
3231 Bool_t AliConversionCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
3233 Int_t posLabel = photon->GetTrackLabelPositive();
3234 Int_t negLabel = photon->GetTrackLabelNegative();
3236 for(Int_t i = 0; i<nV0s*2;i++){
3237 if(i==nV0*2) continue;
3238 if(i==(nV0*2)+1) continue;
3239 if(fElectronLabelArray[i] == posLabel){
3241 if(fElectronLabelArray[i] == negLabel){
3247 ///________________________________________________________________________
3248 Bool_t AliConversionCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
3251 Double_t posX = photon->GetConversionX();
3252 Double_t posY = photon->GetConversionY();
3253 Double_t posZ = photon->GetConversionZ();
3255 for(Int_t i = 0;i<photons->GetEntries();i++){
3256 if(nV0 == i) continue;
3257 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
3258 Double_t posCompX = photonComp->GetConversionX();
3259 Double_t posCompY = photonComp->GetConversionY();
3260 Double_t posCompZ = photonComp->GetConversionZ();
3262 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
3264 if(dist < fminV0Dist*fminV0Dist){
3265 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
3273 ///________________________________________________________________________
3274 void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent){
3276 if(fNotRejectedStart){
3277 delete[] fNotRejectedStart;
3278 fNotRejectedStart = NULL;
3280 if(fNotRejectedEnd){
3281 delete[] fNotRejectedEnd;
3282 fNotRejectedEnd = NULL;
3284 if(fGeneratorNames){
3285 delete[] fGeneratorNames;
3286 fGeneratorNames = NULL;
3289 if(rejection == 0) return; // No Rejection
3291 AliGenCocktailEventHeader *cHeader = 0x0;
3292 AliAODMCHeader *cHeaderAOD = 0x0;
3293 Bool_t headerFound = kFALSE;
3295 if(MCEvent->IsA()==AliMCEvent::Class()){
3296 cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3297 if(cHeader) headerFound = kTRUE;
3299 if(MCEvent->IsA()==AliAODEvent::Class()){
3300 cHeaderAOD = dynamic_cast<AliAODMCHeader*>(MCEvent->FindListObject(AliAODMCHeader::StdBranchName()));
3301 if(cHeaderAOD) headerFound = kTRUE;
3305 TList *genHeaders = 0x0;
3306 if(cHeader) genHeaders = cHeader->GetHeaders();
3308 genHeaders = cHeaderAOD->GetCocktailHeaders();
3309 if(genHeaders->GetEntries()==1){
3310 SetRejectExtraSignalsCut(0);
3314 AliGenEventHeader* gh = 0;
3316 if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
3317 if(rejection == 2){ // TList of Headers Names
3318 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3319 gh = (AliGenEventHeader*)genHeaders->At(i);
3320 TString GeneratorName = gh->GetName();
3321 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3322 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3323 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3331 fNotRejectedStart = new Int_t[fnHeaders];
3332 fNotRejectedEnd = new Int_t[fnHeaders];
3333 fGeneratorNames = new TString[fnHeaders];
3335 if(rejection == 1 || rejection == 3){
3336 fNotRejectedStart[0] = 0;
3337 fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
3338 fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
3342 Int_t firstindex = 0;
3343 Int_t lastindex = -1;
3345 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3346 gh = (AliGenEventHeader*)genHeaders->At(i);
3347 TString GeneratorName = gh->GetName();
3348 lastindex = lastindex + gh->NProduced();
3349 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3350 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3351 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3352 fNotRejectedStart[nummer] = firstindex;
3353 fNotRejectedEnd[nummer] = lastindex;
3354 fGeneratorNames[nummer] = GeneratorName;
3355 // cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3360 firstindex = firstindex + gh->NProduced();
3362 } else { // No Cocktail Header Found
3363 fNotRejectedStart = new Int_t[1];
3364 fNotRejectedEnd = new Int_t[1];
3367 fNotRejectedStart[0] = 0;
3368 fNotRejectedEnd[0] = static_cast<AliMCEvent*>(MCEvent)->Stack()->GetNprimary()-1;
3369 // if(rejection == 2){
3370 fGeneratorNames = new TString[1];
3371 fGeneratorNames[0] = "NoCocktailGeneratorFound";
3374 AliGenPythiaEventHeader *mcHeaderPythia = dynamic_cast<AliGenPythiaEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3375 if (mcHeaderPythia) fGeneratorNames[0] = "NoCocktailGeneratorFound_Pythia";
3376 AliGenDPMjetEventHeader *mcHeaderPhojet = dynamic_cast<AliGenDPMjetEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3377 if (mcHeaderPhojet) fGeneratorNames[0] = "NoCocktailGeneratorFound_Phojet";
3378 AliGenHijingEventHeader *mcHeaderHijing = dynamic_cast<AliGenHijingEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3379 if (mcHeaderHijing) fGeneratorNames[0] = "NoCocktailGeneratorFound_Hijing";
3381 SetRejectExtraSignalsCut(0);
3385 //_________________________________________________________________________
3386 Int_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack, AliVEvent *InputEvent){
3388 // Not Accepted == kFALSE == 0
3389 // Accepted == kTRUE == 1
3390 // FirstHeader == kTRUE == 3
3391 if(index < 0) return 0; // No Particle
3394 if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
3395 if( index >= MCStack->GetNprimary()){ // Secondary Particle
3396 if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother??
3397 return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack,InputEvent);
3399 for(Int_t i = 0;i<fnHeaders;i++){
3400 if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3402 if(i == 0) accepted = 2; // MB Header
3406 else if(InputEvent->IsA()==AliAODEvent::Class()){
3407 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3408 AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3409 if(!aodMCParticle->IsPrimary()){
3410 if( aodMCParticle->GetMother() < 0) return 1;// Secondary Particle without Mother??
3411 return IsParticleFromBGEvent(aodMCParticle->GetMother(),MCStack,InputEvent);
3413 index = abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
3414 for(Int_t i = 0;i<fnHeaders;i++){
3415 if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3417 if(i == 0) accepted = 2; // MB Header
3424 //_________________________________________________________________________
3425 Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Bool_t isHeavyIon){
3427 if ( !IsTriggerSelected(InputEvent) )
3430 if(isHeavyIon && !(IsCentralitySelected(InputEvent,MCEvent)))
3431 return 1; // Check Centrality --> Not Accepted => eventQuality = 1
3433 if(!isHeavyIon && GetIsFromPileup()){
3434 if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
3436 return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3440 Bool_t hasV0And = ReaderCuts->HasV0AND();
3441 Bool_t isSDDFired = ReaderCuts->IsSDDFired();
3442 if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent)
3443 return 7; // With SDD requested but no fired
3445 if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
3446 return 8; // V0AND requested but no fired
3451 //_________________________________________________________________________
3452 Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliStack *MCStack, AliVEvent *InputEvent){
3453 if (!(period.CompareTo("LHC12f1a") == 0 || period.CompareTo("LHC12f1b") == 0 || period.CompareTo("LHC12i3") == 0 || period.CompareTo("LHC11a10a") == 0 || period.CompareTo("LHC11a10b") == 0 || period.CompareTo("LHC11a10b_bis") == 0 || period.CompareTo("LHC11a10a_bis") == 0 || period.CompareTo("LHC11a10b_plus") == 0 || period.CompareTo("LHC13d2") == 0)) return 1.;
3456 for (Int_t i = 0; i < fnHeaders; i++){
3457 if (index >= fNotRejectedStart[i] && index < fNotRejectedEnd[i]+1){
3458 if (fGeneratorNames[i].CompareTo("Pythia") == 0){
3460 } else if (fGeneratorNames[i].CompareTo("DPMJET") == 0){
3462 } else if (fGeneratorNames[i].CompareTo("HIJING") == 0 ||
3463 fGeneratorNames[i].CompareTo("Hijing") == 0 ||
3464 fGeneratorNames[i].Contains("hijing")){
3466 } else if (fGeneratorNames[i].CompareTo("BOX") == 0){
3468 } else if (fGeneratorNames[i].CompareTo("PARAM") == 0){
3470 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound") == 0){
3472 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Pythia") == 0){
3474 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Phojet") == 0){
3476 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Hijing") == 0){
3481 if (kCaseGen == 0) return 1;
3484 Double_t mesonPt = 0;
3485 Double_t mesonMass = 0;
3487 if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
3488 mesonPt = ((TParticle*)MCStack->Particle(index))->Pt();
3489 mesonMass = ((TParticle*)MCStack->Particle(index))->GetCalcMass();
3490 PDGCode = ((TParticle*)MCStack->Particle(index))->GetPdgCode();
3492 else if(InputEvent->IsA()==AliAODEvent::Class()){
3493 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3494 AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3495 mesonPt = aodMCParticle->Pt();
3496 mesonMass = aodMCParticle->GetCalcMass();
3497 PDGCode = aodMCParticle->GetPdgCode();
3500 Float_t functionResultMC = 1.;
3501 if (kCaseGen == 1){ // Pythia 6
3502 Float_t dNdyMC = 2.1462;
3503 Float_t nMC = 7.06055;
3504 Float_t tMC = 0.12533;
3505 if ( PDGCode == 111){
3509 } else if ( PDGCode == 221){
3514 functionResultMC = dNdyMC / ( 2 * TMath::Pi())*(nMC-1.)*(nMC-2.) / (nMC*tMC*(nMC*tMC+mesonMass*(nMC-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nMC*tMC), -nMC);
3515 } else if (kCaseGen == 2){ // Phojet
3516 Float_t dNdyMC = 2.35978;
3517 Float_t nMC = 6.81795;
3518 Float_t tMC = 0.11492;
3519 if ( PDGCode == 111){
3523 } else if ( PDGCode == 221){
3528 functionResultMC = dNdyMC / ( 2 * TMath::Pi())*(nMC-1.)*(nMC-2.) / (nMC*tMC*(nMC*tMC+mesonMass*(nMC-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nMC*tMC), -nMC);
3529 } else if (kCaseGen == 4){ // BOX generators pp
3530 // functionResultMC = 1./sqrt(1.-mesonMass*mesonMass/((mesonMass*mesonMass+mesonPt*mesonPt)*cosh(mesonY)*cosh(mesonY)));
3531 Float_t a = 0.23437;
3533 Float_t c = -1430.5863;
3534 Float_t d = -0.6966624;
3535 Float_t e = 252.3742;
3536 if ( PDGCode == 111){
3542 } else if ( PDGCode == 221){
3549 functionResultMC = a*TMath::Power(mesonPt,-1.*(b+c/(TMath::Power(mesonPt,d)+e)))*1./mesonPt *1./1.6 *1./(2.* TMath::Pi());
3550 } else if (kCaseGen == 3 ){ // HIJING
3551 if ( PDGCode == 111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){
3552 functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt);
3554 if ( PDGCode == 310 && fDoReweightHistoMCK0s && hReweightMCHistK0s!= 0x0){
3555 functionResultMC = hReweightMCHistK0s->Interpolate(mesonPt);
3559 Float_t functionResultData = 1;
3560 if (kCaseGen == 1 || kCaseGen == 2 || kCaseGen == 4 ){
3561 Float_t dNdyData = 2.2328;
3562 Float_t nData = 7.1473;
3563 Float_t tData = 0.1346;
3564 if ( PDGCode == 111){
3568 } else if ( PDGCode == 221){
3569 dNdyData = 0.38992; //be careful this fit is not optimal, eta in data still has problems
3573 functionResultData = dNdyData / ( 2 * TMath::Pi())*(nData-1.)*(nData-2.) / (nData*tData*(nData*tData+mesonMass*(nData-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nData*tData), -nData);
3580 if ( PDGCode == 111 ){
3581 if (fModCentralityClass == 1 && fCentralityMin == 0 && fCentralityMax == 1 ){ // 0-5 % PbPb
3587 } else if (fModCentralityClass == 1 && fCentralityMin == 1 && fCentralityMax == 2){ // 5-10% PbPb
3593 } else if (fModCentralityClass == 0 && fCentralityMin == 0 && fCentralityMax == 1){ // 0-10% PbPb
3599 } else if (fModCentralityClass == 0 && fCentralityMin == 1 && fCentralityMax == 2){ // 10-20% PbPb
3605 } else if (fModCentralityClass == 0 && fCentralityMin == 2 && fCentralityMax == 4){ // 20-40% PbPb
3611 } else if (fModCentralityClass == 0 && fCentralityMin == 4 && fCentralityMax == 6){ // 40-60% PbPb
3617 } else if (fModCentralityClass == 0 && fCentralityMin == 6 && fCentralityMax == 8){ // 60-80% PbPb
3623 } else if (fModCentralityClass == 0 && fCentralityMin == 0 && fCentralityMax == 2){ // 0-20% PbPb
3629 } else if (fModCentralityClass == 0 && fCentralityMin == 0 && fCentralityMax == 4){ // 0-40% PbPb
3635 } else if (fModCentralityClass == 0 && fCentralityMin == 0 && fCentralityMax == 8){ // 0-80% PbPb
3641 } else if (fModCentralityClass == 0 && fCentralityMin == 4 && fCentralityMax == 8){ // 60-80% PbPb
3649 functionResultData = a*TMath::Power(mesonPt,-1*(b+c/(TMath::Power(mesonPt,d)+e)));
3654 Double_t weight = 1;
3655 if (PDGCode == 111 || PDGCode == 221){
3656 if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){
3657 weight = functionResultData/functionResultMC;
3658 if ( !(kCaseGen == 3 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode == 111)){
3661 if (!isfinite(functionResultData)) weight = 1.;
3662 if (!isfinite(weight)) weight = 1.;
3664 } else if (PDGCode == 310 && functionResultMC != 0 && isfinite(functionResultMC)){
3665 weight = functionResultMC;
3668 // if (fModCentralityClass == 0 && fCentralityMin == 4 && fCentralityMax == 6 && PDGCode == 111){
3669 // cout << period.Data() << "\t" << kCaseGen << "\t" <<fModCentralityClass<< "\t" <<fCentralityMin<< "\t" <<fCentralityMax << "\t" << mesonPt << "\t" <<mesonMass<< "\t"<<functionResultData << "\t"<< functionResultMC << "\t" << weight <<endl;
3673 ///________________________________________________________________________
3674 AliConversionCuts* AliConversionCuts::GetStandardCuts2010PbPb(){
3675 //Create and return standard 2010 PbPb cuts
3676 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
3677 if(!cuts->InitializeCutsFromCutString("1000002042092970023220000")){
3678 cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
3682 ///________________________________________________________________________
3683 AliConversionCuts* AliConversionCuts::GetStandardCuts2010pp(){
3684 //Create and return standard 2010 PbPb cuts
3685 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010pp","StandardCuts2010pp");
3686 if(!cuts->InitializeCutsFromCutString("0000011002093663003800000")){
3687 cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
3690 ///________________________________________________________________________
3691 void AliConversionCuts::GetCorrectEtaShiftFromPeriod(TString periodName){
3693 if(periodName.CompareTo("LHC12g") == 0 || //pilot run 2012
3694 periodName.CompareTo("LHC13b") == 0 || //mainly minimum bias
3695 periodName.CompareTo("LHC13c") == 0 || //mainly minimum bias
3696 periodName.CompareTo("LHC13d") == 0 || //mainly triggered
3697 periodName.CompareTo("LHC13e") == 0 || //mainly triggered
3698 periodName.CompareTo("LHC13c3") == 0 || //MC Starlight, anchor LHC13d+e
3699 periodName.CompareTo("LHC13c2") == 0 || //MC Starlight, coherent J/Psi, UPC muon anchor LHC13d+e
3700 periodName.CompareTo("LHC13b4") == 0 || //MC Pythia 6 (Jet-Jet), anchor LHC13b
3701 periodName.CompareTo("LHC13b2_fix_1") == 0 || //MC DPMJET, anchr LHC13b+c
3702 periodName.CompareTo("LHC13b3") == 0 || //MC HIJING, weighted to number of events per run, anchor LHC13b
3703 periodName.CompareTo("LHC13b2") == 0 || // MC DPMJET, wrong energy, anchor LHC13b
3704 periodName.CompareTo("LHC13b2_plus") == 0 || // MC DPMJET, weighted to number event per run, anchor LHC13b
3705 periodName.CompareTo("LHC13c1_bis") == 0 || // MC AMPT fast generation, pT hardbin, anchor ?
3706 periodName.CompareTo("LHC13c1") == 0 || // MC AMPT fast generation, anchor ?
3707 periodName.CompareTo("LHC13b1") == 0 || // MC DPMJET, fragments, with fixed label 0, anchor LHC12g
3708 periodName.CompareTo("LHC12g4b_fix") == 0 || // MC DPMJET, with fixed label 0, anchor LHC12g
3709 periodName.CompareTo("LHC12g1_fix") == 0 || // MC ?, with fixed label 0, anchor LHC12g
3710 periodName.CompareTo("LHC12g4c") == 0 || // MC DPMJET, shifted vertex runs, anchor LHC12g
3711 periodName.CompareTo("LHC12h6") == 0 || // MC muon cocktail, anchor LHC12g
3712 periodName.CompareTo("LHC12g4b") == 0 || // MC DPMJET 3rd iteration, anchor LHC12g
3713 periodName.CompareTo("LHC12g4a") == 0 || // MC DPMJET improved, anchor LHC12g
3714 periodName.CompareTo("LHC12g4") == 0 || // MC DPMJET, anchor LHC12g
3715 periodName.CompareTo("LHC12g5") == 0 || // MC PHOJET, anchor LHC12g
3716 periodName.CompareTo("LHC12g2") == 0 || // MC Starlight background, anchor LHC12g
3717 periodName.CompareTo("LHC12g1") == 0 ) // MC ?, anchor LHC12g
3719 printf(" Gamma Conversion Cuts %s :: pPb Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),-0.465);
3720 SetEtaShift(-0.465);
3722 else if(periodName.CompareTo("LHC13f") == 0 ||
3723 periodName.CompareTo("LHC13c6b") == 0 ||// MC Jpsi -> mumu, anchor LHC13f
3724 periodName.CompareTo("LHC13c5") == 0 || //MC Starlight, gamma gamma UPC muon, anchor LHC13f
3725 periodName.CompareTo("LHC13c4") == 0 )//MC Starlight, coherent JPsi, UPC muon, anchor LHC13f
3727 printf(" Gamma Conversion Cuts %s :: Pbp Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),0.465);
3728 SetEtaShift(+0.465);
3730 else printf(" Gamma Conversion Cuts %s :: Automatic Eta Shift requested but Period is not known -> No Shift \n\n",(GetCutNumber()).Data());