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"
37 #include "AliAODConversionMother.h"
38 #include "TObjString.h"
39 #include "AliAODEvent.h"
40 #include "AliESDEvent.h"
41 #include "AliCentrality.h"
45 #include "AliGenCocktailEventHeader.h"
46 #include "AliGenDPMjetEventHeader.h"
47 #include "AliGenPythiaEventHeader.h"
48 #include "AliGenHijingEventHeader.h"
49 #include "AliTriggerAnalysis.h"
50 #include "AliV0ReaderV1.h"
51 #include "AliAODMCParticle.h"
52 #include "AliAODMCHeader.h"
58 ClassImp(AliConversionCuts)
61 const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
66 "MultiplicityMethod",//4
68 "RejectExtraSignals",//6
76 "piMomdedxSigmaCut",//14
77 "piMaxMomdedxSigmaCut",//15
78 "LowPRejectionSigmaCut",//16
83 "DoPhotonAsymmetryCut",//21
84 "CosinePointingAngle", //22
85 "SharedElectronCuts", //23
86 "RejectToCloseV0s", //24
93 //________________________________________________________________________
94 AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
95 AliAnalysisCuts(name,title),
111 fLineCutZRSlopeMin(0.),
112 fLineCutZValueMin(0),
113 fChi2CutConversion(1000),
114 fPIDProbabilityCutNegativeParticle(0),
115 fPIDProbabilityCutPositiveParticle(0),
116 fDodEdxSigmaCut(kTRUE),
117 fDoTOFsigmaCut(kFALSE),
118 fPIDTRDEfficiency(1),
120 fPIDnSigmaAboveElectronLine(100),
121 fPIDnSigmaBelowElectronLine(-100),
122 fTofPIDnSigmaAboveElectronLine(100),
123 fTofPIDnSigmaBelowElectronLine(-100),
124 fPIDnSigmaAbovePionLine(0),
125 fPIDnSigmaAbovePionLineHighPt(-100),
126 fPIDMinPnSigmaAbovePionLine(0),
127 fPIDMaxPnSigmaAbovePionLine(0),
128 fDoKaonRejectionLowP(kFALSE),
129 fDoProtonRejectionLowP(kFALSE),
130 fDoPionRejectionLowP(kFALSE),
131 fPIDnSigmaAtLowPAroundKaonLine(0),
132 fPIDnSigmaAtLowPAroundProtonLine(0),
133 fPIDnSigmaAtLowPAroundPionLine(0),
134 fPIDMinPKaonRejectionLowP(1.5),
135 fPIDMinPProtonRejectionLowP(2),
136 fPIDMinPPionRejectionLowP(0),
137 fDoQtGammaSelection(kTRUE),
138 fDoHighPtQtGammaSelection(kFALSE),
146 fUseEtaMinCut(kFALSE),
147 fUseOnFlyV0Finder(kTRUE),
148 fDoPhotonAsymmetryCut(kTRUE),
149 fMinPPhotonAsymmetryCut(100.),
150 fMinPhotonAsymmetry(0.),
152 fDetectorCentrality(0),
153 fModCentralityClass(0),
157 fUseCorrectedTPCClsInfo(kFALSE),
159 fMultiplicityMethod(0),
161 fRemovePileUp(kFALSE),
162 fOpeningAngle(0.005),
164 fPsiPairDeltaPhiCut(10000),
165 fDo2DPsiPair(kFALSE),
166 fCosPAngleCut(10000),
167 fDoToCloseV0sCut(kFALSE),
168 fRejectExtraSignals(0),
170 fDoSharedElecCut(kFALSE),
171 fOfflineTriggerMask(0),
175 fElectronArraySize(500),
176 fElectronLabelArray(NULL),
177 fDCAZPrimVtxCut(1000),
178 fDCARPrimVtxCut(1000),
179 fInPlaneOutOfPlane(0),
180 fConversionPointXArray(0.0),
181 fConversionPointYArray(0.0),
182 fConversionPointZArray(0.0),
184 fNotRejectedStart(NULL),
185 fNotRejectedEnd(NULL),
186 fGeneratorNames(NULL),
191 fDoReweightHistoMCPi0(kFALSE),
192 fDoReweightHistoMCEta(kFALSE),
193 fDoReweightHistoMCK0s(kFALSE),
194 fPathTrFReweighting(""),
195 fNameHistoReweightingPi0(""),
196 fNameHistoReweightingEta(""),
197 fNameHistoReweightingK0s(""),
202 hTPCdEdxbefore(NULL),
204 hTPCdEdxSigbefore(NULL),
205 hTPCdEdxSigafter(NULL),
209 hPsiPairDeltaPhiafter(NULL),
212 hInvMassbefore(NULL),
213 hArmenterosbefore(NULL),
215 hArmenterosafter(NULL),
216 hAcceptanceCuts(NULL),
220 hCentralityVsNumberOfPrimaryTracks(NULL),
222 hEventPlanePhi(NULL),
224 hTriggerClassSelected(NULL),
225 hReweightMCHistPi0(NULL),
226 hReweightMCHistEta(NULL),
227 hReweightMCHistK0s(NULL),
232 fTriggerSelectedManually(kFALSE),
233 fSpecialTriggerName("")
237 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
238 fCutString=new TObjString((GetCutNumber()).Data());
240 fElectronLabelArray = new Int_t[fElectronArraySize];
241 fUtils = new AliAnalysisUtils();
242 //if you do not want to apply the cut on the distance between the SPD and TRK vertex:
243 //fUtils->SetCutOnZVertexSPD(kFALSE);
248 //________________________________________________________________________
249 AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
250 AliAnalysisCuts(ref),
252 fHeaderList(ref.fHeaderList),
254 fEventQuality(ref.fEventQuality),
257 fEtaCut(ref.fEtaCut),
258 fEtaCutMin(ref.fEtaCutMin),
260 fSinglePtCut(ref.fSinglePtCut),
262 fMinClsTPC(ref.fMinClsTPC),
263 fMinClsTPCToF(ref.fMinClsTPCToF),
264 fLineCutZRSlope(ref.fLineCutZRSlope),
265 fLineCutZValue(ref.fLineCutZValue),
266 fLineCutZRSlopeMin(ref.fLineCutZRSlopeMin),
267 fLineCutZValueMin(ref.fLineCutZValueMin),
268 fChi2CutConversion(ref.fChi2CutConversion),
269 fPIDProbabilityCutNegativeParticle(ref.fPIDProbabilityCutNegativeParticle),
270 fPIDProbabilityCutPositiveParticle(ref.fPIDProbabilityCutPositiveParticle),
271 fDodEdxSigmaCut(ref. fDodEdxSigmaCut),
272 fDoTOFsigmaCut(ref.fDoTOFsigmaCut),
273 fPIDTRDEfficiency(ref.fPIDTRDEfficiency),
274 fDoTRDPID(ref.fDoTRDPID),
275 fPIDnSigmaAboveElectronLine(ref.fPIDnSigmaAboveElectronLine),
276 fPIDnSigmaBelowElectronLine(ref.fPIDnSigmaBelowElectronLine),
277 fTofPIDnSigmaAboveElectronLine(ref.fTofPIDnSigmaAboveElectronLine),
278 fTofPIDnSigmaBelowElectronLine(ref.fTofPIDnSigmaBelowElectronLine),
279 fPIDnSigmaAbovePionLine(ref.fPIDnSigmaAbovePionLine),
280 fPIDnSigmaAbovePionLineHighPt(ref.fPIDnSigmaAbovePionLineHighPt),
281 fPIDMinPnSigmaAbovePionLine(ref.fPIDMinPnSigmaAbovePionLine),
282 fPIDMaxPnSigmaAbovePionLine(ref.fPIDMaxPnSigmaAbovePionLine),
283 fDoKaonRejectionLowP(ref.fDoKaonRejectionLowP),
284 fDoProtonRejectionLowP(ref.fDoProtonRejectionLowP),
285 fDoPionRejectionLowP(ref.fDoPionRejectionLowP),
286 fPIDnSigmaAtLowPAroundKaonLine(ref.fPIDnSigmaAtLowPAroundKaonLine),
287 fPIDnSigmaAtLowPAroundProtonLine(ref.fPIDnSigmaAtLowPAroundProtonLine),
288 fPIDnSigmaAtLowPAroundPionLine(ref.fPIDnSigmaAtLowPAroundPionLine),
289 fPIDMinPKaonRejectionLowP(ref.fPIDMinPKaonRejectionLowP),
290 fPIDMinPProtonRejectionLowP(ref.fPIDMinPProtonRejectionLowP),
291 fPIDMinPPionRejectionLowP(ref.fPIDMinPPionRejectionLowP),
292 fDoQtGammaSelection(ref.fDoQtGammaSelection),
293 fDoHighPtQtGammaSelection(ref.fDoHighPtQtGammaSelection),
295 fHighPtQtMax(ref.fHighPtQtMax),
296 fPtBorderForQt(ref.fPtBorderForQt),
297 fXVertexCut(ref.fXVertexCut),
298 fYVertexCut(ref.fYVertexCut),
299 fZVertexCut(ref.fZVertexCut),
300 fNSigmaMass(ref.fNSigmaMass),
301 fUseEtaMinCut(ref.fUseEtaMinCut),
302 fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
303 fDoPhotonAsymmetryCut(ref.fDoPhotonAsymmetryCut),
304 fMinPPhotonAsymmetryCut(ref.fMinPPhotonAsymmetryCut),
305 fMinPhotonAsymmetry(ref.fMinPhotonAsymmetry),
306 fIsHeavyIon(ref.fIsHeavyIon),
307 fDetectorCentrality(ref.fDetectorCentrality),
308 fModCentralityClass(ref.fModCentralityClass),
309 fMaxVertexZ(ref.fMaxVertexZ),
310 fCentralityMin(ref.fCentralityMin),
311 fCentralityMax(ref.fCentralityMax),
312 fUseCorrectedTPCClsInfo(ref.fUseCorrectedTPCClsInfo),
313 fUseTOFpid(ref.fUseTOFpid),
314 fMultiplicityMethod(ref.fMultiplicityMethod),
315 fSpecialTrigger(ref.fSpecialTrigger),
316 fRemovePileUp(ref.fRemovePileUp),
317 fOpeningAngle(ref.fOpeningAngle),
318 fPsiPairCut(ref.fPsiPairCut),
319 fPsiPairDeltaPhiCut(ref.fPsiPairDeltaPhiCut),
320 fDo2DPsiPair(ref.fDo2DPsiPair),
321 fCosPAngleCut(ref.fCosPAngleCut),
322 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
323 fRejectExtraSignals(ref.fRejectExtraSignals),
324 fminV0Dist(ref.fminV0Dist),
325 fDoSharedElecCut(ref.fDoSharedElecCut),
326 fOfflineTriggerMask(ref.fOfflineTriggerMask),
327 fHasV0AND(ref.fHasV0AND),
328 fIsSDDFired(ref.fIsSDDFired),
329 fRandom(ref.fRandom),
330 fElectronArraySize(ref.fElectronArraySize),
331 fElectronLabelArray(NULL),
332 fDCAZPrimVtxCut(ref.fDCAZPrimVtxCut),
333 fDCARPrimVtxCut(ref.fDCAZPrimVtxCut),
334 fInPlaneOutOfPlane(ref.fInPlaneOutOfPlane),
335 fConversionPointXArray(ref.fConversionPointXArray),
336 fConversionPointYArray(ref.fConversionPointYArray),
337 fConversionPointZArray(ref.fConversionPointZArray),
338 fnHeaders(ref.fnHeaders),
339 fNotRejectedStart(NULL),
340 fNotRejectedEnd(NULL),
341 fGeneratorNames(ref.fGeneratorNames),
344 fEtaShift(ref.fEtaShift),
345 fDoEtaShift(ref.fDoEtaShift),
346 fDoReweightHistoMCPi0(ref.fDoReweightHistoMCPi0),
347 fDoReweightHistoMCEta(ref.fDoReweightHistoMCEta),
348 fDoReweightHistoMCK0s(ref.fDoReweightHistoMCK0s),
349 fPathTrFReweighting(ref.fPathTrFReweighting),
350 fNameHistoReweightingPi0(ref.fNameHistoReweightingPi0),
351 fNameHistoReweightingEta(ref.fNameHistoReweightingEta),
352 fNameHistoReweightingK0s(ref.fNameHistoReweightingK0s),
353 fNameFitDataPi0(ref.fNameFitDataPi0),
354 fNameFitDataEta(ref.fNameFitDataEta),
355 fNameFitDataK0s(ref.fNameFitDataK0s),
357 hTPCdEdxbefore(NULL),
359 hTPCdEdxSigbefore(NULL),
360 hTPCdEdxSigafter(NULL),
364 hPsiPairDeltaPhiafter(NULL),
367 hInvMassbefore(NULL),
368 hArmenterosbefore(NULL),
370 hArmenterosafter(NULL),
371 hAcceptanceCuts(NULL),
375 hCentralityVsNumberOfPrimaryTracks(NULL),
377 hEventPlanePhi(NULL),
379 hTriggerClassSelected(NULL),
380 hReweightMCHistPi0(ref.hReweightMCHistPi0),
381 hReweightMCHistEta(ref.hReweightMCHistEta),
382 hReweightMCHistK0s(ref.hReweightMCHistK0s),
383 fFitDataPi0(ref.fFitDataPi0),
384 fFitDataEta(ref.fFitDataEta),
385 fFitDataK0s(ref.fFitDataK0s),
386 fPreSelCut(ref.fPreSelCut),
387 fTriggerSelectedManually(ref.fTriggerSelectedManually),
388 fSpecialTriggerName(ref.fSpecialTriggerName)
391 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
392 fCutString=new TObjString((GetCutNumber()).Data());
393 fElectronLabelArray = new Int_t[fElectronArraySize];
394 fUtils = new AliAnalysisUtils();
395 // dont copy histograms (if you like histograms, call InitCutHistograms())
400 //________________________________________________________________________
401 AliConversionCuts::~AliConversionCuts() {
403 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
405 // delete fHistograms;
406 // fHistograms = NULL;
407 if(fCutString != NULL){
411 if(fElectronLabelArray){
412 delete fElectronLabelArray;
413 fElectronLabelArray = NULL;
415 if(fNotRejectedStart){
416 delete[] fNotRejectedStart;
417 fNotRejectedStart = NULL;
420 delete[] fNotRejectedEnd;
421 fNotRejectedEnd = NULL;
424 delete[] fGeneratorNames;
425 fGeneratorNames = NULL;
434 //________________________________________________________________________
435 void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
437 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
438 TH1::AddDirectory(kFALSE);
440 if(fHistograms != NULL){
444 if(fHistograms==NULL){
445 fHistograms=new TList();
446 fHistograms->SetOwner(kTRUE);
447 if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
448 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
451 if (hReweightMCHistPi0){
452 hReweightMCHistPi0->SetName("MCInputForWeightingPi0");
453 fHistograms->Add(hReweightMCHistPi0);
455 if (hReweightMCHistEta){
456 hReweightMCHistEta->SetName("MCInputForWeightingEta");
457 fHistograms->Add(hReweightMCHistEta);
459 if (hReweightMCHistK0s){
460 hReweightMCHistK0s->SetName("MCInputForWeightingK0s");
461 fHistograms->Add(hReweightMCHistK0s);
464 // fFitDataPi0->SetName("DataFitForWeightingPi0");
465 // fHistograms->Add(fFitDataPi0);
468 // fFitDataEta->SetName("DataFitForWeightingEta");
469 // fHistograms->Add(fFitDataEta);
472 // fFitDataK0s->SetName("DataFitForWeightingK0s");
473 // fHistograms->Add(fFitDataK0s);
476 hCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",11,-0.5,10.5);
477 hCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
478 hCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
479 hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
480 hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
481 hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
482 hCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
483 hCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
484 hCutIndex->GetXaxis()->SetBinLabel(kEventPlane+1,"EventPlane");
485 hCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
486 fHistograms->Add(hCutIndex);
489 hTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
490 hTrackCuts->GetXaxis()->SetBinLabel(1,"in");
491 hTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
492 hTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
493 hTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
494 hTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
495 hTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
496 hTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
497 hTrackCuts->GetXaxis()->SetBinLabel(8,"out");
498 fHistograms->Add(hTrackCuts);
501 hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",14,-0.5,13.5);
502 hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
503 hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
504 hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
505 hPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
506 hPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
507 hPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
508 hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
509 hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
510 hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
511 hPhotonCuts->GetXaxis()->SetBinLabel(10,"DCA R");
512 hPhotonCuts->GetXaxis()->SetBinLabel(11,"DCA Z");
513 hPhotonCuts->GetXaxis()->SetBinLabel(12,"out");
514 fHistograms->Add(hPhotonCuts);
517 hInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
518 fHistograms->Add(hInvMassbefore);
519 hArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
520 fHistograms->Add(hArmenterosbefore);
522 hInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
523 fHistograms->Add(hInvMassafter);
524 hArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
525 fHistograms->Add(hArmenterosafter);
527 hAcceptanceCuts=new TH1F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts",10,-0.5,9.5);
528 hAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
529 hAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
530 hAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
531 hAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
532 hAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
533 hAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
534 hAcceptanceCuts->GetXaxis()->SetBinLabel(7,"minpt");
535 hAcceptanceCuts->GetXaxis()->SetBinLabel(8,"out");
536 fHistograms->Add(hAcceptanceCuts);
539 hdEdxCuts=new TH1F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts",10,-0.5,9.5);
540 hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
541 hdEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
542 hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
543 hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
544 hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
545 hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
546 hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
547 hdEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
548 hdEdxCuts->GetXaxis()->SetBinLabel(9,"TRDelectron");
549 hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
550 fHistograms->Add(hdEdxCuts);
552 TAxis *AxisBeforedEdx = NULL;
553 TAxis *AxisBeforedEdxSig = NULL;
554 TAxis *AxisBeforeTOF = NULL;
555 TAxis *AxisBeforeTOFSig = NULL;
557 hTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
558 fHistograms->Add(hTPCdEdxbefore);
559 AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
560 hTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
561 fHistograms->Add(hTPCdEdxSigbefore);
562 AxisBeforedEdxSig = hTPCdEdxSigbefore->GetXaxis();
564 hTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
565 fHistograms->Add(hTOFbefore);
566 AxisBeforeTOF = hTOFbefore->GetXaxis();
567 hTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
568 fHistograms->Add(hTOFSigbefore);
569 AxisBeforeTOFSig = hTOFSigbefore->GetXaxis();
572 hTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
573 fHistograms->Add(hTPCdEdxSigafter);
575 hTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
576 fHistograms->Add(hTPCdEdxafter);
578 hTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
579 fHistograms->Add(hTOFSigafter);
581 hPsiPairDeltaPhiafter=new TH2F(Form("Gamma_PsiPairDeltaPhi_after %s",GetCutNumber().Data()),"Psi Pair vs Delta Phi Gamma after" ,200,-2,2,200,-2,2);
582 fHistograms->Add(hPsiPairDeltaPhiafter);
584 TAxis *AxisAfter = hTPCdEdxSigafter->GetXaxis();
585 Int_t bins = AxisAfter->GetNbins();
586 Double_t from = AxisAfter->GetXmin();
587 Double_t to = AxisAfter->GetXmax();
588 Double_t *newBins = new Double_t[bins+1];
590 Double_t factor = TMath::Power(to/from, 1./bins);
591 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
592 AxisAfter->Set(bins, newBins);
593 AxisAfter = hTOFSigafter->GetXaxis();
594 AxisAfter->Set(bins, newBins);
595 AxisAfter = hTPCdEdxafter->GetXaxis();
596 AxisAfter->Set(bins, newBins);
598 AxisBeforedEdx->Set(bins, newBins);
599 AxisBeforeTOF->Set(bins, newBins);
600 AxisBeforedEdxSig->Set(bins, newBins);
601 AxisBeforeTOFSig->Set(bins, newBins);
605 hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",1000,0,100);
606 fHistograms->Add(hCentrality);
607 hCentralityVsNumberOfPrimaryTracks=new TH2F(Form("Centrality vs Primary Tracks %s",GetCutNumber().Data()),"Centrality vs Primary Tracks ",100,0,100,4000,0,4000);
608 fHistograms->Add(hCentralityVsNumberOfPrimaryTracks);
610 // Event Cuts and Info
612 hV0EventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",7,-0.5,6.5);
613 hV0EventCuts->GetXaxis()->SetBinLabel(1,"in");
614 hV0EventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
615 hV0EventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
616 hV0EventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
617 hV0EventCuts->GetXaxis()->SetBinLabel(5,"pileup");
618 hV0EventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
619 hV0EventCuts->GetXaxis()->SetBinLabel(7,"out");
620 fHistograms->Add(hV0EventCuts);
622 hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
623 fHistograms->Add(hVertexZ);
625 hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",35,-0.5,34.5);
626 hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
627 hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
628 hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
629 hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
630 hTriggerClass->GetXaxis()->SetBinLabel( 5,"kKEMC1");
631 hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
632 hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
633 hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
634 hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
635 hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
636 hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
637 hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
638 hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
639 hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
640 hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
641 hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
642 hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
643 hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
644 hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
645 hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
646 hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
647 hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
648 hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
649 hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
650 hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
651 hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
652 hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
653 hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
654 hTriggerClass->GetXaxis()->SetBinLabel(29,"kTRD");
655 hTriggerClass->GetXaxis()->SetBinLabel(30,"kFastOnly");
656 hTriggerClass->GetXaxis()->SetBinLabel(31,"kAnyINT");
657 hTriggerClass->GetXaxis()->SetBinLabel(32,"kAny");
658 hTriggerClass->GetXaxis()->SetBinLabel(33,"V0AND");
659 hTriggerClass->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
660 hTriggerClass->GetXaxis()->SetBinLabel(35,"failed Physics Selection");
661 fHistograms->Add(hTriggerClass);
664 hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",34,-0.5,33.5);
665 hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB");
666 hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7");
667 hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON");
668 hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult");
669 hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kKEMC1");
670 hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5");
671 hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
672 hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
673 hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
674 hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
675 hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
676 hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7");
677 hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1");
678 hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
679 hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE");
680 hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA");
681 hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral");
682 hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral");
683 hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5");
684 hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED");
685 hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
686 hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8");
687 hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
688 hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
689 hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
690 hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
691 hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
692 hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined");
693 hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kTRD");
694 hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kFastOnly");
695 hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAnyINT");
696 hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"kAny");
697 hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"V0AND");
698 hTriggerClassSelected->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
699 fHistograms->Add(hTriggerClassSelected);
701 hEventPlanePhi=new TH1F(Form("EventPlaneMinusPhotonAngle %s",GetCutNumber().Data()),"EventPlaneMinusPhotonAngle",360,-TMath::Pi(),TMath::Pi());
702 fHistograms->Add(hEventPlanePhi);
706 TH1::AddDirectory(kTRUE);
709 //________________________________________________________________________
710 Bool_t AliConversionCuts::InitPIDResponse(){
711 // Set Pointer to AliPIDResponse
713 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
715 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
716 fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
717 if(fPIDResponse)return kTRUE;
724 ///________________________________________________________________________
725 Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent){
726 // Process Event Selection
729 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
732 // Check for MC event
733 if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
734 // Check if MC event is correctly loaded
735 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
740 if (!mcHandler->InitOk() ){
744 if (!mcHandler->TreeK() ){
748 if (!mcHandler->TreeTR() ) {
755 // cout << "before event trigger" << endl;
756 if(!IsTriggerSelected(fInputEvent)){
757 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
763 if(fInputEvent->IsA()==AliESDEvent::Class()){
764 AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
765 fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
766 if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(32);
768 // cout << "event number " << ((AliESDEvent*)fInputEvent)->GetEventNumberInFile() << " entered"<< endl;
771 // Number of Contributors Cut
772 if(GetNumberOfContributorsVtx(fInputEvent)<=0) {
773 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
779 // Z Vertex Position Cut
780 if(!VertexZCut(fInputEvent)){
781 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
790 if(fInputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
791 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
798 // Centrality Selection
799 if(!IsCentralitySelected(fInputEvent,fMCEvent)){
800 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
806 // Fill Event Histograms
807 if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
808 if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
809 if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent));
810 if(hCentralityVsNumberOfPrimaryTracks)
811 hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(fInputEvent),
812 ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
813 ->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks());
818 ///________________________________________________________________________
819 Bool_t AliConversionCuts::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
820 // MonteCarlo Photon Selection
822 if(!fMCStack)return kFALSE;
824 if (particle->GetPdgCode() == 22){
827 if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )
830 if( particle->Eta() < (fEtaCutMin + fEtaShift) && particle->Eta() > (-fEtaCutMin + fEtaShift) )
834 if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
835 return kFALSE; // no photon as mothers!
838 if(particle->GetMother(0) >= fMCStack->GetNprimary()){
839 return kFALSE; // the gamma has a mother, and it is not a primary particle
842 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
844 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
845 TParticle* ePos = NULL;
846 TParticle* eNeg = NULL;
848 if(particle->GetNDaughters() >= 2){
849 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
850 TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
851 if(tmpDaughter->GetUniqueID() == 5){
852 if(tmpDaughter->GetPdgCode() == 11){
854 } else if(tmpDaughter->GetPdgCode() == -11){
861 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
865 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
866 return kFALSE; // no reconstruction below the Pt cut
869 if( ePos->Eta() > (fEtaCut + fEtaShift) || ePos->Eta() < (-fEtaCut + fEtaShift) ||
870 eNeg->Eta() > (fEtaCut + fEtaShift) || eNeg->Eta() < (-fEtaCut + fEtaShift) )
873 if(fEtaCutMin > -0.1){
874 if( (ePos->Eta() < (fEtaCutMin + fEtaShift) && ePos->Eta() > (-fEtaCutMin + fEtaShift)) ||
875 (eNeg->Eta() < (fEtaCutMin + fEtaShift) && eNeg->Eta() > (-fEtaCutMin + fEtaShift)) )
880 return kFALSE; // cuts on distance from collision point
883 if(abs(ePos->Vz()) > fMaxZ){
884 return kFALSE; // outside material
886 if(abs(eNeg->Vz()) > fMaxZ){
887 return kFALSE; // outside material
890 if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
891 return kFALSE; // line cut to exclude regions where we do not reconstruct
892 } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
896 if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
897 return kFALSE; // line cut to exclude regions where we do not reconstruct
898 } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
903 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
907 ///________________________________________________________________________
908 Bool_t AliConversionCuts::PhotonIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){
909 // MonteCarlo Photon Selection
911 if(!aodmcArray)return kFALSE;
913 if (particle->GetPdgCode() == 22){
914 if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )
917 if( particle->Eta() < (fEtaCutMin + fEtaShift) && particle->Eta() > (-fEtaCutMin + fEtaShift) )
921 if(particle->GetMother() > -1){
922 if((static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
923 return kFALSE; // no photon as mothers!
925 if(!(static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother()))->IsPrimary())){
926 return kFALSE; // the gamma has a mother, and it is not a primary particle
930 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
932 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
933 AliAODMCParticle* ePos = NULL;
934 AliAODMCParticle* eNeg = NULL;
936 if(particle->GetNDaughters() >= 2){
937 for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
938 AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(aodmcArray->At(daughterIndex));
939 if(!tmpDaughter) continue;
940 if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
941 if(tmpDaughter->GetPdgCode() == 11){
943 } else if(tmpDaughter->GetPdgCode() == -11){
950 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
954 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
955 return kFALSE; // no reconstruction below the Pt cut
958 if( ePos->Eta() > (fEtaCut + fEtaShift) || ePos->Eta() < (-fEtaCut + fEtaShift) ||
959 eNeg->Eta() > (fEtaCut + fEtaShift) || eNeg->Eta() < (-fEtaCut + fEtaShift) )
962 if(fEtaCutMin > -0.1){
963 if( (ePos->Eta() < (fEtaCutMin + fEtaShift) && ePos->Eta() > (-fEtaCutMin + fEtaShift)) ||
964 (eNeg->Eta() < (fEtaCutMin + fEtaShift) && eNeg->Eta() > (-fEtaCutMin + fEtaShift)) )
968 Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) );
969 Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) );
972 return kFALSE; // cuts on distance from collision point
974 if(abs(ePos->Zv()) > fMaxZ){
975 return kFALSE; // outside material
977 if(abs(eNeg->Zv()) > fMaxZ){
978 return kFALSE; // outside material
981 if( rPos <= ((abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
982 return kFALSE; // line cut to exclude regions where we do not reconstruct
983 } else if ( fEtaCutMin != -0.1 && rPos >= ((abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
987 if( rNeg <= ((abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
988 return kFALSE; // line cut to exclude regions where we do not reconstruct
989 } else if ( fEtaCutMin != -0.1 && rNeg >= ((abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
994 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
998 ///________________________________________________________________________
999 Bool_t AliConversionCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event)
1000 { // Specific Photon Cuts
1003 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex);
1006 // Fill Histos before Cuts
1007 if(hInvMassbefore)hInvMassbefore->Fill(photon->GetMass());
1009 if(hArmenterosbefore)hArmenterosbefore->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
1011 // Gamma selection based on QT from Armenteros
1012 if(fDoQtGammaSelection == kTRUE){
1013 if(!ArmenterosQtCut(photon)){
1014 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //1
1021 if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
1023 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //2
1029 // Reconstruction Acceptance Cuts
1030 if(!AcceptanceCuts(photon)){
1031 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //3
1037 if(fDoPhotonAsymmetryCut == kTRUE){
1038 if(!AsymmetryCut(photon,event)){
1039 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //4
1044 //Check the pid probability
1046 if(!PIDProbabilityCut(photon, event)) {
1047 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //5
1052 if(!CorrectedTPCClusterCut(photon, event)) {
1053 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //6
1057 Double_t magField = event->GetMagneticField();
1058 if( magField < 0.0 ){
1063 AliVTrack * electronCandidate = GetTrack(event,photon->GetTrackLabelNegative() );
1064 AliVTrack * positronCandidate = GetTrack(event,photon->GetTrackLabelPositive() );
1065 Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->Phi()-positronCandidate->Phi());
1068 if(!PsiPairCut(photon,deltaPhi)) {
1069 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //7
1074 if(!CosinePAngleCut(photon, event)) {
1075 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //8
1079 AliAODConversionPhoton* photonAOD = dynamic_cast<AliAODConversionPhoton*>(photon);
1081 photonAOD->CalculateDistanceOfClossetApproachToPrimVtx(event->GetPrimaryVertex());
1084 if(photonAOD->GetDCArToPrimVtx() > fDCARPrimVtxCut) { //DCA R cut of photon to primary vertex
1085 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
1090 if(abs(photonAOD->GetDCAzToPrimVtx()) > fDCAZPrimVtxCut) { //DCA Z cut of photon to primary vertex
1091 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //10
1099 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //11
1101 // Histos after Cuts
1102 if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
1103 if(hArmenterosafter)hArmenterosafter->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
1104 if(hPsiPairDeltaPhiafter)hPsiPairDeltaPhiafter->Fill(deltaPhi,photon->GetPsiPair());
1109 ///________________________________________________________________________
1110 Bool_t AliConversionCuts::CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event)
1111 { //Cut on corrected TPC Cluster Info
1113 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1114 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1116 if(!negTrack||!posTrack)return kFALSE;
1118 Double_t negclsToF=0;
1120 if (!fUseCorrectedTPCClsInfo ){
1121 if(negTrack->GetTPCNclsF()!=0){
1122 negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
1125 negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1128 Double_t posclsToF = 0.;
1129 if (!fUseCorrectedTPCClsInfo ){
1130 if(posTrack->GetTPCNclsF()!=0){
1131 posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
1134 posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
1137 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
1144 ///________________________________________________________________________
1145 Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent * event)
1147 //Selection of Reconstructed Photons
1149 FillPhotonCutIndex(kPhotonIn);
1151 if(event->IsA()==AliESDEvent::Class()) {
1152 if(!SelectV0Finder( ( ((AliESDEvent*)event)->GetV0(photon->GetV0Index()))->GetOnFlyStatus() ) ){
1153 FillPhotonCutIndex(kOnFly);
1157 // else if(event->IsA()==AliAODEvent::Class()) {
1158 // if(!SelectV0Finder( ( ((AliAODEvent*)event)->GetV0(photon->GetV0Index())) ) ){
1159 // FillPhotonCutIndex(kOnFly);
1165 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
1166 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
1168 if(!negTrack || !posTrack) {
1169 FillPhotonCutIndex(kNoTracks);
1172 photon->DeterminePhotonQuality(negTrack,posTrack);
1174 if(!TracksAreSelected(negTrack, posTrack)){
1175 FillPhotonCutIndex(kTrackCuts);
1180 if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
1181 FillPhotonCutIndex(kdEdxCuts);
1186 if(!PhotonCuts(photon,event)){
1187 FillPhotonCutIndex(kPhotonCuts);
1191 // Photon passed cuts
1192 FillPhotonCutIndex(kPhotonOut);
1196 ///________________________________________________________________________
1197 Bool_t AliConversionCuts::ArmenterosQtCut(AliConversionPhotonBase *photon)
1198 { // Armenteros Qt Cut
1200 if(fDoHighPtQtGammaSelection){
1201 if(photon->GetPhotonPt() < fPtBorderForQt){
1202 if(photon->GetArmenterosQt()>fQtMax){
1206 if(photon->GetArmenterosQt()>fHighPtQtMax){
1212 if(photon->GetArmenterosQt()>fQtMax){
1220 ///________________________________________________________________________
1221 Bool_t AliConversionCuts::AcceptanceCuts(AliConversionPhotonBase *photon) {
1222 // Exclude certain areas for photon reconstruction
1225 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1228 if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
1229 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1234 if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
1235 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1240 if(photon->GetConversionRadius() <= ((abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
1241 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1244 else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1245 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1250 if(abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1251 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1257 if( photon->GetPhotonEta() > (fEtaCut + fEtaShift) || photon->GetPhotonEta() < (-fEtaCut + fEtaShift) ){
1258 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1261 if(fEtaCutMin>-0.1){
1262 if( photon->GetPhotonEta() < (fEtaCutMin + fEtaShift) && photon->GetPhotonEta() > (-fEtaCutMin + fEtaShift) ){
1263 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1269 if(photon->GetPhotonPt()<fPtCut){
1270 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1275 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
1281 ///________________________________________________________________________
1282 Bool_t AliConversionCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
1283 // Track Cuts which require AOD/ESD specific implementation
1285 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1286 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1291 AliAODVertex * NegVtxType=negTrack->GetProdVertex();
1292 AliAODVertex * PosVtxType=posTrack->GetProdVertex();
1293 if( (NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
1294 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1302 ///________________________________________________________________________
1303 Bool_t AliConversionCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
1304 // Track Cuts which require AOD/ESD specific implementation
1306 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
1307 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1312 if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
1313 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1321 ///________________________________________________________________________
1322 Bool_t AliConversionCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1323 // Track Selection for Photon Reconstruction
1326 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1330 if(negTrack->Charge() == posTrack->Charge()) {
1331 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1336 // Number of TPC Clusters
1339 if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1340 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1346 if( posTrack->Eta() > (fEtaCut + fEtaShift) || posTrack->Eta() < (-fEtaCut + fEtaShift) ||
1347 negTrack->Eta() > (fEtaCut + fEtaShift) || negTrack->Eta() < (-fEtaCut + fEtaShift) ){
1348 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1351 if(fEtaCutMin>-0.1){
1352 if( (posTrack->Eta() < (fEtaCutMin + fEtaShift) && posTrack->Eta() > (-fEtaCutMin + fEtaShift)) ||
1353 (negTrack->Eta() < (fEtaCutMin + fEtaShift) && negTrack->Eta() > (-fEtaCutMin + fEtaShift)) ){
1354 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1361 if( negTrack->Pt()< fSinglePtCut || posTrack->Pt()< fSinglePtCut){
1362 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1367 // AOD ESD specific cuts
1368 Bool_t passCuts = kTRUE;
1370 if(negTrack->IsA()==AliAODTrack::Class()) {
1371 passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1373 passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1377 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1382 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1388 ///________________________________________________________________________
1389 Bool_t AliConversionCuts::dEdxCuts(AliVTrack *fCurrentTrack){
1390 // Electron Identification Cuts for Photon reconstruction
1392 if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1393 if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1396 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1397 if(hTPCdEdxSigbefore)hTPCdEdxSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1398 if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1402 if(fDodEdxSigmaCut == kTRUE){
1403 // TPC Electron Line
1404 if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1405 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
1407 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1413 if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1414 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1415 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1416 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1418 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1425 if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1426 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1427 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine &&
1428 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1430 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1438 if(fDoKaonRejectionLowP == kTRUE){
1439 if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1440 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1442 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1449 if(fDoProtonRejectionLowP == kTRUE){
1450 if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1451 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1453 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1460 if(fDoPionRejectionLowP == kTRUE){
1461 if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1462 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1464 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1472 // cout<<"Start"<<endl;
1473 // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1475 // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1476 // {cout<<"TOF DA"<<endl;}
1477 // if(status == AliPIDResponse::kDetPidOk){
1478 // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1479 // cout<<"--> "<<probMis<<endl;
1480 // if(probMis > 0.01){
1485 if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1487 Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1489 fCurrentTrack->GetIntegratedTimes(times);
1490 Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1491 Double_t dT = TOFsignal - t0 - times[0];
1492 hTOFbefore->Fill(fCurrentTrack->P(),dT);
1494 if(hTOFSigbefore) hTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1496 if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1497 fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1498 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1502 if(hTOFSigafter)hTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1508 if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1509 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1515 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1516 if(hTPCdEdxSigafter)hTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1517 if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1522 ///________________________________________________________________________
1523 Bool_t AliConversionCuts::AsymmetryCut(AliConversionPhotonBase * photon,AliVEvent *event) {
1524 // Cut on Energy Assymetry
1526 for(Int_t ii=0;ii<2;ii++){
1528 AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1530 if( track->P() > fMinPPhotonAsymmetryCut ){
1531 Double_t trackNegAsy=0;
1532 if (photon->GetPhotonP()!=0.){
1533 trackNegAsy= track->P()/photon->GetPhotonP();
1536 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1545 ///________________________________________________________________________
1546 AliVTrack *AliConversionCuts::GetTrack(AliVEvent * event, Int_t label){
1547 //Returns pointer to the track with given ESD label
1548 //(Important for AOD implementation, since Track array in AOD data is different
1549 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1551 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1553 if(label > event->GetNumberOfTracks() ) return NULL;
1554 AliESDtrack * track = esdEvent->GetTrack(label);
1558 AliVTrack * track = 0x0;
1559 if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->AreAODsRelabeled()){
1560 track = dynamic_cast<AliVTrack*>(event->GetTrack(label));
1564 for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1565 track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1567 if(track->GetID() == label) {
1574 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1578 ///________________________________________________________________________
1579 AliESDtrack *AliConversionCuts::GetESDTrack(AliESDEvent * event, Int_t label){
1580 //Returns pointer to the track with given ESD label
1581 //(Important for AOD implementation, since Track array in AOD data is different
1582 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1585 if(label > event->GetNumberOfTracks() ) return NULL;
1586 AliESDtrack * track = event->GetTrack(label);
1589 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1595 ///________________________________________________________________________
1596 Bool_t AliConversionCuts::PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event){
1597 // Cut on Electron Probability for Photon Reconstruction
1599 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1603 Bool_t iResult=kFALSE;
1605 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1606 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1608 AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1609 AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1611 if(negProbArray && posProbArray){
1613 negTrack->GetTPCpid(negProbArray);
1614 posTrack->GetTPCpid(posProbArray);
1616 if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1621 delete [] posProbArray;
1622 delete [] negProbArray;
1626 ///Not possible for AODs
1636 ///________________________________________________________________________
1637 Bool_t AliConversionCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1638 // MC Acceptance Cuts
1639 //(Certain areas were excluded for photon reconstruction)
1641 if(particle->R()>fMaxR){
1644 if(ePos->R()>fMaxR){
1648 if(ePos->R()<fMinR){
1652 if( ePos->R() <= ((abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1655 else if (fUseEtaMinCut && ePos->R() >= ((abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1659 if(abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1663 if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1667 if(abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1672 if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) ){
1675 if( ePos->Eta() > (fEtaCut + fEtaShift) || ePos->Eta() < (-fEtaCut + fEtaShift) ){
1678 if( eNeg->Eta() > (fEtaCut + fEtaShift) || eNeg->Eta() < (-fEtaCut + fEtaShift) ){
1681 if(fEtaCutMin>-0.1){
1682 if( particle->Eta() < (fEtaCutMin + fEtaShift) && particle->Eta() > (-fEtaCutMin + fEtaShift) ){
1685 if( ePos->Eta() < (fEtaCutMin + fEtaShift) && ePos->Eta() > (-fEtaCutMin + fEtaShift) ){
1688 if( eNeg->Eta() < (fEtaCutMin + fEtaShift) && eNeg->Eta() > (-fEtaCutMin + fEtaShift) ){
1693 if( ePos->Pt()< fSinglePtCut || eNeg->Pt()< fSinglePtCut){
1697 if(particle->Pt()<fPtCut){
1703 ///________________________________________________________________________
1704 Bool_t AliConversionCuts::UpdateCutString() {
1705 ///Update the cut string (if it has been created yet)
1707 if(fCutString && fCutString->GetString().Length() == kNCuts) {
1708 fCutString->SetString(GetCutNumber());
1714 ///________________________________________________________________________
1715 void AliConversionCuts::LoadReweightingHistosMCFromFile() {
1717 AliInfo("Entering loading of histograms for weighting");
1718 TFile *f = TFile::Open(fPathTrFReweighting.Data());
1720 AliError(Form("file for weighting %s not found",fPathTrFReweighting.Data()));
1723 if (fNameHistoReweightingPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
1724 TH1D *hReweightMCHistPi0temp = (TH1D*)f->Get(fNameHistoReweightingPi0.Data());
1725 hReweightMCHistPi0 = new TH1D(*hReweightMCHistPi0temp);
1726 hReweightMCHistPi0->SetDirectory(0);
1727 if (hReweightMCHistPi0) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingPi0.Data(),fPathTrFReweighting.Data() ));
1728 else AliWarning(Form("%s not found in %s", fNameHistoReweightingPi0.Data() ,fPathTrFReweighting.Data()));
1730 if (fNameFitDataPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
1731 TF1 *fFitDataPi0temp = (TF1*)f->Get(fNameFitDataPi0.Data());
1732 fFitDataPi0 = new TF1(*fFitDataPi0temp);
1733 if (fFitDataPi0) AliInfo(Form("%s has been loaded from %s", fNameFitDataPi0.Data(),fPathTrFReweighting.Data() ));
1734 else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameFitDataPi0.Data() ));
1737 if (fNameHistoReweightingEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
1738 TH1D *hReweightMCHistEtatemp = (TH1D*)f->Get(fNameHistoReweightingEta.Data());
1739 hReweightMCHistEta = new TH1D(*hReweightMCHistEtatemp);
1740 hReweightMCHistEta->SetDirectory(0);
1741 if (hReweightMCHistEta) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
1742 else AliWarning(Form("%s not found in %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
1745 if (fNameFitDataEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
1746 TF1 *fFitDataEtatemp = (TF1*)f->Get(fNameFitDataEta.Data());
1747 fFitDataEta = new TF1(*fFitDataEtatemp);
1748 if (fFitDataEta) AliInfo(Form("%s has been loaded from %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
1749 else AliWarning(Form("%s not found in %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
1752 if (fNameHistoReweightingK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
1753 TH1D *hReweightMCHistK0stemp = (TH1D*)f->Get(fNameHistoReweightingK0s.Data());
1754 hReweightMCHistK0s = new TH1D(*hReweightMCHistK0stemp);
1755 hReweightMCHistK0s->SetDirectory(0);
1756 if (hReweightMCHistK0s) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
1757 else AliWarning(Form("%s not found in %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
1760 if (fNameFitDataK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
1761 TF1 *fFitDataK0stemp = (TF1*)f->Get(fNameFitDataK0s.Data());
1762 fFitDataK0s = new TF1(*fFitDataK0stemp);
1763 if (fFitDataK0s) AliInfo(Form("%s has been loaded from %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
1764 else AliWarning(Form("%s not found in %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
1772 ///________________________________________________________________________
1773 Bool_t AliConversionCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
1774 // Initialize Cuts from a given Cut string
1775 if(fDoReweightHistoMCPi0 || fDoReweightHistoMCEta || fDoReweightHistoMCK0s) {
1776 AliInfo("Weighting was enabled");
1777 LoadReweightingHistosMCFromFile();
1780 AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1781 if(analysisCutSelection.Length()!=kNCuts) {
1782 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1785 if(!analysisCutSelection.IsDigit()){
1786 AliError("Cut selection contains characters");
1790 const char *cutSelection = analysisCutSelection.Data();
1791 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
1792 for(Int_t ii=0;ii<kNCuts;ii++){
1796 // Set Individual Cuts
1797 for(Int_t ii=0;ii<kNCuts;ii++){
1798 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1805 ///________________________________________________________________________
1806 Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
1807 ///Set individual cut ID
1812 if( SetV0Finder(value)) {
1813 fCuts[kv0FinderType] = value;
1816 } else return kFALSE;
1818 case kededxSigmaCut:
1819 if( SetTPCdEdxCutElectronLine(value)) {
1820 fCuts[kededxSigmaCut] = value;
1823 } else return kFALSE;
1825 case kpidedxSigmaCut:
1826 if( SetTPCdEdxCutPionLine(value)) {
1827 fCuts[kpidedxSigmaCut] = value;
1830 } else return kFALSE;
1832 case kpiMomdedxSigmaCut:
1833 if( SetMinMomPiondEdxCut(value)) {
1834 fCuts[kpiMomdedxSigmaCut] = value;
1837 } else return kFALSE;
1840 if( SetChi2GammaCut(value)) {
1841 fCuts[kchi2GammaCut] = value;
1844 } else return kFALSE;
1847 if( SetSinglePtCut(value)) {
1848 fCuts[ksinglePtCut] = value;
1851 } else return kFALSE;
1854 if( SetTPCClusterCut(value)) {
1855 fCuts[kclsTPCCut] = value;
1858 } else return kFALSE;
1861 if( SetEtaCut(value)) {
1862 fCuts[ketaCut] = value;
1865 } else return kFALSE;
1867 case kLowPRejectionSigmaCut:
1868 if( SetLowPRejectionCuts(value)) {
1869 fCuts[kLowPRejectionSigmaCut] = value;
1872 } else return kFALSE;
1875 if( SetQtMaxCut(value)) {
1876 fCuts[kQtMaxCut] = value;
1879 } else return kFALSE;
1881 case kpiMaxMomdedxSigmaCut:
1882 if( SetMaxMomPiondEdxCut(value)) {
1883 fCuts[kpiMaxMomdedxSigmaCut] = value;
1886 } else return kFALSE;
1889 if( SetRCut(value)) {
1890 fCuts[kRCut] = value;
1893 } else return kFALSE;
1896 if( SetRemovePileUp(value)) {
1897 fCuts[kremovePileUp] = value;
1900 } else return kFALSE;
1903 if( SetSelectSpecialTrigger(value)) {
1904 fCuts[kselectV0AND] = value;
1907 } else return kFALSE;
1909 case kmultiplicityMethod:
1910 if( SetMultiplicityMethod(value)) {
1911 fCuts[kmultiplicityMethod] = value;
1914 } else return kFALSE;
1917 if( SetIsHeavyIon(value)) {
1918 fCuts[kisHeavyIon] = value;
1921 } else return kFALSE;
1923 case kCentralityMin:
1924 if( SetCentralityMin(value)) {
1925 fCuts[kCentralityMin] = value;
1928 } else return kFALSE;
1930 case kCentralityMax:
1931 if( SetCentralityMax(value)) {
1932 fCuts[kCentralityMax] = value;
1935 } else return kFALSE;
1937 case kTOFelectronPID:
1938 if( SetTOFElectronPIDCut(value)) {
1939 fCuts[kTOFelectronPID] = value;
1942 } else return kFALSE;
1944 case kdoPhotonAsymmetryCut:
1945 if( SetPhotonAsymmetryCut(value)) {
1946 fCuts[kdoPhotonAsymmetryCut] = value;
1949 } else return kFALSE;
1952 if( SetPsiPairCut(value)) {
1953 fCuts[kPsiPair] = value;
1956 } else return kFALSE;
1959 if( SetCosPAngleCut(value)) {
1960 fCuts[kCosPAngle] = value;
1963 } else return kFALSE;
1967 if( SetSharedElectronCut(value)) {
1968 fCuts[kElecShare] = value;
1971 } else return kFALSE;
1974 if( SetToCloseV0sCut(value)) {
1975 fCuts[kToCloseV0s] = value;
1978 } else return kFALSE;
1981 if( SetRejectExtraSignalsCut(value)) {
1982 fCuts[kExtraSignals] = value;
1985 } else return kFALSE;
1988 if( SetDCARPhotonPrimVtxCut(value)) {
1989 fCuts[kDcaRPrimVtx] = value;
1992 } else return kFALSE;
1995 if( SetDCAZPhotonPrimVtxCut(value)) {
1996 fCuts[kDcaZPrimVtx] = value;
1999 } else return kFALSE;
2001 case kInPlaneOutOfPlane:
2002 if( SetInPlaneOutOfPlane(value)) {
2003 fCuts[kInPlaneOutOfPlane] = value;
2006 } else return kFALSE;
2012 AliError("Cut id out of range");
2016 AliError("Cut id %d not recognized");
2021 ///________________________________________________________________________
2022 void AliConversionCuts::PrintCuts() {
2023 // Print out current Cut Selection
2024 for(Int_t ic = 0; ic < kNCuts; ic++) {
2025 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
2028 ///________________________________________________________________________
2029 Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
2037 fDetectorCentrality=0;
2041 fDetectorCentrality=1;
2043 case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
2045 fDetectorCentrality=0;
2046 fModCentralityClass=1;
2048 case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
2050 fDetectorCentrality=0;
2051 fModCentralityClass=2;
2053 case 5: //strict cut on v0 tracks for MC
2055 fDetectorCentrality=0;
2056 fModCentralityClass=3;
2058 case 6: //allows to select centrality 0-45% in steps of 5% for track mult
2059 //strict cut on v0 tracks for MC
2061 fDetectorCentrality=0;
2062 fModCentralityClass=4;
2064 case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
2065 //strict cut on v0 tracks for MC
2067 fDetectorCentrality=0;
2068 fModCentralityClass=5;
2072 fDetectorCentrality=0;
2076 fDetectorCentrality=1;
2079 AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
2085 //___________________________________________________________________
2086 Bool_t AliConversionCuts::SetCentralityMin(Int_t minCentrality)
2089 if(minCentrality<0||minCentrality>9){
2090 AliError(Form("minCentrality not defined %d",minCentrality));
2094 fCentralityMin=minCentrality;
2097 //___________________________________________________________________
2098 Bool_t AliConversionCuts::SetCentralityMax(Int_t maxCentrality)
2101 if(maxCentrality<0||maxCentrality>9){
2102 AliError(Form("maxCentrality not defined %d",maxCentrality));
2105 fCentralityMax=maxCentrality;
2108 ///________________________________________________________________________
2109 Int_t AliConversionCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger)
2112 switch(selectSpecialTrigger){
2114 fSpecialTrigger=0; // dont care
2117 fSpecialTrigger=1; // V0AND
2120 fSpecialTrigger=2; // with SDD requested
2123 fSpecialTrigger=3; // V0AND plus with SDD requested
2125 // allows to run MB & 6 other different trigger classes in parallel with the same photon cut
2127 fSpecialTrigger=4; // different trigger class as MB
2128 fTriggerSelectedManually = kTRUE;
2131 fSpecialTrigger=4; // different trigger class as MB
2132 fTriggerSelectedManually = kTRUE;
2135 fSpecialTrigger=4; // different trigger class as MB
2136 fTriggerSelectedManually = kTRUE;
2139 fSpecialTrigger=4; // different trigger class as MB
2140 fTriggerSelectedManually = kTRUE;
2143 fSpecialTrigger=4; // different trigger class as MB
2144 fTriggerSelectedManually = kTRUE;
2147 fSpecialTrigger=4; // different trigger class as MB
2148 fTriggerSelectedManually = kTRUE;
2151 AliError("Warning: Special Trigger Not known");
2156 ///________________________________________________________________________
2157 Bool_t AliConversionCuts::SetMultiplicityMethod(Int_t multiplicityMethod)
2160 fMultiplicityMethod=multiplicityMethod;
2162 // 0 Photon Multiplicity
2163 // 1 TPC Track multiplicity
2169 ///________________________________________________________________________
2170 Bool_t AliConversionCuts::SetRemovePileUp(Int_t removePileUp)
2172 switch(removePileUp){
2174 fRemovePileUp=kFALSE;
2177 fRemovePileUp=kTRUE;
2180 AliError("RemovePileUpCut not defined");
2185 ///________________________________________________________________________
2186 Bool_t AliConversionCuts::SetRejectExtraSignalsCut(Int_t extraSignal) {
2188 switch(extraSignal){
2190 fRejectExtraSignals = 0;
2191 break; // No Rejection
2193 fRejectExtraSignals = 1;
2194 break; // MinBias Header
2196 fRejectExtraSignals = 2;
2197 break; // User String Array
2199 fRejectExtraSignals = 3;
2200 break; // Rejection for Gamma Correction only
2202 AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
2207 ///________________________________________________________________________
2208 Bool_t AliConversionCuts::SetV0Finder(Int_t v0FinderType)
2210 switch (v0FinderType){
2211 case 0: // on fly V0 finder
2212 cout << "have chosen onfly V0" << endl;
2213 fUseOnFlyV0Finder=kTRUE;
2215 case 1: // offline V0 finder
2216 cout << "have chosen offline V0" << endl;
2217 fUseOnFlyV0Finder=kFALSE;
2220 AliError(Form(" v0FinderType not defined %d",v0FinderType));
2225 ///________________________________________________________________________
2226 Bool_t AliConversionCuts::SetEtaCut(Int_t etaCut)
2229 //Set Standard LineCutZValues
2230 fLineCutZValueMin = -2;
2231 fLineCutZValue = 7.;
2236 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2238 fLineCutZRSlopeMin = 0.;
2240 case 1: // 0.6 // changed from 1.2 to 0.6 on 2013.06.10
2242 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2244 fLineCutZRSlopeMin = 0.;
2248 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2250 fLineCutZRSlopeMin = 0.;
2254 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2256 fLineCutZRSlopeMin = 0.;
2260 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2262 fLineCutZRSlopeMin = 0.;
2266 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2268 fLineCutZRSlopeMin = 0.;
2272 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2274 fLineCutZRSlopeMin = 0.;
2277 if (fIsHeavyIon==1){
2279 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2281 fLineCutZRSlopeMin = 0.;
2285 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2287 fLineCutZRSlopeMin = 0.;
2290 // case 8: // 0.1 - 0.8
2292 // fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2293 // fEtaCutMin = 0.1;
2294 // fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
2298 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2300 fLineCutZRSlopeMin = 0.;
2304 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
2306 fLineCutZRSlopeMin = 0.;
2309 AliError(Form(" EtaCut not defined %d",etaCut));
2314 ///________________________________________________________________________
2315 Bool_t AliConversionCuts::SetRCut(Int_t RCut){
2338 // High purity cuts for PbPb (remove first layers of material)
2361 AliError("RCut not defined");
2366 ///________________________________________________________________________
2367 Bool_t AliConversionCuts::SetSinglePtCut(Int_t singlePtCut)
2369 switch(singlePtCut){
2370 case 0: // 0.050 GeV
2371 fSinglePtCut = 0.050;
2373 case 1: // 0.100 GeV
2374 fSinglePtCut = 0.100;
2376 case 2: // 0.150 GeV
2377 fSinglePtCut = 0.150;
2379 case 3: // 0.200 GeV
2380 fSinglePtCut = 0.200;
2382 case 4: // 0.075 GeV
2383 fSinglePtCut = 0.075;
2385 case 5: // 0.125 GeV
2386 fSinglePtCut = 0.125;
2389 fSinglePtCut = 0.040;
2395 AliError(Form("singlePtCut not defined %d",singlePtCut));
2400 ///________________________________________________________________________
2401 Bool_t AliConversionCuts::SetTPCClusterCut(Int_t clsTPCCut)
2416 case 4: // 95% of findable clusters
2417 fMinClsTPCToF= 0.95;
2418 fUseCorrectedTPCClsInfo=1;
2420 case 5: // 0% of findable clusters
2422 fUseCorrectedTPCClsInfo=1;
2424 case 6: // 70% of findable clusters
2426 fUseCorrectedTPCClsInfo=1;
2428 case 7: // 0% of findable clusters
2429 fMinClsTPCToF= 0.35;
2430 fUseCorrectedTPCClsInfo=0;
2433 fMinClsTPCToF= 0.35;
2434 fUseCorrectedTPCClsInfo=1;
2438 fUseCorrectedTPCClsInfo=1;
2441 AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
2446 ///________________________________________________________________________
2447 Bool_t AliConversionCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
2449 switch(ededxSigmaCut){
2451 fPIDnSigmaBelowElectronLine=-10;
2452 fPIDnSigmaAboveElectronLine=10;
2455 fPIDnSigmaBelowElectronLine=-5;
2456 fPIDnSigmaAboveElectronLine=5;
2459 fPIDnSigmaBelowElectronLine=-3;
2460 fPIDnSigmaAboveElectronLine=5;
2463 fPIDnSigmaBelowElectronLine=-4;
2464 fPIDnSigmaAboveElectronLine=5;
2467 fPIDnSigmaBelowElectronLine=-6;
2468 fPIDnSigmaAboveElectronLine=7;
2471 fPIDnSigmaBelowElectronLine=-4;
2472 fPIDnSigmaAboveElectronLine=4;
2475 fPIDnSigmaBelowElectronLine=-2.5;
2476 fPIDnSigmaAboveElectronLine=4;
2479 fPIDnSigmaBelowElectronLine=-2;
2480 fPIDnSigmaAboveElectronLine=3.5;
2483 AliError("TPCdEdxCutElectronLine not defined");
2489 ///________________________________________________________________________
2490 Bool_t AliConversionCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
2493 switch(pidedxSigmaCut){
2495 fPIDnSigmaAbovePionLine=-10;
2496 fPIDnSigmaAbovePionLineHighPt=-10;
2499 fPIDnSigmaAbovePionLine=0;
2500 fPIDnSigmaAbovePionLineHighPt=-10;
2503 fPIDnSigmaAbovePionLine=1;
2504 fPIDnSigmaAbovePionLineHighPt=-10;
2507 fPIDnSigmaAbovePionLine=2.5;
2508 fPIDnSigmaAbovePionLineHighPt=-10;
2511 fPIDnSigmaAbovePionLine=0.5;
2512 fPIDnSigmaAbovePionLineHighPt=-10;
2515 fPIDnSigmaAbovePionLine=2.;
2516 fPIDnSigmaAbovePionLineHighPt=-10;
2519 fPIDnSigmaAbovePionLine=2.;
2520 fPIDnSigmaAbovePionLineHighPt=0.5;
2523 fPIDnSigmaAbovePionLine=3.5;
2524 fPIDnSigmaAbovePionLineHighPt=-10;
2527 fPIDnSigmaAbovePionLine=2.;
2528 fPIDnSigmaAbovePionLineHighPt=1.;
2531 fPIDnSigmaAbovePionLine=3.0; // We need a bit less tight cut on dE/dx
2532 fPIDnSigmaAbovePionLineHighPt=-10;
2535 AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
2540 ///________________________________________________________________________
2541 Bool_t AliConversionCuts::SetMinMomPiondEdxCut(Int_t piMomdedxSigmaCut)
2543 switch(piMomdedxSigmaCut){
2545 fPIDMinPnSigmaAbovePionLine=0.5;
2548 fPIDMinPnSigmaAbovePionLine=1.;
2551 fPIDMinPnSigmaAbovePionLine=1.5;
2554 fPIDMinPnSigmaAbovePionLine=20.;
2557 fPIDMinPnSigmaAbovePionLine=50.;
2560 fPIDMinPnSigmaAbovePionLine=0.3;
2563 fPIDMinPnSigmaAbovePionLine=0.25;
2566 fPIDMinPnSigmaAbovePionLine=0.4;
2569 fPIDMinPnSigmaAbovePionLine=0.2;
2572 AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2577 ///________________________________________________________________________
2578 Bool_t AliConversionCuts::SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
2580 switch(piMaxMomdedxSigmaCut){
2582 fPIDMaxPnSigmaAbovePionLine=100.;
2585 fPIDMaxPnSigmaAbovePionLine=5.;
2588 fPIDMaxPnSigmaAbovePionLine=4.;
2591 fPIDMaxPnSigmaAbovePionLine=3.5;
2594 fPIDMaxPnSigmaAbovePionLine=3.;
2597 fPIDMaxPnSigmaAbovePionLine=7.;
2600 AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2605 ///________________________________________________________________________
2606 Bool_t AliConversionCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
2608 switch(LowPRejectionSigmaCut){
2610 fPIDnSigmaAtLowPAroundKaonLine=0;
2611 fPIDnSigmaAtLowPAroundProtonLine=0;
2612 fPIDnSigmaAtLowPAroundPionLine=0;
2613 fDoKaonRejectionLowP = kFALSE;
2614 fDoProtonRejectionLowP = kFALSE;
2615 fDoPionRejectionLowP = kFALSE;
2616 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2619 fPIDnSigmaAtLowPAroundKaonLine=0.5;
2620 fPIDnSigmaAtLowPAroundProtonLine=0.5;
2621 fPIDnSigmaAtLowPAroundPionLine=0.5;
2622 fDoKaonRejectionLowP = kTRUE;
2623 fDoProtonRejectionLowP = kTRUE;
2624 fDoPionRejectionLowP = kTRUE;
2625 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2628 fPIDnSigmaAtLowPAroundKaonLine=1;
2629 fPIDnSigmaAtLowPAroundProtonLine=1;
2630 fPIDnSigmaAtLowPAroundPionLine=1;
2631 fDoKaonRejectionLowP = kTRUE;
2632 fDoProtonRejectionLowP = kTRUE;
2633 fDoPionRejectionLowP = kTRUE;
2634 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2637 fPIDnSigmaAtLowPAroundKaonLine=2.;
2638 fPIDnSigmaAtLowPAroundProtonLine=2.;
2639 fPIDnSigmaAtLowPAroundPionLine=2.;
2640 fDoKaonRejectionLowP = kTRUE;
2641 fDoProtonRejectionLowP = kTRUE;
2642 fDoPionRejectionLowP = kTRUE;
2643 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2646 fPIDnSigmaAtLowPAroundKaonLine=0.;
2647 fPIDnSigmaAtLowPAroundProtonLine=0.;
2648 fPIDnSigmaAtLowPAroundPionLine=1;
2649 fDoKaonRejectionLowP = kFALSE;
2650 fDoProtonRejectionLowP = kFALSE;
2651 fDoPionRejectionLowP = kTRUE;
2652 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2655 fPIDnSigmaAtLowPAroundKaonLine=0.;
2656 fPIDnSigmaAtLowPAroundProtonLine=0.;
2657 fPIDnSigmaAtLowPAroundPionLine=1.5;
2658 fDoKaonRejectionLowP = kFALSE;
2659 fDoProtonRejectionLowP = kFALSE;
2660 fDoPionRejectionLowP = kTRUE;
2661 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2664 fPIDnSigmaAtLowPAroundKaonLine=0.;
2665 fPIDnSigmaAtLowPAroundProtonLine=0.;
2666 fPIDnSigmaAtLowPAroundPionLine=2.;
2667 fDoKaonRejectionLowP = kFALSE;
2668 fDoProtonRejectionLowP = kFALSE;
2669 fDoPionRejectionLowP = kTRUE;
2670 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2673 fPIDnSigmaAtLowPAroundKaonLine=0.;
2674 fPIDnSigmaAtLowPAroundProtonLine=0.;
2675 fPIDnSigmaAtLowPAroundPionLine=0.5;
2676 fDoKaonRejectionLowP = kFALSE;
2677 fDoProtonRejectionLowP = kFALSE;
2678 fDoPionRejectionLowP = kTRUE;
2679 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2682 AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
2687 ///________________________________________________________________________
2688 Bool_t AliConversionCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
2690 switch(TOFelectronPID){
2692 fUseTOFpid = kFALSE;
2693 fTofPIDnSigmaBelowElectronLine=-100;
2694 fTofPIDnSigmaAboveElectronLine=100;
2698 fTofPIDnSigmaBelowElectronLine=-7;
2699 fTofPIDnSigmaAboveElectronLine=7;
2703 fTofPIDnSigmaBelowElectronLine=-5;
2704 fTofPIDnSigmaAboveElectronLine=5;
2708 fTofPIDnSigmaBelowElectronLine=-3;
2709 fTofPIDnSigmaAboveElectronLine=5;
2713 fTofPIDnSigmaBelowElectronLine=-2;
2714 fTofPIDnSigmaAboveElectronLine=3;
2718 fTofPIDnSigmaBelowElectronLine=-3;
2719 fTofPIDnSigmaAboveElectronLine=3;
2722 AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
2727 ///________________________________________________________________________
2728 Bool_t AliConversionCuts::SetQtMaxCut(Int_t QtMaxCut)
2733 fDoQtGammaSelection=kFALSE;
2734 fDoHighPtQtGammaSelection=kFALSE;
2736 fPtBorderForQt=100.;
2740 fDoHighPtQtGammaSelection=kFALSE;
2742 fPtBorderForQt=100.;
2746 fDoHighPtQtGammaSelection=kFALSE;
2748 fPtBorderForQt=100.;
2752 fDoHighPtQtGammaSelection=kFALSE;
2754 fPtBorderForQt=100.;
2758 fDoHighPtQtGammaSelection=kFALSE;
2760 fPtBorderForQt=100.;
2764 fDoHighPtQtGammaSelection=kFALSE;
2766 fPtBorderForQt=100.;
2770 fDoHighPtQtGammaSelection=kTRUE;
2776 fDoHighPtQtGammaSelection=kFALSE;
2778 fPtBorderForQt=100.;
2781 AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
2786 ///________________________________________________________________________
2787 Bool_t AliConversionCuts::SetChi2GammaCut(Int_t chi2GammaCut)
2790 switch(chi2GammaCut){
2792 fChi2CutConversion = 100.;
2795 fChi2CutConversion = 50.;
2798 fChi2CutConversion = 30.;
2801 fChi2CutConversion = 200.;
2804 fChi2CutConversion = 500.;
2807 fChi2CutConversion = 100000.;
2810 fChi2CutConversion = 5.;
2813 fChi2CutConversion = 10.;
2816 fChi2CutConversion = 20.;
2819 fChi2CutConversion = 15.;
2822 AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
2827 ///________________________________________________________________________
2828 Bool_t AliConversionCuts::SetPsiPairCut(Int_t psiCut) {
2832 fPsiPairCut = 10000; //
2835 fPsiPairCut = 0.1; //
2838 fPsiPairCut = 0.05; // Standard
2841 fPsiPairCut = 0.035; //
2844 fPsiPairCut = 0.2; //
2847 fPsiPairCut = 0.1; //
2848 fPsiPairDeltaPhiCut = 1;
2849 fDo2DPsiPair = kTRUE;
2852 fPsiPairCut = 0.05; //
2853 fPsiPairDeltaPhiCut = 1;
2854 fDo2DPsiPair = kTRUE;
2857 fPsiPairCut = 0.035; //
2858 fPsiPairDeltaPhiCut = 1;
2859 fDo2DPsiPair = kTRUE;
2862 fPsiPairCut = 0.2; //
2863 fPsiPairDeltaPhiCut = 1;
2864 fDo2DPsiPair = kTRUE; //
2867 fPsiPairCut = 0.5; //
2870 AliError(Form("PsiPairCut not defined %d",psiCut));
2876 ///________________________________________________________________________
2877 Bool_t AliConversionCuts::SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut){
2879 switch(doPhotonAsymmetryCut){
2881 fDoPhotonAsymmetryCut=0;
2882 fMinPPhotonAsymmetryCut=100.;
2883 fMinPhotonAsymmetry=0.;
2886 fDoPhotonAsymmetryCut=1;
2887 fMinPPhotonAsymmetryCut=3.5;
2888 fMinPhotonAsymmetry=0.04;
2891 fDoPhotonAsymmetryCut=1;
2892 fMinPPhotonAsymmetryCut=3.5;
2893 fMinPhotonAsymmetry=0.06;
2896 fDoPhotonAsymmetryCut=1;
2897 fMinPPhotonAsymmetryCut=0.0;
2898 fMinPhotonAsymmetry=0.05;
2901 AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
2904 fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
2907 ///________________________________________________________________________
2908 Bool_t AliConversionCuts::SetCosPAngleCut(Int_t cosCut) {
2912 fCosPAngleCut = TMath::Pi(); // -1
2915 fCosPAngleCut = 0.1; // 0.99500
2918 fCosPAngleCut = 0.05; // 0.99875
2921 fCosPAngleCut = 0.025; // 0.99969
2924 fCosPAngleCut = 0.01; // 0.99995
2927 fCosPAngleCut = 0.2; // 0.98007
2930 fCosPAngleCut = 0.5; // 0.87758
2933 fCosPAngleCut = 0.075; // 0.73169
2936 AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
2942 ///________________________________________________________________________
2943 Bool_t AliConversionCuts::SetSharedElectronCut(Int_t sharedElec) {
2947 fDoSharedElecCut = kFALSE;
2950 fDoSharedElecCut = kTRUE;
2953 AliError(Form("Shared Electron Cut not defined %d",sharedElec));
2959 ///________________________________________________________________________
2960 Bool_t AliConversionCuts::SetToCloseV0sCut(Int_t toClose) {
2964 fDoToCloseV0sCut = kFALSE;
2968 fDoToCloseV0sCut = kTRUE;
2972 fDoToCloseV0sCut = kTRUE;
2976 fDoToCloseV0sCut = kTRUE;
2980 AliError(Form("Shared Electron Cut not defined %d",toClose));
2985 ///________________________________________________________________________
2986 Bool_t AliConversionCuts::SetTRDElectronCut(Int_t TRDElectronCut)
2988 switch(TRDElectronCut){
2994 fPIDTRDEfficiency=0.1;
2998 fPIDTRDEfficiency=0.8;
3002 fPIDTRDEfficiency=0.9;
3005 AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
3012 ///________________________________________________________________________
3013 Bool_t AliConversionCuts::SetDCAZPhotonPrimVtxCut(Int_t DCAZPhotonPrimVtx){
3015 switch(DCAZPhotonPrimVtx){
3017 fDCAZPrimVtxCut = 1000;
3020 fDCAZPrimVtxCut = 10;
3023 fDCAZPrimVtxCut = 5;
3026 fDCAZPrimVtxCut = 4;
3029 fDCAZPrimVtxCut = 3;
3032 fDCAZPrimVtxCut = 2.5;
3035 fDCAZPrimVtxCut = 2;
3038 fDCAZPrimVtxCut = 1.5;
3041 fDCAZPrimVtxCut = 1;
3044 fDCAZPrimVtxCut = 0.5;
3047 cout<<"Warning: DCAZPhotonPrimVtx not defined "<<DCAZPhotonPrimVtx<<endl;
3053 ///________________________________________________________________________
3054 Bool_t AliConversionCuts::SetDCARPhotonPrimVtxCut(Int_t DCARPhotonPrimVtx){
3056 switch(DCARPhotonPrimVtx){
3058 fDCARPrimVtxCut = 1000;
3061 fDCARPrimVtxCut = 10;
3064 fDCARPrimVtxCut = 5;
3067 fDCARPrimVtxCut = 4;
3070 fDCARPrimVtxCut = 3;
3073 fDCARPrimVtxCut = 2.5;
3076 fDCARPrimVtxCut = 2;
3079 fDCARPrimVtxCut = 1.5;
3082 fDCARPrimVtxCut = 1;
3085 fDCARPrimVtxCut = 0.5;
3088 cout<<"Warning: DCARPhotonPrimVtx not defined "<<DCARPhotonPrimVtx<<endl;
3094 ///________________________________________________________________________
3095 Bool_t AliConversionCuts::SetInPlaneOutOfPlane(Int_t inOutPlane){
3099 fInPlaneOutOfPlane = 0; // No Event Plane
3102 fInPlaneOutOfPlane = 1; // In-Plane
3105 fInPlaneOutOfPlane = 2; // Out-Of-Plane
3108 cout<<"Warning: In-Plane or Out-Of-Plane not defined "<<inOutPlane<<endl;
3115 //-------------------------------------------------------------
3116 Double_t AliConversionCuts::GetCentrality(AliVEvent *event)
3117 { // Get Event Centrality
3119 AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
3121 AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
3123 if(fDetectorCentrality==0){
3124 if (fIsHeavyIon==2){
3125 return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
3127 return fESDCentrality->GetCentralityPercentile("V0M"); // default
3130 if(fDetectorCentrality==1){
3131 return fESDCentrality->GetCentralityPercentile("CL1");
3135 AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
3137 if(aodEvent->GetHeader()){return aodEvent->GetHeader()->GetCentrality();}
3142 //-------------------------------------------------------------
3143 Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEvent)
3144 { // Centrality Selection
3145 if(!fIsHeavyIon)return kTRUE;
3147 if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
3148 else if(fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-100%
3150 Double_t centrality=GetCentrality(event);
3151 if(centrality<0)return kFALSE;
3153 Int_t centralityC=0;
3154 if (fModCentralityClass == 0){
3155 centralityC= Int_t(centrality/10);
3156 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
3160 else if (fModCentralityClass ==1){
3161 centralityC= Int_t(centrality);
3162 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
3164 } else return kFALSE;
3166 else if (fModCentralityClass ==2){
3167 centralityC= Int_t(centrality);
3168 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
3173 Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks();
3174 Int_t PrimaryTracks10[10][2] =
3187 Int_t PrimaryTracks5a[10][2] =
3200 Int_t PrimaryTracks5b[10][2] =
3215 if(event->IsA()==AliESDEvent::Class()) column = 0;
3216 if(event->IsA()==AliAODEvent::Class()) column = 1;
3218 if (fModCentralityClass == 3){
3220 if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column])
3225 centralityC= Int_t(centrality/10);
3226 if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
3231 else if (fModCentralityClass ==4){
3233 if(nprimaryTracks > PrimaryTracks5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5a[fCentralityMin][column])
3238 centralityC= Int_t(centrality);
3239 if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
3241 } else return kFALSE;
3244 else if (fModCentralityClass ==5){
3246 if(nprimaryTracks > PrimaryTracks5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5b[fCentralityMin][column])
3251 centralityC= Int_t(centrality);
3252 if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
3260 ///________________________________________________________________________
3261 Bool_t AliConversionCuts::VertexZCut(AliVEvent *event){
3262 // Cut on z position of primary vertex
3263 Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
3265 if(abs(fVertexZ)>fMaxVertexZ)return kFALSE;
3267 if (fIsHeavyIon == 2){
3268 if(fUtils->IsFirstEventInChunk(event)) return kFALSE;
3269 if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
3270 if(fUtils->IsPileUpEvent(event)) return kFALSE;
3275 ///________________________________________________________________________
3277 Int_t AliConversionCuts::GetNumberOfContributorsVtx(AliVEvent *event){
3278 // returns number of contributors to the vertex
3280 AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
3282 if (fESDEvent->GetPrimaryVertex() != NULL){
3283 if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
3284 // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl;
3285 return fESDEvent->GetPrimaryVertex()->GetNContributors();
3289 if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
3290 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
3291 // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl;
3292 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
3294 AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
3295 // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
3301 AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
3303 if (fAODEvent->GetPrimaryVertex() != NULL){
3304 if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
3305 return fAODEvent->GetPrimaryVertex()->GetNContributors();
3308 if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
3309 if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
3310 return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
3312 AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
3317 // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
3321 ///________________________________________________________________________
3323 Bool_t AliConversionCuts::IsTriggerSelected(AliVEvent *fInputEvent)
3326 AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
3328 UInt_t isSelected = AliVEvent::kAny;
3329 if (fInputHandler==NULL) return kFALSE;
3330 if( fInputHandler->GetEventSelection() || fInputEvent->IsA()==AliAODEvent::Class()) {
3331 if (!fTriggerSelectedManually){
3332 if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny;
3334 if (fIsHeavyIon == 1) fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
3335 else if (fIsHeavyIon == 2) fOfflineTriggerMask = AliVEvent::kINT7;
3336 else fOfflineTriggerMask = AliVEvent::kMB;
3339 // Get the actual offline trigger mask for the event and AND it with the
3340 // requested mask. If no mask requested select by default the event.
3341 // if (fPreSelCut) cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask for Precut: " << fOfflineTriggerMask << endl;
3342 // else cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask: " << fOfflineTriggerMask << endl;
3344 if (fOfflineTriggerMask)
3345 isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
3347 fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
3351 if (fIsSDDFired) hTriggerClass->Fill(33);
3352 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
3353 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
3354 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
3355 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
3356 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
3357 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
3358 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
3359 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
3360 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
3361 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
3362 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
3363 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
3364 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
3365 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
3366 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
3367 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
3368 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
3369 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
3370 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
3371 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
3372 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
3373 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
3374 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
3375 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
3376 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
3377 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
3378 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
3379 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
3380 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
3381 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
3382 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
3383 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
3384 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
3385 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
3386 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
3387 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
3388 if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28);
3389 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29);
3390 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(30);
3391 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(31);
3392 if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(34);
3395 if(hTriggerClassSelected && isSelected){
3396 if (!fIsSDDFired) hTriggerClassSelected->Fill(33);
3397 if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
3398 if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
3399 if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
3400 if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
3401 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
3402 if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
3403 if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
3404 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
3405 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
3406 if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
3407 if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
3408 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
3409 if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
3410 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
3411 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
3412 if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
3413 if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
3414 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
3415 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
3416 if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
3417 if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
3418 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
3419 if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
3420 if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
3421 if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
3422 if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
3423 if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
3424 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
3425 if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
3426 if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
3427 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
3428 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
3429 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
3430 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
3431 if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
3432 if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
3433 if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28);
3434 if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29);
3435 if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30);
3436 if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31);
3439 if(!isSelected)return kFALSE;
3445 ///________________________________________________________________________
3446 Int_t AliConversionCuts::GetFirstTPCRow(Double_t radius){
3447 // Get first TPC row
3448 Int_t firstTPCRow = 0;
3449 Double_t radiusI = 84.8;
3450 Double_t radiusO = 134.6;
3451 Double_t radiusOB = 198.;
3452 Double_t rSizeI = 0.75;
3453 Double_t rSizeO = 1.;
3454 Double_t rSizeOB = 1.5;
3458 if(radius <= radiusI){
3461 if(radius>radiusI && radius<=radiusO){
3462 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
3464 if(radius>radiusO && radius<=radiusOB){
3465 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
3468 if(radius>radiusOB){
3469 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
3475 Bool_t AliConversionCuts::CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const {
3476 ///Check if passes cosine of pointing angle cut
3477 if(GetCosineOfPointingAngle(photon, event) < (TMath::Cos(fCosPAngleCut))){
3483 Double_t AliConversionCuts::GetCosineOfPointingAngle( const AliConversionPhotonBase * photon, AliVEvent * event) const{
3484 // calculates the pointing angle of the recalculated V0
3486 Double_t momV0[3] = {0,0,0};
3487 if(event->IsA()==AliESDEvent::Class()){
3488 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
3489 if(!esdEvent) return -999;
3490 AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
3491 if(!v0) return -999;
3492 v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
3494 if(event->IsA()==AliAODEvent::Class()){
3495 momV0[0] = photon->GetPx();
3496 momV0[1] = photon->GetPy();
3497 momV0[2] = photon->GetPz();
3500 //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
3501 Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
3502 photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
3503 photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
3505 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
3506 Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
3509 Double_t cosinePointingAngle = -999;
3510 if(momV02*PosV02 > 0.0)
3511 cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
3513 return cosinePointingAngle;
3516 ///________________________________________________________________________
3517 Bool_t AliConversionCuts::PsiPairCut(const AliConversionPhotonBase * photon, Double_t deltaPhi) const {
3519 // cout << fDo2DPsiPair << "\t" << fPsiPairCut << "\t" << fPsiPairDeltaPhiCut << endl;
3523 if ( (deltaPhi > 0 && deltaPhi < fPsiPairDeltaPhiCut) &&
3524 TMath::Abs(photon->GetPsiPair()) < ( fPsiPairCut - fPsiPairCut/fPsiPairDeltaPhiCut * deltaPhi ) ) return kTRUE;
3527 if(abs(photon->GetPsiPair()) > fPsiPairCut){
3533 ///________________________________________________________________________
3534 TString AliConversionCuts::GetCutNumber(){
3535 // returns TString with current cut number
3537 for(Int_t ii=0;ii<kNCuts;ii++){
3538 a.Append(Form("%d",fCuts[ii]));
3543 ///________________________________________________________________________
3544 void AliConversionCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
3546 Int_t posLabel = photon->GetTrackLabelPositive();
3547 Int_t negLabel = photon->GetTrackLabelNegative();
3549 fElectronLabelArray[nV0*2] = posLabel;
3550 fElectronLabelArray[(nV0*2)+1] = negLabel;
3552 ///________________________________________________________________________
3553 Bool_t AliConversionCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
3555 Int_t posLabel = photon->GetTrackLabelPositive();
3556 Int_t negLabel = photon->GetTrackLabelNegative();
3558 for(Int_t i = 0; i<nV0s*2;i++){
3559 if(i==nV0*2) continue;
3560 if(i==(nV0*2)+1) continue;
3561 if(fElectronLabelArray[i] == posLabel){
3563 if(fElectronLabelArray[i] == negLabel){
3569 ///________________________________________________________________________
3570 Bool_t AliConversionCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
3573 Double_t posX = photon->GetConversionX();
3574 Double_t posY = photon->GetConversionY();
3575 Double_t posZ = photon->GetConversionZ();
3577 for(Int_t i = 0;i<photons->GetEntries();i++){
3578 if(nV0 == i) continue;
3579 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
3580 Double_t posCompX = photonComp->GetConversionX();
3581 Double_t posCompY = photonComp->GetConversionY();
3582 Double_t posCompZ = photonComp->GetConversionZ();
3584 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
3586 if(dist < fminV0Dist*fminV0Dist){
3587 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
3595 ///________________________________________________________________________
3596 void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent){
3600 if(fNotRejectedStart){
3601 delete[] fNotRejectedStart;
3602 fNotRejectedStart = NULL;
3604 if(fNotRejectedEnd){
3605 delete[] fNotRejectedEnd;
3606 fNotRejectedEnd = NULL;
3608 if(fGeneratorNames){
3609 delete[] fGeneratorNames;
3610 fGeneratorNames = NULL;
3613 if(rejection == 0) return; // No Rejection
3615 AliGenCocktailEventHeader *cHeader = 0x0;
3616 AliAODMCHeader *cHeaderAOD = 0x0;
3617 Bool_t headerFound = kFALSE;
3619 if(MCEvent->IsA()==AliMCEvent::Class()){
3620 cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3621 if(cHeader) headerFound = kTRUE;
3623 if(MCEvent->IsA()==AliAODEvent::Class()){ // MCEvent is a AODEvent in case of AOD
3624 cHeaderAOD = dynamic_cast<AliAODMCHeader*>(MCEvent->FindListObject(AliAODMCHeader::StdBranchName()));
3625 if(cHeaderAOD) headerFound = kTRUE;
3629 TList *genHeaders = 0x0;
3630 if(cHeader) genHeaders = cHeader->GetHeaders();
3632 genHeaders = cHeaderAOD->GetCocktailHeaders();
3633 if(genHeaders->GetEntries()==1){
3634 SetRejectExtraSignalsCut(0);
3638 AliGenEventHeader* gh = 0;
3640 if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
3641 if(rejection == 2){ // TList of Headers Names
3642 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3643 gh = (AliGenEventHeader*)genHeaders->At(i);
3644 TString GeneratorName = gh->GetName();
3645 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3646 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3647 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3655 fNotRejectedStart = new Int_t[fnHeaders];
3656 fNotRejectedEnd = new Int_t[fnHeaders];
3657 fGeneratorNames = new TString[fnHeaders];
3659 if(rejection == 1 || rejection == 3){
3660 fNotRejectedStart[0] = 0;
3661 fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
3662 fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
3666 Int_t firstindex = 0;
3667 Int_t lastindex = -1;
3669 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3670 gh = (AliGenEventHeader*)genHeaders->At(i);
3671 TString GeneratorName = gh->GetName();
3672 lastindex = lastindex + gh->NProduced();
3673 for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3674 TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3675 if(GeneratorName.CompareTo(GeneratorInList) == 0){
3676 fNotRejectedStart[nummer] = firstindex;
3677 fNotRejectedEnd[nummer] = lastindex;
3678 fGeneratorNames[nummer] = GeneratorName;
3679 //cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3684 firstindex = firstindex + gh->NProduced();
3686 } else { // No Cocktail Header Found
3687 fNotRejectedStart = new Int_t[1];
3688 fNotRejectedEnd = new Int_t[1];
3691 fNotRejectedStart[0] = 0;
3692 fNotRejectedEnd[0] = static_cast<AliMCEvent*>(MCEvent)->Stack()->GetNprimary()-1;
3693 fGeneratorNames = new TString[1];
3694 fGeneratorNames[0] = "NoCocktailGeneratorFound";
3696 AliGenPythiaEventHeader *mcHeaderPythia = dynamic_cast<AliGenPythiaEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3697 if (mcHeaderPythia) fGeneratorNames[0] = "NoCocktailGeneratorFound_Pythia";
3698 AliGenDPMjetEventHeader *mcHeaderPhojet = dynamic_cast<AliGenDPMjetEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3699 if (mcHeaderPhojet) fGeneratorNames[0] = "NoCocktailGeneratorFound_Phojet";
3700 AliGenHijingEventHeader *mcHeaderHijing = dynamic_cast<AliGenHijingEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
3701 if (mcHeaderHijing) fGeneratorNames[0] = "NoCocktailGeneratorFound_Hijing";
3703 SetRejectExtraSignalsCut(0);
3707 //_________________________________________________________________________
3708 Int_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack, AliVEvent *InputEvent){
3710 // Not Accepted == kFALSE == 0
3711 // Accepted == kTRUE == 1
3712 // FirstHeader == kTRUE == 3
3713 if(index < 0) return 0; // No Particle
3716 if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
3717 if( index >= MCStack->GetNprimary()){ // Secondary Particle
3718 if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother??
3719 return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack,InputEvent);
3721 for(Int_t i = 0;i<fnHeaders;i++){
3722 if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3724 if(i == 0) accepted = 2; // MB Header
3728 else if(InputEvent->IsA()==AliAODEvent::Class()){
3729 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3730 AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3731 if(!aodMCParticle) return 1; // Photon Without a Mother ? --> Accepted
3732 if(!aodMCParticle->IsPrimary()){
3733 if( aodMCParticle->GetMother() < 0) return 1;// Secondary Particle without Mother??
3734 return IsParticleFromBGEvent(aodMCParticle->GetMother(),MCStack,InputEvent);
3736 index = abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
3737 for(Int_t i = 0;i<fnHeaders;i++){
3738 if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3740 if(i == 0) accepted = 2; // MB Header
3747 //_________________________________________________________________________
3748 Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Bool_t isHeavyIon){
3750 if ( !IsTriggerSelected(InputEvent) )
3753 if(isHeavyIon && !(IsCentralitySelected(InputEvent,MCEvent)))
3754 return 1; // Check Centrality --> Not Accepted => eventQuality = 1
3756 if(!isHeavyIon && GetIsFromPileup()){
3757 if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
3759 return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3763 Bool_t hasV0And = ReaderCuts->HasV0AND();
3764 Bool_t isSDDFired = ReaderCuts->IsSDDFired();
3765 if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent)
3766 return 7; // With SDD requested but no fired
3768 if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
3769 return 8; // V0AND requested but no fired
3774 //_________________________________________________________________________
3775 Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliStack *MCStack, AliVEvent *InputEvent){
3776 if (!(period.CompareTo("LHC12f1a") == 0 || period.CompareTo("LHC12f1b") == 0 || period.CompareTo("LHC12i3") == 0 || period.CompareTo("LHC11a10a") == 0 || period.CompareTo("LHC11a10b") == 0 || period.CompareTo("LHC11a10b_bis") == 0 || period.CompareTo("LHC11a10a_bis") == 0 || period.CompareTo("LHC11a10b_plus") == 0 || period.Contains("LHC13d2"))) return 1.;
3779 for (Int_t i = 0; i < fnHeaders; i++){
3780 if (index >= fNotRejectedStart[i] && index < fNotRejectedEnd[i]+1){
3781 if (fGeneratorNames[i].CompareTo("Pythia") == 0){
3783 } else if (fGeneratorNames[i].CompareTo("DPMJET") == 0){
3785 } else if (fGeneratorNames[i].CompareTo("HIJING") == 0 ||
3786 fGeneratorNames[i].CompareTo("Hijing") == 0 ||
3787 fGeneratorNames[i].Contains("hijing")){
3789 } else if (fGeneratorNames[i].CompareTo("BOX") == 0){
3791 } else if (fGeneratorNames[i].CompareTo("PARAM") == 0){
3793 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound") == 0){
3795 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Pythia") == 0){
3797 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Phojet") == 0){
3799 } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Hijing") == 0){
3802 if (period.Contains("LHC13d2")){
3807 if (kCaseGen == 0) return 1;
3810 Double_t mesonPt = 0;
3811 Double_t mesonMass = 0;
3813 if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
3814 mesonPt = ((TParticle*)MCStack->Particle(index))->Pt();
3815 mesonMass = ((TParticle*)MCStack->Particle(index))->GetCalcMass();
3816 PDGCode = ((TParticle*)MCStack->Particle(index))->GetPdgCode();
3818 else if(InputEvent->IsA()==AliAODEvent::Class()){
3819 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3820 AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3821 mesonPt = aodMCParticle->Pt();
3822 mesonMass = aodMCParticle->GetCalcMass();
3823 PDGCode = aodMCParticle->GetPdgCode();
3826 Float_t functionResultMC = 1.;
3827 if (kCaseGen == 1){ // Pythia 6
3828 Float_t dNdyMC = 2.1462;
3829 Float_t nMC = 7.06055;
3830 Float_t tMC = 0.12533;
3831 if ( PDGCode == 111){
3835 } else if ( PDGCode == 221){
3840 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);
3841 } else if (kCaseGen == 2){ // Phojet
3842 Float_t dNdyMC = 2.35978;
3843 Float_t nMC = 6.81795;
3844 Float_t tMC = 0.11492;
3845 if ( PDGCode == 111){
3849 } else if ( PDGCode == 221){
3854 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);
3855 } else if (kCaseGen == 4){ // BOX generators pp
3856 // functionResultMC = 1./sqrt(1.-mesonMass*mesonMass/((mesonMass*mesonMass+mesonPt*mesonPt)*cosh(mesonY)*cosh(mesonY)));
3857 Float_t a = 0.23437;
3859 Float_t c = -1430.5863;
3860 Float_t d = -0.6966624;
3861 Float_t e = 252.3742;
3862 if ( PDGCode == 111){
3868 } else if ( PDGCode == 221){
3875 functionResultMC = a*TMath::Power(mesonPt,-1.*(b+c/(TMath::Power(mesonPt,d)+e)))*1./mesonPt *1./1.6 *1./(2.* TMath::Pi());
3876 // cout << functionResultMC << endl;
3877 } else if (kCaseGen == 3 ){ // HIJING
3878 if ( PDGCode == 111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){
3879 functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt);
3881 if ( PDGCode == 221 && fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0){
3882 functionResultMC = hReweightMCHistEta->Interpolate(mesonPt);
3884 if ( PDGCode == 310 && fDoReweightHistoMCK0s && hReweightMCHistK0s!= 0x0){
3885 functionResultMC = hReweightMCHistK0s->Interpolate(mesonPt);
3889 Float_t functionResultData = 1;
3890 if (kCaseGen == 1 || kCaseGen == 2 || kCaseGen == 4 ){
3891 Float_t dNdyData = 2.2328;
3892 Float_t nData = 7.1473;
3893 Float_t tData = 0.1346;
3894 if ( PDGCode == 111){
3898 } else if ( PDGCode == 221){
3899 dNdyData = 0.38992; //be careful this fit is not optimal, eta in data still has problems
3903 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);
3904 // cout << functionResultData << endl;
3906 if ( PDGCode == 111 && fDoReweightHistoMCPi0 && fFitDataPi0!= 0x0){
3907 functionResultData = fFitDataPi0->Eval(mesonPt);
3909 if ( PDGCode == 221 && fDoReweightHistoMCEta && fFitDataEta!= 0x0){
3910 functionResultData = fFitDataEta->Eval(mesonPt);
3912 if ( PDGCode == 310 && fDoReweightHistoMCK0s && fFitDataK0s!= 0x0){
3913 functionResultData = fFitDataK0s->Eval(mesonPt);
3918 Double_t weight = 1;
3919 if (PDGCode == 111 || PDGCode == 221){
3920 if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){
3921 weight = functionResultData/functionResultMC;
3922 if ( kCaseGen == 3){
3923 if (!(fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode == 111)){
3927 if (!isfinite(functionResultData)) weight = 1.;
3928 if (!isfinite(weight)) weight = 1.;
3930 } else if (PDGCode == 310 && functionResultMC != 0 && isfinite(functionResultMC)){
3931 weight = functionResultMC;
3934 // if (fModCentralityClass == 0 && fCentralityMin == 4 && fCentralityMax == 6 && PDGCode == 111){
3935 // cout << period.Data() << "\t" << kCaseGen << "\t" <<fModCentralityClass<< "\t" <<fCentralityMin<< "\t" <<fCentralityMax << "\t" << mesonPt << "\t" <<mesonMass<< "\t"<<functionResultData << "\t"<< functionResultMC << "\t" << weight <<endl;
3939 ///________________________________________________________________________
3940 AliConversionCuts* AliConversionCuts::GetStandardCuts2010PbPb(){
3941 //Create and return standard 2010 PbPb cuts
3942 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
3943 if(!cuts->InitializeCutsFromCutString("100000204209297002322000000")){
3944 cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
3948 ///________________________________________________________________________
3949 AliConversionCuts* AliConversionCuts::GetStandardCuts2010pp(){
3950 //Create and return standard 2010 PbPb cuts
3951 AliConversionCuts *cuts=new AliConversionCuts("StandardCuts2010pp","StandardCuts2010pp");
3952 if(!cuts->InitializeCutsFromCutString("000001100209366300380000000")){
3953 cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
3956 ///________________________________________________________________________
3957 void AliConversionCuts::GetCorrectEtaShiftFromPeriod(TString periodName){
3959 if(periodName.CompareTo("LHC12g") == 0 || //pilot run 2012
3960 periodName.CompareTo("LHC13b") == 0 || //mainly minimum bias
3961 periodName.CompareTo("LHC13c") == 0 || //mainly minimum bias
3962 periodName.CompareTo("LHC13d") == 0 || //mainly triggered
3963 periodName.CompareTo("LHC13e") == 0 || //mainly triggered
3964 periodName.CompareTo("LHC13c3") == 0 || //MC Starlight, anchor LHC13d+e
3965 periodName.CompareTo("LHC13c2") == 0 || //MC Starlight, coherent J/Psi, UPC muon anchor LHC13d+e
3966 periodName.CompareTo("LHC13b4") == 0 || //MC Pythia 6 (Jet-Jet), anchor LHC13b
3967 periodName.CompareTo("LHC13b2_fix_1") == 0 || //MC DPMJET, anchr LHC13b+c
3968 periodName.CompareTo("LHC13b2_efix_p1") == 0 || //MC DPMJET, anchr LHC13b+c
3969 periodName.CompareTo("LHC13b2_efix_p2") == 0 || //MC DPMJET, anchr LHC13b+c
3970 periodName.CompareTo("LHC13b2_efix_p3") == 0 || //MC DPMJET, anchr LHC13b+c
3971 periodName.CompareTo("LHC13b2_efix_p4") == 0 || //MC DPMJET, anchr LHC13b+c
3972 periodName.CompareTo("LHC13b3") == 0 || //MC HIJING, weighted to number of events per run, anchor LHC13b
3973 periodName.CompareTo("LHC13b2") == 0 || // MC DPMJET, wrong energy, anchor LHC13b
3974 periodName.CompareTo("LHC13b2_plus") == 0 || // MC DPMJET, weighted to number event per run, anchor LHC13b
3975 periodName.CompareTo("LHC13c1_bis") == 0 || // MC AMPT fast generation, pT hardbin, anchor ?
3976 periodName.CompareTo("LHC13c1") == 0 || // MC AMPT fast generation, anchor ?
3977 periodName.CompareTo("LHC13b1") == 0 || // MC DPMJET, fragments, with fixed label 0, anchor LHC12g
3978 periodName.CompareTo("LHC12g4b_fix") == 0 || // MC DPMJET, with fixed label 0, anchor LHC12g
3979 periodName.CompareTo("LHC12g1_fix") == 0 || // MC ?, with fixed label 0, anchor LHC12g
3980 periodName.CompareTo("LHC12g4c") == 0 || // MC DPMJET, shifted vertex runs, anchor LHC12g
3981 periodName.CompareTo("LHC12h6") == 0 || // MC muon cocktail, anchor LHC12g
3982 periodName.CompareTo("LHC12g4b") == 0 || // MC DPMJET 3rd iteration, anchor LHC12g
3983 periodName.CompareTo("LHC12g4a") == 0 || // MC DPMJET improved, anchor LHC12g
3984 periodName.CompareTo("LHC12g4") == 0 || // MC DPMJET, anchor LHC12g
3985 periodName.CompareTo("LHC12g5") == 0 || // MC PHOJET, anchor LHC12g
3986 periodName.CompareTo("LHC12g2") == 0 || // MC Starlight background, anchor LHC12g
3987 periodName.CompareTo("LHC12g1") == 0 ) // MC ?, anchor LHC12g
3989 printf(" Gamma Conversion Cuts %s :: pPb Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),-0.465);
3990 SetEtaShift(-0.465);
3992 else if(periodName.CompareTo("LHC13f") == 0 ||
3993 periodName.CompareTo("LHC13c6b") == 0 ||// MC Jpsi -> mumu, anchor LHC13f
3994 periodName.CompareTo("LHC13c5") == 0 || //MC Starlight, gamma gamma UPC muon, anchor LHC13f
3995 periodName.CompareTo("LHC13c4") == 0 )//MC Starlight, coherent JPsi, UPC muon, anchor LHC13f
3997 printf(" Gamma Conversion Cuts %s :: Pbp Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),0.465);
3998 SetEtaShift(+0.465);
4000 else printf(" Gamma Conversion Cuts %s :: Automatic Eta Shift requested but Period is not known -> No Shift \n\n",(GetCutNumber()).Data());
4003 ///________________________________________________________________________
4004 Bool_t AliConversionCuts::InPlaneOutOfPlaneCut(Double_t photonPhi, Double_t eventPlaneAngle, Bool_t fill){
4006 //GetPhotonPhi() 0-2 Pi //eventPlaneAngle -1pi-1pi
4007 eventPlaneAngle=eventPlaneAngle+TMath::Pi();
4008 Double_t gammaToEPAngle = eventPlaneAngle-photonPhi;
4009 if(gammaToEPAngle < 0) gammaToEPAngle=gammaToEPAngle+2*TMath::Pi();
4010 gammaToEPAngle = gammaToEPAngle-TMath::Pi(); // angle from -pi +pi
4012 if(!fInPlaneOutOfPlane){
4013 if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
4016 else if(fInPlaneOutOfPlane == 1){
4017 if(abs(gammaToEPAngle)<=0.25*TMath::Pi() || abs(gammaToEPAngle)>=0.75*TMath::Pi()){
4018 if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
4023 else if(fInPlaneOutOfPlane == 2){
4024 if(abs(gammaToEPAngle)>0.25*TMath::Pi() && abs(gammaToEPAngle)<0.75*TMath::Pi()){
4025 if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);