1 /****************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Friederike Bock *
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 photon selection cuts for
19 // Gamma Conversion analysis
20 //---------------------------------------------
21 ////////////////////////////////////////////////
23 #include "AliConversionPhotonCuts.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"
53 #include "AliTRDTriggerAnalysis.h"
59 ClassImp(AliConversionPhotonCuts)
62 const char* AliConversionPhotonCuts::fgkCutNames[AliConversionPhotonCuts::kNCuts] = {
69 "pidedxSigmaCut", // 6
70 "piMomdedxSigmaCut", // 7
71 "piMaxMomdedxSigmaCut", // 8
72 "LowPRejectionSigmaCut", // 9
73 "TOFelectronPID", // 10
77 "DoPhotonAsymmetryCut", // 14
78 "CosinePointingAngle", // 15
79 "SharedElectronCuts", // 16
80 "RejectToCloseV0s", // 17
87 //________________________________________________________________________
88 AliConversionPhotonCuts::AliConversionPhotonCuts(const char *name,const char *title) :
89 AliAnalysisCuts(name,title),
103 fLineCutZRSlopeMin(0.),
104 fLineCutZValueMin(0),
105 fChi2CutConversion(1000),
106 fPIDProbabilityCutNegativeParticle(0),
107 fPIDProbabilityCutPositiveParticle(0),
108 fDodEdxSigmaCut(kTRUE),
109 fDoTOFsigmaCut(kFALSE),
110 fPIDTRDEfficiency(1),
112 fPIDnSigmaAboveElectronLine(100),
113 fPIDnSigmaBelowElectronLine(-100),
114 fTofPIDnSigmaAboveElectronLine(100),
115 fTofPIDnSigmaBelowElectronLine(-100),
116 fPIDnSigmaAbovePionLine(0),
117 fPIDnSigmaAbovePionLineHighPt(-100),
118 fPIDMinPnSigmaAbovePionLine(0),
119 fPIDMaxPnSigmaAbovePionLine(0),
120 fDoKaonRejectionLowP(kFALSE),
121 fDoProtonRejectionLowP(kFALSE),
122 fDoPionRejectionLowP(kFALSE),
123 fPIDnSigmaAtLowPAroundKaonLine(0),
124 fPIDnSigmaAtLowPAroundProtonLine(0),
125 fPIDnSigmaAtLowPAroundPionLine(0),
126 fPIDMinPKaonRejectionLowP(1.5),
127 fPIDMinPProtonRejectionLowP(2),
128 fPIDMinPPionRejectionLowP(0),
129 fDoQtGammaSelection(kTRUE),
133 fUseEtaMinCut(kFALSE),
134 fUseOnFlyV0Finder(kTRUE),
135 fDoPhotonAsymmetryCut(kTRUE),
136 fMinPPhotonAsymmetryCut(100.),
137 fMinPhotonAsymmetry(0.),
138 fUseCorrectedTPCClsInfo(kFALSE),
140 fOpeningAngle(0.005),
142 fDo2DPsiPairChi2(kFALSE),
143 fCosPAngleCut(10000),
144 fDoToCloseV0sCut(kFALSE),
146 fDoSharedElecCut(kFALSE),
147 fDoPhotonQualitySelectionCut(kFALSE),
148 fPhotonQualityCut(0),
150 fElectronArraySize(500),
151 fElectronLabelArray(NULL),
152 fDCAZPrimVtxCut(1000),
153 fDCARPrimVtxCut(1000),
154 fInPlaneOutOfPlane(0),
155 fConversionPointXArray(0.0),
156 fConversionPointYArray(0.0),
157 fConversionPointZArray(0.0),
161 hEtaDistV0sAfterdEdxCuts(NULL),
163 hTPCdEdxbefore(NULL),
165 hTPCdEdxSigbefore(NULL),
166 hTPCdEdxSigafter(NULL),
170 hPsiPairDeltaPhiafter(NULL),
173 hInvMassbefore(NULL),
174 hArmenterosbefore(NULL),
176 hArmenterosafter(NULL),
177 hAcceptanceCuts(NULL),
179 hEventPlanePhi(NULL),
183 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
184 fCutString=new TObjString((GetCutNumber()).Data());
186 fElectronLabelArray = new Int_t[fElectronArraySize];
189 //________________________________________________________________________
190 AliConversionPhotonCuts::AliConversionPhotonCuts(const AliConversionPhotonCuts &ref) :
191 AliAnalysisCuts(ref),
196 fEtaCut(ref.fEtaCut),
197 fEtaCutMin(ref.fEtaCutMin),
199 fSinglePtCut(ref.fSinglePtCut),
201 fMinClsTPC(ref.fMinClsTPC),
202 fMinClsTPCToF(ref.fMinClsTPCToF),
203 fLineCutZRSlope(ref.fLineCutZRSlope),
204 fLineCutZValue(ref.fLineCutZValue),
205 fLineCutZRSlopeMin(ref.fLineCutZRSlopeMin),
206 fLineCutZValueMin(ref.fLineCutZValueMin),
207 fChi2CutConversion(ref.fChi2CutConversion),
208 fPIDProbabilityCutNegativeParticle(ref.fPIDProbabilityCutNegativeParticle),
209 fPIDProbabilityCutPositiveParticle(ref.fPIDProbabilityCutPositiveParticle),
210 fDodEdxSigmaCut(ref. fDodEdxSigmaCut),
211 fDoTOFsigmaCut(ref.fDoTOFsigmaCut),
212 fPIDTRDEfficiency(ref.fPIDTRDEfficiency),
213 fDoTRDPID(ref.fDoTRDPID),
214 fPIDnSigmaAboveElectronLine(ref.fPIDnSigmaAboveElectronLine),
215 fPIDnSigmaBelowElectronLine(ref.fPIDnSigmaBelowElectronLine),
216 fTofPIDnSigmaAboveElectronLine(ref.fTofPIDnSigmaAboveElectronLine),
217 fTofPIDnSigmaBelowElectronLine(ref.fTofPIDnSigmaBelowElectronLine),
218 fPIDnSigmaAbovePionLine(ref.fPIDnSigmaAbovePionLine),
219 fPIDnSigmaAbovePionLineHighPt(ref.fPIDnSigmaAbovePionLineHighPt),
220 fPIDMinPnSigmaAbovePionLine(ref.fPIDMinPnSigmaAbovePionLine),
221 fPIDMaxPnSigmaAbovePionLine(ref.fPIDMaxPnSigmaAbovePionLine),
222 fDoKaonRejectionLowP(ref.fDoKaonRejectionLowP),
223 fDoProtonRejectionLowP(ref.fDoProtonRejectionLowP),
224 fDoPionRejectionLowP(ref.fDoPionRejectionLowP),
225 fPIDnSigmaAtLowPAroundKaonLine(ref.fPIDnSigmaAtLowPAroundKaonLine),
226 fPIDnSigmaAtLowPAroundProtonLine(ref.fPIDnSigmaAtLowPAroundProtonLine),
227 fPIDnSigmaAtLowPAroundPionLine(ref.fPIDnSigmaAtLowPAroundPionLine),
228 fPIDMinPKaonRejectionLowP(ref.fPIDMinPKaonRejectionLowP),
229 fPIDMinPProtonRejectionLowP(ref.fPIDMinPProtonRejectionLowP),
230 fPIDMinPPionRejectionLowP(ref.fPIDMinPPionRejectionLowP),
231 fDoQtGammaSelection(ref.fDoQtGammaSelection),
232 fDo2DQt(ref.fDo2DQt),
234 fNSigmaMass(ref.fNSigmaMass),
235 fUseEtaMinCut(ref.fUseEtaMinCut),
236 fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
237 fDoPhotonAsymmetryCut(ref.fDoPhotonAsymmetryCut),
238 fMinPPhotonAsymmetryCut(ref.fMinPPhotonAsymmetryCut),
239 fMinPhotonAsymmetry(ref.fMinPhotonAsymmetry),
240 fUseCorrectedTPCClsInfo(ref.fUseCorrectedTPCClsInfo),
241 fUseTOFpid(ref.fUseTOFpid),
242 fOpeningAngle(ref.fOpeningAngle),
243 fPsiPairCut(ref.fPsiPairCut),
244 fDo2DPsiPairChi2(ref.fDo2DPsiPairChi2),
245 fCosPAngleCut(ref.fCosPAngleCut),
246 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
247 fminV0Dist(ref.fminV0Dist),
248 fDoSharedElecCut(ref.fDoSharedElecCut),
249 fDoPhotonQualitySelectionCut(ref.fDoPhotonQualitySelectionCut),
250 fPhotonQualityCut(ref.fPhotonQualityCut),
251 fRandom(ref.fRandom),
252 fElectronArraySize(ref.fElectronArraySize),
253 fElectronLabelArray(NULL),
254 fDCAZPrimVtxCut(ref.fDCAZPrimVtxCut),
255 fDCARPrimVtxCut(ref.fDCAZPrimVtxCut),
256 fInPlaneOutOfPlane(ref.fInPlaneOutOfPlane),
257 fConversionPointXArray(ref.fConversionPointXArray),
258 fConversionPointYArray(ref.fConversionPointYArray),
259 fConversionPointZArray(ref.fConversionPointZArray),
261 fIsHeavyIon(ref.fIsHeavyIon),
263 hEtaDistV0sAfterdEdxCuts(NULL),
265 hTPCdEdxbefore(NULL),
267 hTPCdEdxSigbefore(NULL),
268 hTPCdEdxSigafter(NULL),
272 hPsiPairDeltaPhiafter(NULL),
275 hInvMassbefore(NULL),
276 hArmenterosbefore(NULL),
278 hArmenterosafter(NULL),
279 hAcceptanceCuts(NULL),
281 hEventPlanePhi(NULL),
282 fPreSelCut(ref.fPreSelCut)
285 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
286 fCutString=new TObjString((GetCutNumber()).Data());
287 fElectronLabelArray = new Int_t[fElectronArraySize];
288 // dont copy histograms (if you like histograms, call InitCutHistograms())
293 //________________________________________________________________________
294 AliConversionPhotonCuts::~AliConversionPhotonCuts() {
296 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
298 // delete fHistograms;
299 // fHistograms = NULL;
300 if(fCutString != NULL){
304 if(fElectronLabelArray){
305 delete fElectronLabelArray;
306 fElectronLabelArray = NULL;
310 //________________________________________________________________________
311 void AliConversionPhotonCuts::InitCutHistograms(TString name, Bool_t preCut){
313 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
314 TH1::AddDirectory(kFALSE);
316 if(fHistograms != NULL){
320 if(fHistograms==NULL){
321 fHistograms=new TList();
322 fHistograms->SetOwner(kTRUE);
323 if(name=="")fHistograms->SetName(Form("ConvCuts_%s",GetCutNumber().Data()));
324 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
328 hCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",11,-0.5,10.5);
329 hCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
330 hCutIndex->GetXaxis()->SetBinLabel(kOnFly+1,"onfly");
331 hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
332 hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
333 hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
334 hCutIndex->GetXaxis()->SetBinLabel(kConvPointFail+1,"ConvPoint fail");
335 hCutIndex->GetXaxis()->SetBinLabel(kPhotonCuts+1,"PhotonCuts");
336 hCutIndex->GetXaxis()->SetBinLabel(kEventPlane+1,"EventPlane");
337 hCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
338 fHistograms->Add(hCutIndex);
341 hTrackCuts=new TH1F(Form("TrackCuts %s",GetCutNumber().Data()),"TrackCuts",9,-0.5,8.5);
342 hTrackCuts->GetXaxis()->SetBinLabel(1,"in");
343 hTrackCuts->GetXaxis()->SetBinLabel(2,"likesign");
344 hTrackCuts->GetXaxis()->SetBinLabel(3,"ntpccl");
345 hTrackCuts->GetXaxis()->SetBinLabel(4,"acceptance");
346 hTrackCuts->GetXaxis()->SetBinLabel(5,"singlept");
347 hTrackCuts->GetXaxis()->SetBinLabel(6,"TPCrefit");
348 hTrackCuts->GetXaxis()->SetBinLabel(7,"kink");
349 hTrackCuts->GetXaxis()->SetBinLabel(8,"out");
350 fHistograms->Add(hTrackCuts);
353 hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",15,-0.5,14.5);
354 hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
355 hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
356 hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
357 hPhotonCuts->GetXaxis()->SetBinLabel(4,"acceptance");
358 hPhotonCuts->GetXaxis()->SetBinLabel(5,"asymmetry");
359 hPhotonCuts->GetXaxis()->SetBinLabel(6,"pidprob");
360 hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
361 hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
362 hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
363 hPhotonCuts->GetXaxis()->SetBinLabel(10,"DCA R");
364 hPhotonCuts->GetXaxis()->SetBinLabel(11,"DCA Z");
365 hPhotonCuts->GetXaxis()->SetBinLabel(12,"Photon Quality");
366 hPhotonCuts->GetXaxis()->SetBinLabel(13,"out");
367 fHistograms->Add(hPhotonCuts);
370 hInvMassbefore=new TH1F(Form("InvMass_before %s",GetCutNumber().Data()),"InvMass_before",1000,0,0.3);
371 fHistograms->Add(hInvMassbefore);
372 hArmenterosbefore=new TH2F(Form("Armenteros_before %s",GetCutNumber().Data()),"Armenteros_before",200,-1,1,1000,0,1.);
373 fHistograms->Add(hArmenterosbefore);
374 hEtaDistV0s = new TH1F(Form("Eta_before %s",GetCutNumber().Data()),"Eta_before",2000,-2,2);
375 fHistograms->Add(hEtaDistV0s);
378 hInvMassafter=new TH1F(Form("InvMass_after %s",GetCutNumber().Data()),"InvMass_after",1000,0,0.3);
379 fHistograms->Add(hInvMassafter);
380 hArmenterosafter=new TH2F(Form("Armenteros_after %s",GetCutNumber().Data()),"Armenteros_after",200,-1,1,250,0,0.25);
381 fHistograms->Add(hArmenterosafter);
383 hAcceptanceCuts=new TH1F(Form("PhotonAcceptanceCuts %s",GetCutNumber().Data()),"PhotonAcceptanceCuts",10,-0.5,9.5);
384 hAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
385 hAcceptanceCuts->GetXaxis()->SetBinLabel(2,"maxR");
386 hAcceptanceCuts->GetXaxis()->SetBinLabel(3,"minR");
387 hAcceptanceCuts->GetXaxis()->SetBinLabel(4,"line");
388 hAcceptanceCuts->GetXaxis()->SetBinLabel(5,"maxZ");
389 hAcceptanceCuts->GetXaxis()->SetBinLabel(6,"eta");
390 hAcceptanceCuts->GetXaxis()->SetBinLabel(7,"minpt");
391 hAcceptanceCuts->GetXaxis()->SetBinLabel(8,"out");
392 fHistograms->Add(hAcceptanceCuts);
395 hdEdxCuts=new TH1F(Form("dEdxCuts %s",GetCutNumber().Data()),"dEdxCuts",10,-0.5,9.5);
396 hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
397 hdEdxCuts->GetXaxis()->SetBinLabel(2,"TPCelectron");
398 hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCpion");
399 hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpionhighp");
400 hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCkaonlowprej");
401 hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCprotonlowprej");
402 hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCpionlowprej");
403 hdEdxCuts->GetXaxis()->SetBinLabel(8,"TOFelectron");
404 hdEdxCuts->GetXaxis()->SetBinLabel(9,"TRDelectron");
405 hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
406 fHistograms->Add(hdEdxCuts);
408 TAxis *AxisBeforedEdx = NULL;
409 TAxis *AxisBeforedEdxSig = NULL;
410 TAxis *AxisBeforeTOF = NULL;
411 TAxis *AxisBeforeTOFSig = NULL;
413 hTPCdEdxbefore=new TH2F(Form("Gamma_dEdx_before %s",GetCutNumber().Data()),"dEdx Gamma before" ,150,0.03,20,800,0,200);
414 fHistograms->Add(hTPCdEdxbefore);
415 AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
416 hTPCdEdxSigbefore=new TH2F(Form("Gamma_dEdxSig_before %s",GetCutNumber().Data()),"dEdx Sigma Gamma before" ,150,0.03,20,400,-10,10);
417 fHistograms->Add(hTPCdEdxSigbefore);
418 AxisBeforedEdxSig = hTPCdEdxSigbefore->GetXaxis();
420 hTOFbefore=new TH2F(Form("Gamma_TOF_before %s",GetCutNumber().Data()),"TOF Gamma before" ,150,0.03,20,11000,-1000,10000);
421 fHistograms->Add(hTOFbefore);
422 AxisBeforeTOF = hTOFbefore->GetXaxis();
423 hTOFSigbefore=new TH2F(Form("Gamma_TOFSig_before %s",GetCutNumber().Data()),"TOF Sigma Gamma before" ,150,0.03,20,400,-6,10);
424 fHistograms->Add(hTOFSigbefore);
425 AxisBeforeTOFSig = hTOFSigbefore->GetXaxis();
428 hTPCdEdxSigafter=new TH2F(Form("Gamma_dEdxSig_after %s",GetCutNumber().Data()),"dEdx Sigma Gamma after" ,150,0.03,20,400, -10,10);
429 fHistograms->Add(hTPCdEdxSigafter);
431 hTPCdEdxafter=new TH2F(Form("Gamma_dEdx_after %s",GetCutNumber().Data()),"dEdx Gamma after" ,150,0.03,20,800,0,200);
432 fHistograms->Add(hTPCdEdxafter);
434 hTOFSigafter=new TH2F(Form("Gamma_TOFSig_after %s",GetCutNumber().Data()),"TOF Sigma Gamma after" ,150,0.03,20,400,-6,10);
435 fHistograms->Add(hTOFSigafter);
437 hEtaDistV0sAfterdEdxCuts = new TH1F(Form("Eta_afterdEdx %s",GetCutNumber().Data()),"Eta_afterdEdx",2000,-2,2);
438 fHistograms->Add(hEtaDistV0sAfterdEdxCuts);
440 hPsiPairDeltaPhiafter=new TH2F(Form("Gamma_PsiPairDeltaPhi_after %s",GetCutNumber().Data()),"Psi Pair vs Delta Phi Gamma after" ,200,-2,2,200,-2,2);
441 fHistograms->Add(hPsiPairDeltaPhiafter);
443 TAxis *AxisAfter = hTPCdEdxSigafter->GetXaxis();
444 Int_t bins = AxisAfter->GetNbins();
445 Double_t from = AxisAfter->GetXmin();
446 Double_t to = AxisAfter->GetXmax();
447 Double_t *newBins = new Double_t[bins+1];
449 Double_t factor = TMath::Power(to/from, 1./bins);
450 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
451 AxisAfter->Set(bins, newBins);
452 AxisAfter = hTOFSigafter->GetXaxis();
453 AxisAfter->Set(bins, newBins);
454 AxisAfter = hTPCdEdxafter->GetXaxis();
455 AxisAfter->Set(bins, newBins);
457 AxisBeforedEdx->Set(bins, newBins);
458 AxisBeforeTOF->Set(bins, newBins);
459 AxisBeforedEdxSig->Set(bins, newBins);
460 AxisBeforeTOFSig->Set(bins, newBins);
464 // Event Cuts and Info
466 hEventPlanePhi=new TH1F(Form("EventPlaneMinusPhotonAngle %s",GetCutNumber().Data()),"EventPlaneMinusPhotonAngle",360,-TMath::Pi(),TMath::Pi());
467 fHistograms->Add(hEventPlanePhi);
471 TH1::AddDirectory(kTRUE);
474 //________________________________________________________________________
475 Bool_t AliConversionPhotonCuts::InitPIDResponse(){
476 // Set Pointer to AliPIDResponse
478 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
480 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
481 fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
482 if(fPIDResponse)return kTRUE;
490 ///________________________________________________________________________
491 Bool_t AliConversionPhotonCuts::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
492 // MonteCarlo Photon Selection
494 if(!fMCStack)return kFALSE;
496 if (particle->GetPdgCode() == 22){
499 if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
502 if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
506 if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
507 return kFALSE; // no photon as mothers!
510 if(particle->GetMother(0) >= fMCStack->GetNprimary()){
511 return kFALSE; // the gamma has a mother, and it is not a primary particle
514 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
516 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
517 TParticle* ePos = NULL;
518 TParticle* eNeg = NULL;
520 if(particle->GetNDaughters() >= 2){
521 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
522 TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
523 if(tmpDaughter->GetUniqueID() == 5){
524 if(tmpDaughter->GetPdgCode() == 11){
526 } else if(tmpDaughter->GetPdgCode() == -11){
533 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
537 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
538 return kFALSE; // no reconstruction below the Pt cut
541 if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
542 eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
545 if(fEtaCutMin > -0.1){
546 if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
547 (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
552 return kFALSE; // cuts on distance from collision point
555 if(abs(ePos->Vz()) > fMaxZ){
556 return kFALSE; // outside material
558 if(abs(eNeg->Vz()) > fMaxZ){
559 return kFALSE; // outside material
562 if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
563 return kFALSE; // line cut to exclude regions where we do not reconstruct
564 } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
568 if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
569 return kFALSE; // line cut to exclude regions where we do not reconstruct
570 } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
575 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
579 ///________________________________________________________________________
580 Bool_t AliConversionPhotonCuts::PhotonIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){
581 // MonteCarlo Photon Selection
583 if(!aodmcArray)return kFALSE;
585 if (particle->GetPdgCode() == 22){
586 if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
589 if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
593 if(particle->GetMother() > -1){
594 if((static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
595 return kFALSE; // no photon as mothers!
597 if(!(static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother()))->IsPrimary())){
598 return kFALSE; // the gamma has a mother, and it is not a primary particle
602 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
604 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
605 AliAODMCParticle* ePos = NULL;
606 AliAODMCParticle* eNeg = NULL;
608 if(particle->GetNDaughters() >= 2){
609 for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
610 AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(aodmcArray->At(daughterIndex));
611 if(!tmpDaughter) continue;
612 if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
613 if(tmpDaughter->GetPdgCode() == 11){
615 } else if(tmpDaughter->GetPdgCode() == -11){
622 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
626 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
627 return kFALSE; // no reconstruction below the Pt cut
630 if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
631 eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
634 if(fEtaCutMin > -0.1){
635 if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
636 (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
640 Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) );
641 Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) );
644 return kFALSE; // cuts on distance from collision point
646 if(abs(ePos->Zv()) > fMaxZ){
647 return kFALSE; // outside material
649 if(abs(eNeg->Zv()) > fMaxZ){
650 return kFALSE; // outside material
653 if( rPos <= ((abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
654 return kFALSE; // line cut to exclude regions where we do not reconstruct
655 } else if ( fEtaCutMin != -0.1 && rPos >= ((abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
659 if( rNeg <= ((abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
660 return kFALSE; // line cut to exclude regions where we do not reconstruct
661 } else if ( fEtaCutMin != -0.1 && rNeg >= ((abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
666 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
671 ///________________________________________________________________________
672 Bool_t AliConversionPhotonCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event)
673 { // Specific Photon Cuts
676 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex);
679 // Fill Histos before Cuts
680 if(hInvMassbefore)hInvMassbefore->Fill(photon->GetMass());
681 if(hArmenterosbefore)hArmenterosbefore->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
683 // Gamma selection based on QT from Armenteros
684 if(fDoQtGammaSelection == kTRUE){
685 if(!ArmenterosQtCut(photon)){
686 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //1
693 if(photon->GetChi2perNDF() > fChi2CutConversion || photon->GetChi2perNDF() <=0){
695 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //2
701 // Reconstruction Acceptance Cuts
702 if(!AcceptanceCuts(photon)){
703 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //3
709 if(fDoPhotonAsymmetryCut == kTRUE){
710 if(!AsymmetryCut(photon,event)){
711 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //4
716 //Check the pid probability
718 if(!PIDProbabilityCut(photon, event)) {
719 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //5
724 if(!CorrectedTPCClusterCut(photon, event)) {
725 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //6
729 Double_t magField = event->GetMagneticField();
730 if( magField < 0.0 ){
736 AliVTrack * electronCandidate = GetTrack(event,photon->GetTrackLabelNegative() );
737 AliVTrack * positronCandidate = GetTrack(event,photon->GetTrackLabelPositive() );
738 Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->Phi()-positronCandidate->Phi());
741 if(!PsiPairCut(photon)) {
742 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //7
747 if(!CosinePAngleCut(photon, event)) {
748 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //8
752 AliAODConversionPhoton* photonAOD = dynamic_cast<AliAODConversionPhoton*>(photon);
754 photonAOD->CalculateDistanceOfClossetApproachToPrimVtx(event->GetPrimaryVertex());
757 if(photonAOD->GetDCArToPrimVtx() > fDCARPrimVtxCut) { //DCA R cut of photon to primary vertex
758 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
763 if(abs(photonAOD->GetDCAzToPrimVtx()) > fDCAZPrimVtxCut) { //DCA Z cut of photon to primary vertex
764 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //10
774 UChar_t photonQuality = 0;
775 AliAODEvent * aodEvent = dynamic_cast<AliAODEvent*>(event);
777 photonQuality = DeterminePhotonQualityAOD(photonAOD, event);
779 photonQuality = photonAOD->GetPhotonQuality();
781 if (fDoPhotonQualitySelectionCut && photonQuality != fPhotonQualityCut){
782 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //11
787 if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //11
790 if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
791 if(hArmenterosafter)hArmenterosafter->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
792 if(hPsiPairDeltaPhiafter)hPsiPairDeltaPhiafter->Fill(deltaPhi,photon->GetPsiPair());
797 ///________________________________________________________________________
798 Bool_t AliConversionPhotonCuts::CorrectedTPCClusterCut(AliConversionPhotonBase *photon, AliVEvent * event)
799 { //Cut on corrected TPC Cluster Info
801 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
802 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
804 if(!negTrack||!posTrack)return kFALSE;
806 Double_t negclsToF=0;
808 if (!fUseCorrectedTPCClsInfo ){
809 if(negTrack->GetTPCNclsF()!=0){
810 negclsToF = (Double_t)negTrack->GetNcls(1)/(Double_t)negTrack->GetTPCNclsF();}// Ncluster/Nfindablecluster
813 negclsToF = negTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
816 Double_t posclsToF = 0.;
817 if (!fUseCorrectedTPCClsInfo ){
818 if(posTrack->GetTPCNclsF()!=0){
819 posclsToF = (Double_t)posTrack->GetNcls(1)/(Double_t)posTrack->GetTPCNclsF();
822 posclsToF = posTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
825 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
832 ///________________________________________________________________________
833 Bool_t AliConversionPhotonCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent * event)
835 //Selection of Reconstructed Photons
837 FillPhotonCutIndex(kPhotonIn);
839 if(event->IsA()==AliESDEvent::Class()) {
840 if(!SelectV0Finder( ( ((AliESDEvent*)event)->GetV0(photon->GetV0Index()))->GetOnFlyStatus() ) ){
841 FillPhotonCutIndex(kOnFly);
845 // else if(event->IsA()==AliAODEvent::Class()) {
846 // if(!SelectV0Finder( ( ((AliAODEvent*)event)->GetV0(photon->GetV0Index())) ) ){
847 // FillPhotonCutIndex(kOnFly);
853 AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
854 AliVTrack * posTrack = GetTrack(event, photon->GetTrackLabelPositive());
856 if(!negTrack || !posTrack) {
857 FillPhotonCutIndex(kNoTracks);
860 photon->DeterminePhotonQuality(negTrack,posTrack);
862 if(!TracksAreSelected(negTrack, posTrack)){
863 FillPhotonCutIndex(kTrackCuts);
866 if (hEtaDistV0s)hEtaDistV0s->Fill(photon->GetPhotonEta());
868 if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
869 FillPhotonCutIndex(kdEdxCuts);
872 if (hEtaDistV0sAfterdEdxCuts)hEtaDistV0sAfterdEdxCuts->Fill(photon->GetPhotonEta());
874 if(!PhotonCuts(photon,event)){
875 FillPhotonCutIndex(kPhotonCuts);
879 // Photon passed cuts
880 FillPhotonCutIndex(kPhotonOut);
884 ///________________________________________________________________________
885 Bool_t AliConversionPhotonCuts::ArmenterosQtCut(AliConversionPhotonBase *photon)
886 { // Armenteros Qt Cut
888 if ( !(TMath::Power(photon->GetArmenterosAlpha()/0.95,2)+TMath::Power(photon->GetArmenterosQt()/fQtMax,2) < 1) ){
892 if(photon->GetArmenterosQt()>fQtMax){
900 ///________________________________________________________________________
901 Bool_t AliConversionPhotonCuts::AcceptanceCuts(AliConversionPhotonBase *photon) {
902 // Exclude certain areas for photon reconstruction
905 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
908 if(photon->GetConversionRadius()>fMaxR){ // cuts on distance from collision point
909 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
914 if(photon->GetConversionRadius()<fMinR){ // cuts on distance from collision point
915 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
920 if(photon->GetConversionRadius() <= ((abs(photon->GetConversionZ())*fLineCutZRSlope)-fLineCutZValue)){
921 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
924 else if (fUseEtaMinCut && photon->GetConversionRadius() >= ((abs(photon->GetConversionZ())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
925 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
930 if(abs(photon->GetConversionZ()) > fMaxZ ){ // cuts out regions where we do not reconstruct
931 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
937 if( photon->GetPhotonEta() > (fEtaCut) || photon->GetPhotonEta() < (-fEtaCut) ){
938 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
942 if( photon->GetPhotonEta() < (fEtaCutMin) && photon->GetPhotonEta() > (-fEtaCutMin) ){
943 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
949 if(photon->GetPhotonPt()<fPtCut){
950 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
955 if(hAcceptanceCuts)hAcceptanceCuts->Fill(cutIndex);
961 ///________________________________________________________________________
962 Bool_t AliConversionPhotonCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex) {
963 // Track Cuts which require AOD/ESD specific implementation
965 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
966 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
971 AliAODVertex * NegVtxType=negTrack->GetProdVertex();
972 AliAODVertex * PosVtxType=posTrack->GetProdVertex();
973 if( (NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
974 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
982 ///________________________________________________________________________
983 Bool_t AliConversionPhotonCuts::SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex) {
984 // Track Cuts which require AOD/ESD specific implementation
986 if( !negTrack->IsOn(AliESDtrack::kTPCrefit) || !posTrack->IsOn(AliESDtrack::kTPCrefit) ) {
987 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
992 if(negTrack->GetKinkIndex(0) > 0 || posTrack->GetKinkIndex(0) > 0 ) {
993 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1001 ///________________________________________________________________________
1002 Bool_t AliConversionPhotonCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * posTrack) {
1003 // Track Selection for Photon Reconstruction
1006 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1010 if(negTrack->Charge() == posTrack->Charge()) {
1011 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1016 // Number of TPC Clusters
1019 if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
1020 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1026 if( posTrack->Eta() > (fEtaCut) || posTrack->Eta() < (-fEtaCut) ||
1027 negTrack->Eta() > (fEtaCut) || negTrack->Eta() < (-fEtaCut) ){
1028 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1031 if(fEtaCutMin>-0.1){
1032 if( (posTrack->Eta() < (fEtaCutMin) && posTrack->Eta() > (-fEtaCutMin)) ||
1033 (negTrack->Eta() < (fEtaCutMin) && negTrack->Eta() > (-fEtaCutMin)) ){
1034 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1041 if( negTrack->Pt()< fSinglePtCut || posTrack->Pt()< fSinglePtCut){
1042 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1047 // AOD ESD specific cuts
1048 Bool_t passCuts = kTRUE;
1050 if(negTrack->IsA()==AliAODTrack::Class()) {
1051 passCuts = passCuts * SpecificTrackCuts(static_cast<AliAODTrack*>(negTrack), static_cast<AliAODTrack*>(posTrack),cutIndex);
1053 passCuts = passCuts * SpecificTrackCuts(static_cast<AliESDtrack*>(negTrack), static_cast<AliESDtrack*>(posTrack),cutIndex);
1057 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1062 if(hTrackCuts)hTrackCuts->Fill(cutIndex);
1068 ///________________________________________________________________________
1069 Bool_t AliConversionPhotonCuts::dEdxCuts(AliVTrack *fCurrentTrack){
1070 // Electron Identification Cuts for Photon reconstruction
1071 if(!fPIDResponse){InitPIDResponse();}// Try to reinitialize PID Response
1072 if(!fPIDResponse){AliError("No PID Response"); return kTRUE;}// if still missing fatal error
1075 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1076 if(hTPCdEdxSigbefore)hTPCdEdxSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1077 if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1080 if(fDodEdxSigmaCut == kTRUE){
1081 // TPC Electron Line
1082 if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1083 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
1085 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1091 if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
1092 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1093 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1094 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1096 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1103 if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
1104 if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1105 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine &&
1106 fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
1108 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1116 if(fDoKaonRejectionLowP == kTRUE){
1117 if(fCurrentTrack->P()<fPIDMinPKaonRejectionLowP ){
1118 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1120 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1126 if(fDoProtonRejectionLowP == kTRUE){
1127 if( fCurrentTrack->P()<fPIDMinPProtonRejectionLowP ){
1128 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1130 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1137 if(fDoPionRejectionLowP == kTRUE){
1138 if( fCurrentTrack->P()<fPIDMinPPionRejectionLowP ){
1139 if( abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1141 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1149 // cout<<"Start"<<endl;
1150 // AliPIDResponse::EDetPidStatus status=fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,fCurrentTrack);
1152 // if( ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) && ( (status & AliVTrack::kTIME) == AliVTrack::kTIME ))
1153 // {cout<<"TOF DA"<<endl;}
1154 // if(status == AliPIDResponse::kDetPidOk){
1155 // Float_t probMis = fPIDResponse->GetTOFMismatchProbability(fCurrentTrack);
1156 // cout<<"--> "<<probMis<<endl;
1157 // if(probMis > 0.01){
1162 if((fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
1164 Double_t t0 = fPIDResponse->GetTOFResponse().GetStartTime(fCurrentTrack->P());
1165 Double_t times[AliPID::kSPECIESC];
1166 fCurrentTrack->GetIntegratedTimes(times);
1167 Double_t TOFsignal = fCurrentTrack->GetTOFsignal();
1168 Double_t dT = TOFsignal - t0 - times[0];
1169 hTOFbefore->Fill(fCurrentTrack->P(),dT);
1171 if(hTOFSigbefore) hTOFSigbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1173 if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
1174 fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
1175 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1179 if(hTOFSigafter)hTOFSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
1184 if(!fPIDResponse->IdentifiedAsElectronTRD(fCurrentTrack,fPIDTRDEfficiency)){
1185 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1191 if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
1192 if(hTPCdEdxSigafter)hTPCdEdxSigafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
1193 if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fCurrentTrack->GetTPCsignal());
1198 ///________________________________________________________________________
1199 Bool_t AliConversionPhotonCuts::AsymmetryCut(AliConversionPhotonBase * photon,AliVEvent *event) {
1200 // Cut on Energy Assymetry
1202 for(Int_t ii=0;ii<2;ii++){
1204 AliVTrack *track=GetTrack(event,photon->GetTrackLabel(ii));
1206 if( track->P() > fMinPPhotonAsymmetryCut ){
1207 Double_t trackNegAsy=0;
1208 if (photon->GetPhotonP()!=0.){
1209 trackNegAsy= track->P()/photon->GetPhotonP();
1212 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1221 ///________________________________________________________________________
1222 AliVTrack *AliConversionPhotonCuts::GetTrack(AliVEvent * event, Int_t label){
1223 //Returns pointer to the track with given ESD label
1224 //(Important for AOD implementation, since Track array in AOD data is different
1225 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1227 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1229 if(label > event->GetNumberOfTracks() ) return NULL;
1230 AliESDtrack * track = esdEvent->GetTrack(label);
1234 AliVTrack * track = 0x0;
1235 if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->AreAODsRelabeled()){
1236 track = dynamic_cast<AliVTrack*>(event->GetTrack(label));
1240 for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
1241 track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
1243 if(track->GetID() == label) {
1250 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1254 ///________________________________________________________________________
1255 AliESDtrack *AliConversionPhotonCuts::GetESDTrack(AliESDEvent * event, Int_t label){
1256 //Returns pointer to the track with given ESD label
1257 //(Important for AOD implementation, since Track array in AOD data is different
1258 //from ESD array, but ESD tracklabels are stored in AOD Tracks)
1261 if(label > event->GetNumberOfTracks() ) return NULL;
1262 AliESDtrack * track = event->GetTrack(label);
1265 //AliDebug(5,(Form("track not found %d %d",label,event->GetNumberOfTracks()));
1271 ///________________________________________________________________________
1272 Bool_t AliConversionPhotonCuts::PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event){
1273 // Cut on Electron Probability for Photon Reconstruction
1275 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
1279 Bool_t iResult=kFALSE;
1281 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1282 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1284 AliESDtrack* negTrack = esdEvent->GetTrack(photon->GetTrackLabelNegative());
1285 AliESDtrack* posTrack = esdEvent->GetTrack(photon->GetTrackLabelPositive());
1287 if(negProbArray && posProbArray){
1289 negTrack->GetTPCpid(negProbArray);
1290 posTrack->GetTPCpid(posProbArray);
1292 if(negProbArray[AliPID::kElectron]>=fPIDProbabilityCutNegativeParticle && posProbArray[AliPID::kElectron]>=fPIDProbabilityCutPositiveParticle){
1297 delete [] posProbArray;
1298 delete [] negProbArray;
1302 ///Not possible for AODs
1308 ///________________________________________________________________________
1309 Bool_t AliConversionPhotonCuts::AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg){
1310 // MC Acceptance Cuts
1311 //(Certain areas were excluded for photon reconstruction)
1313 if(particle->R()>fMaxR){
1316 if(ePos->R()>fMaxR){
1320 if(ePos->R()<fMinR){
1324 if( ePos->R() <= ((abs(ePos->Vz())*fLineCutZRSlope)-fLineCutZValue)){
1327 else if (fUseEtaMinCut && ePos->R() >= ((abs(ePos->Vz())*fLineCutZRSlopeMin)-fLineCutZValueMin )){
1331 if(abs(eNeg->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1335 if(eNeg->Vz()!=ePos->Vz()||eNeg->R()!=ePos->R()){
1339 if(abs(ePos->Vz()) > fMaxZ ){ // cuts out regions where we do not reconstruct
1344 if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) ){
1347 if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ){
1350 if( eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) ){
1353 if(fEtaCutMin>-0.1){
1354 if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) ){
1357 if( ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin) ){
1360 if( eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin) ){
1365 if( ePos->Pt()< fSinglePtCut || eNeg->Pt()< fSinglePtCut){
1369 if(particle->Pt()<fPtCut){
1375 ///________________________________________________________________________
1376 Bool_t AliConversionPhotonCuts::UpdateCutString() {
1377 ///Update the cut string (if it has been created yet)
1379 if(fCutString && fCutString->GetString().Length() == kNCuts) {
1380 fCutString->SetString(GetCutNumber());
1388 ///________________________________________________________________________
1389 Bool_t AliConversionPhotonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
1390 // Initialize Cuts from a given Cut string
1391 AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
1392 if(analysisCutSelection.Length()!=kNCuts) {
1393 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
1396 if(!analysisCutSelection.IsDigit()){
1397 AliError("Cut selection contains characters");
1401 const char *cutSelection = analysisCutSelection.Data();
1402 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
1403 for(Int_t ii=0;ii<kNCuts;ii++){
1407 // Set Individual Cuts
1408 for(Int_t ii=0;ii<kNCuts;ii++){
1409 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
1412 PrintCutsWithValues();
1416 ///________________________________________________________________________
1417 Bool_t AliConversionPhotonCuts::SetCut(cutIds cutID, const Int_t value) {
1418 ///Set individual cut ID
1423 if( SetV0Finder(value)) {
1424 fCuts[kv0FinderType] = value;
1427 } else return kFALSE;
1429 case kededxSigmaCut:
1430 if( SetTPCdEdxCutElectronLine(value)) {
1431 fCuts[kededxSigmaCut] = value;
1434 } else return kFALSE;
1436 case kpidedxSigmaCut:
1437 if( SetTPCdEdxCutPionLine(value)) {
1438 fCuts[kpidedxSigmaCut] = value;
1441 } else return kFALSE;
1443 case kpiMomdedxSigmaCut:
1444 if( SetMinMomPiondEdxCut(value)) {
1445 fCuts[kpiMomdedxSigmaCut] = value;
1448 } else return kFALSE;
1451 if( SetChi2GammaCut(value)) {
1452 fCuts[kchi2GammaCut] = value;
1455 } else return kFALSE;
1458 if( SetSinglePtCut(value)) {
1459 fCuts[ksinglePtCut] = value;
1462 } else return kFALSE;
1465 if( SetTPCClusterCut(value)) {
1466 fCuts[kclsTPCCut] = value;
1469 } else return kFALSE;
1472 if( SetEtaCut(value)) {
1473 fCuts[ketaCut] = value;
1476 } else return kFALSE;
1478 case kLowPRejectionSigmaCut:
1479 if( SetLowPRejectionCuts(value)) {
1480 fCuts[kLowPRejectionSigmaCut] = value;
1483 } else return kFALSE;
1486 if( SetQtMaxCut(value)) {
1487 fCuts[kQtMaxCut] = value;
1490 } else return kFALSE;
1492 case kpiMaxMomdedxSigmaCut:
1493 if( SetMaxMomPiondEdxCut(value)) {
1494 fCuts[kpiMaxMomdedxSigmaCut] = value;
1497 } else return kFALSE;
1500 if( SetRCut(value)) {
1501 fCuts[kRCut] = value;
1504 } else return kFALSE;
1506 case kTOFelectronPID:
1507 if( SetTOFElectronPIDCut(value)) {
1508 fCuts[kTOFelectronPID] = value;
1511 } else return kFALSE;
1513 case kdoPhotonAsymmetryCut:
1514 if( SetPhotonAsymmetryCut(value)) {
1515 fCuts[kdoPhotonAsymmetryCut] = value;
1518 } else return kFALSE;
1521 if( SetPsiPairCut(value)) {
1522 fCuts[kPsiPair] = value;
1525 } else return kFALSE;
1528 if( SetCosPAngleCut(value)) {
1529 fCuts[kCosPAngle] = value;
1532 } else return kFALSE;
1536 if( SetSharedElectronCut(value)) {
1537 fCuts[kElecShare] = value;
1540 } else return kFALSE;
1543 if( SetToCloseV0sCut(value)) {
1544 fCuts[kToCloseV0s] = value;
1547 } else return kFALSE;
1550 if( SetDCARPhotonPrimVtxCut(value)) {
1551 fCuts[kDcaRPrimVtx] = value;
1554 } else return kFALSE;
1557 if( SetDCAZPhotonPrimVtxCut(value)) {
1558 fCuts[kDcaZPrimVtx] = value;
1561 } else return kFALSE;
1563 case kInPlaneOutOfPlane:
1564 if( SetInPlaneOutOfPlane(value)) {
1565 fCuts[kInPlaneOutOfPlane] = value;
1568 } else return kFALSE;
1574 AliError("Cut id out of range");
1578 AliError("Cut id %d not recognized");
1583 ///________________________________________________________________________
1584 void AliConversionPhotonCuts::PrintCuts() {
1585 // Print out current Cut Selection
1586 for(Int_t ic = 0; ic < kNCuts; ic++) {
1587 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
1591 void AliConversionPhotonCuts::PrintCutsWithValues() {
1592 // Print out current Cut Selection with value
1593 printf("\nConversion cutnumber \n");
1594 for(Int_t ic = 0; ic < kNCuts; ic++) {
1595 printf("%d",fCuts[ic]);
1598 printf("Electron cuts & Secondary Track Cuts - only track from secondaries enter analysis: \n");
1599 printf("\t no like sign pairs from V0s \n");
1600 if (!fUseCorrectedTPCClsInfo) printf("\t # TPC clusters > %3.2f \n", fMinClsTPC);
1601 if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{e} < %3.2f\n", fEtaCutMin, fEtaCut );
1602 else printf("\t eta_{e} < %3.2f\n", fEtaCut );
1603 printf("\t p_{T,e} > %3.2f\n", fSinglePtCut );
1604 printf("\t TPC refit \n");
1605 printf("\t no kinks \n");
1606 printf("\t accept: %3.2f < n sigma_{e,TPC} < %3.2f\n", fPIDnSigmaBelowElectronLine, fPIDnSigmaAboveElectronLine );
1607 printf("\t reject: %3.2f < p_{e,T} < %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMinPnSigmaAbovePionLine, fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLine );
1608 printf("\t reject: p_{e,T} > %3.2f, n sigma_{pi,TPC} < %3.2f\n", fPIDMaxPnSigmaAbovePionLine, fPIDnSigmaAbovePionLineHighPt );
1609 if (fDoPionRejectionLowP) printf("\t reject: p_{e,T} < %3.2f, -%3.2f < n sigma_{pi,TPC} < %3.2f\n", fPIDMinPPionRejectionLowP, fPIDnSigmaAtLowPAroundPionLine, fPIDnSigmaAtLowPAroundPionLine );
1610 if (fDoKaonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{K,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundKaonLine, fPIDnSigmaAtLowPAroundKaonLine );
1611 if (fDoProtonRejectionLowP) printf("\t reject: -%3.2f < n sigma_{K,TPC} < %3.2f\n", fPIDnSigmaAtLowPAroundProtonLine, fPIDnSigmaAtLowPAroundProtonLine );
1612 if (fUseTOFpid) printf("\t accept: %3.2f < n sigma_{e,TOF} < %3.2f\n", fTofPIDnSigmaBelowElectronLine, fTofPIDnSigmaAboveElectronLine);
1614 printf("Photon cuts: \n");
1615 if (fUseOnFlyV0Finder) printf("\t using Onfly V0 finder \n");
1616 else printf("\t using Offline V0 finder \n");
1618 printf("\t 2 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
1620 printf("\t 1 dimensional q_{T} cut applied with maximum of %3.2f \n", fQtMax );
1622 if (fDo2DPsiPairChi2){
1623 printf("\t 2 dimensional triangle chi^{2} and psi_{pair} cut applied with maximum of chi^{2} = %3.2f and |psi_{pair}| = %3.2f \n", fChi2CutConversion, fPsiPairCut );
1625 printf("\t chi^{2} max cut chi^{2} < %3.2f \n", fChi2CutConversion );
1626 printf("\t psi_{pair} max cut |psi_{pair}| < %3.2f \n", fPsiPairCut );
1628 printf("\t %3.2f < R_{conv} < %3.2f\n", fMinR, fMaxR );
1629 printf("\t Z_{conv} < %3.2f\n", fMaxZ );
1630 if (fEtaCutMin > -0.1) printf("\t %3.2f < eta_{conv} < %3.2f\n", fEtaCutMin, fEtaCut );
1631 else printf("\t eta_{conv} < %3.2f\n", fEtaCut );
1632 if (fDoPhotonAsymmetryCut) printf("\t for p_{T,track} > %3.2f, A_{gamma} < %3.2f \n", fMinPPhotonAsymmetryCut, fMinPhotonAsymmetry );
1633 if (fUseCorrectedTPCClsInfo) printf("\t #cluster TPC/ #findable clusters TPC (corrected for radius) > %3.2f\n", fMinClsTPCToF );
1634 printf("\t p_{T,gamma} > %3.2f\n", fPtCut );
1635 printf("\t cos(Theta_{point}) > %3.2f \n", fCosPAngleCut );
1636 printf("\t dca_{R} < %3.2f \n", fDCARPrimVtxCut );
1637 printf("\t dca_{Z} < %3.2f \n", fDCAZPrimVtxCut );
1638 if (fDoPhotonQualitySelectionCut) printf("\t selection based on photon quality with quality %d \n", fPhotonQualityCut );
1641 ///________________________________________________________________________
1642 Bool_t AliConversionPhotonCuts::SetV0Finder(Int_t v0FinderType)
1644 switch (v0FinderType){
1645 case 0: // on fly V0 finder
1646 cout << "have chosen onfly V0" << endl;
1647 fUseOnFlyV0Finder=kTRUE;
1649 case 1: // offline V0 finder
1650 cout << "have chosen offline V0" << endl;
1651 fUseOnFlyV0Finder=kFALSE;
1654 AliError(Form(" v0FinderType not defined %d",v0FinderType));
1660 ///________________________________________________________________________
1661 Bool_t AliConversionPhotonCuts::SetEtaCut(Int_t etaCut)
1664 //Set Standard LineCutZValues
1665 fLineCutZValueMin = -2;
1666 fLineCutZValue = 7.;
1671 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1673 fLineCutZRSlopeMin = 0.;
1675 case 1: // 0.6 // changed from 1.2 to 0.6 on 2013.06.10
1677 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1679 fLineCutZRSlopeMin = 0.;
1683 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1685 fLineCutZRSlopeMin = 0.;
1689 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1691 fLineCutZRSlopeMin = 0.;
1695 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1697 fLineCutZRSlopeMin = 0.;
1701 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1703 fLineCutZRSlopeMin = 0.;
1707 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1709 fLineCutZRSlopeMin = 0.;
1712 if (fIsHeavyIon==1){
1714 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1716 fLineCutZRSlopeMin = 0.;
1720 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1722 fLineCutZRSlopeMin = 0.;
1725 // case 8: // 0.1 - 0.8
1727 // fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1728 // fEtaCutMin = 0.1;
1729 // fLineCutZRSlopeMin = tan(2*atan(exp(-fEtaCutMin)));
1733 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1735 fLineCutZRSlopeMin = 0.;
1739 fLineCutZRSlope = tan(2*atan(exp(-fEtaCut)));
1741 fLineCutZRSlopeMin = 0.;
1744 AliError(Form(" EtaCut not defined %d",etaCut));
1750 ///________________________________________________________________________
1751 Bool_t AliConversionPhotonCuts::SetRCut(Int_t RCut){
1784 fMinR = 35.; //old 26.
1796 AliError("RCut not defined");
1802 ///________________________________________________________________________
1803 Bool_t AliConversionPhotonCuts::SetSinglePtCut(Int_t singlePtCut)
1805 switch(singlePtCut){
1806 case 0: // 0.050 GeV
1807 fSinglePtCut = 0.050;
1809 case 1: // 0.100 GeV
1810 fSinglePtCut = 0.100;
1812 case 2: // 0.150 GeV
1813 fSinglePtCut = 0.150;
1815 case 3: // 0.200 GeV
1816 fSinglePtCut = 0.200;
1818 case 4: // 0.075 GeV
1819 fSinglePtCut = 0.075;
1821 case 5: // 0.125 GeV
1822 fSinglePtCut = 0.125;
1825 fSinglePtCut = 0.040;
1831 AliError(Form("singlePtCut not defined %d",singlePtCut));
1837 ///________________________________________________________________________
1838 Bool_t AliConversionPhotonCuts::SetTPCClusterCut(Int_t clsTPCCut)
1853 case 4: // 95% of findable clusters
1854 fMinClsTPCToF= 0.95;
1855 fUseCorrectedTPCClsInfo=1;
1857 case 5: // 0% of findable clusters
1859 fUseCorrectedTPCClsInfo=1;
1861 case 6: // 70% of findable clusters
1863 fUseCorrectedTPCClsInfo=1;
1865 case 7: // 0% of findable clusters
1866 fMinClsTPCToF= 0.35;
1867 fUseCorrectedTPCClsInfo=0;
1870 fMinClsTPCToF= 0.35;
1871 fUseCorrectedTPCClsInfo=1;
1875 fUseCorrectedTPCClsInfo=1;
1878 AliError(Form("Warning: clsTPCCut not defined %d",clsTPCCut));
1884 ///________________________________________________________________________
1885 Bool_t AliConversionPhotonCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
1887 switch(ededxSigmaCut){
1889 fPIDnSigmaBelowElectronLine=-10;
1890 fPIDnSigmaAboveElectronLine=10;
1893 fPIDnSigmaBelowElectronLine=-5;
1894 fPIDnSigmaAboveElectronLine=5;
1897 fPIDnSigmaBelowElectronLine=-3;
1898 fPIDnSigmaAboveElectronLine=5;
1901 fPIDnSigmaBelowElectronLine=-4;
1902 fPIDnSigmaAboveElectronLine=5;
1905 fPIDnSigmaBelowElectronLine=-6;
1906 fPIDnSigmaAboveElectronLine=7;
1909 fPIDnSigmaBelowElectronLine=-4;
1910 fPIDnSigmaAboveElectronLine=4;
1913 fPIDnSigmaBelowElectronLine=-2.5;
1914 fPIDnSigmaAboveElectronLine=4;
1917 fPIDnSigmaBelowElectronLine=-2;
1918 fPIDnSigmaAboveElectronLine=3.5;
1921 AliError("TPCdEdxCutElectronLine not defined");
1928 ///________________________________________________________________________
1929 Bool_t AliConversionPhotonCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
1932 switch(pidedxSigmaCut){
1934 fPIDnSigmaAbovePionLine=-10;
1935 fPIDnSigmaAbovePionLineHighPt=-10;
1938 fPIDnSigmaAbovePionLine=0;
1939 fPIDnSigmaAbovePionLineHighPt=-10;
1942 fPIDnSigmaAbovePionLine=1;
1943 fPIDnSigmaAbovePionLineHighPt=-10;
1946 fPIDnSigmaAbovePionLine=2.5;
1947 fPIDnSigmaAbovePionLineHighPt=-10;
1950 fPIDnSigmaAbovePionLine=0.5;
1951 fPIDnSigmaAbovePionLineHighPt=-10;
1954 fPIDnSigmaAbovePionLine=2.;
1955 fPIDnSigmaAbovePionLineHighPt=-10;
1958 fPIDnSigmaAbovePionLine=2.;
1959 fPIDnSigmaAbovePionLineHighPt=0.5;
1962 fPIDnSigmaAbovePionLine=3.5;
1963 fPIDnSigmaAbovePionLineHighPt=-10;
1966 fPIDnSigmaAbovePionLine=2.;
1967 fPIDnSigmaAbovePionLineHighPt=1.;
1970 fPIDnSigmaAbovePionLine=3.0; // We need a bit less tight cut on dE/dx
1971 fPIDnSigmaAbovePionLineHighPt=-10;
1974 AliError(Form("Warning: pidedxSigmaCut not defined %d",pidedxSigmaCut));
1980 ///________________________________________________________________________
1981 Bool_t AliConversionPhotonCuts::SetMinMomPiondEdxCut(Int_t piMomdedxSigmaCut)
1983 switch(piMomdedxSigmaCut){
1985 fPIDMinPnSigmaAbovePionLine=0.5;
1988 fPIDMinPnSigmaAbovePionLine=1.;
1991 fPIDMinPnSigmaAbovePionLine=1.5;
1994 fPIDMinPnSigmaAbovePionLine=20.;
1997 fPIDMinPnSigmaAbovePionLine=50.;
2000 fPIDMinPnSigmaAbovePionLine=0.3;
2003 fPIDMinPnSigmaAbovePionLine=0.25;
2006 fPIDMinPnSigmaAbovePionLine=0.4;
2009 fPIDMinPnSigmaAbovePionLine=0.2;
2012 AliError(Form("piMomdedxSigmaCut not defined %d",piMomdedxSigmaCut));
2018 ///________________________________________________________________________
2019 Bool_t AliConversionPhotonCuts::SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
2021 switch(piMaxMomdedxSigmaCut){
2023 fPIDMaxPnSigmaAbovePionLine=100.;
2026 fPIDMaxPnSigmaAbovePionLine=5.;
2029 fPIDMaxPnSigmaAbovePionLine=4.;
2032 fPIDMaxPnSigmaAbovePionLine=3.5;
2035 fPIDMaxPnSigmaAbovePionLine=3.;
2038 fPIDMaxPnSigmaAbovePionLine=7.;
2041 AliError(Form("piMaxMomdedxSigmaCut not defined %d",piMaxMomdedxSigmaCut));
2047 ///________________________________________________________________________
2048 Bool_t AliConversionPhotonCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
2050 switch(LowPRejectionSigmaCut){
2052 fPIDnSigmaAtLowPAroundKaonLine=0;
2053 fPIDnSigmaAtLowPAroundProtonLine=0;
2054 fPIDnSigmaAtLowPAroundPionLine=0;
2055 fDoKaonRejectionLowP = kFALSE;
2056 fDoProtonRejectionLowP = kFALSE;
2057 fDoPionRejectionLowP = kFALSE;
2058 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2061 fPIDnSigmaAtLowPAroundKaonLine=0.5;
2062 fPIDnSigmaAtLowPAroundProtonLine=0.5;
2063 fPIDnSigmaAtLowPAroundPionLine=0.5;
2064 fDoKaonRejectionLowP = kTRUE;
2065 fDoProtonRejectionLowP = kTRUE;
2066 fDoPionRejectionLowP = kTRUE;
2067 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2070 fPIDnSigmaAtLowPAroundKaonLine=1;
2071 fPIDnSigmaAtLowPAroundProtonLine=1;
2072 fPIDnSigmaAtLowPAroundPionLine=1;
2073 fDoKaonRejectionLowP = kTRUE;
2074 fDoProtonRejectionLowP = kTRUE;
2075 fDoPionRejectionLowP = kTRUE;
2076 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2079 fPIDnSigmaAtLowPAroundKaonLine=2.;
2080 fPIDnSigmaAtLowPAroundProtonLine=2.;
2081 fPIDnSigmaAtLowPAroundPionLine=2.;
2082 fDoKaonRejectionLowP = kTRUE;
2083 fDoProtonRejectionLowP = kTRUE;
2084 fDoPionRejectionLowP = kTRUE;
2085 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2088 fPIDnSigmaAtLowPAroundKaonLine=0.;
2089 fPIDnSigmaAtLowPAroundProtonLine=0.;
2090 fPIDnSigmaAtLowPAroundPionLine=1;
2091 fDoKaonRejectionLowP = kFALSE;
2092 fDoProtonRejectionLowP = kFALSE;
2093 fDoPionRejectionLowP = kTRUE;
2094 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2097 fPIDnSigmaAtLowPAroundKaonLine=0.;
2098 fPIDnSigmaAtLowPAroundProtonLine=0.;
2099 fPIDnSigmaAtLowPAroundPionLine=1.5;
2100 fDoKaonRejectionLowP = kFALSE;
2101 fDoProtonRejectionLowP = kFALSE;
2102 fDoPionRejectionLowP = kTRUE;
2103 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2106 fPIDnSigmaAtLowPAroundKaonLine=0.;
2107 fPIDnSigmaAtLowPAroundProtonLine=0.;
2108 fPIDnSigmaAtLowPAroundPionLine=2.;
2109 fDoKaonRejectionLowP = kFALSE;
2110 fDoProtonRejectionLowP = kFALSE;
2111 fDoPionRejectionLowP = kTRUE;
2112 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2115 fPIDnSigmaAtLowPAroundKaonLine=0.;
2116 fPIDnSigmaAtLowPAroundProtonLine=0.;
2117 fPIDnSigmaAtLowPAroundPionLine=0.5;
2118 fDoKaonRejectionLowP = kFALSE;
2119 fDoProtonRejectionLowP = kFALSE;
2120 fDoPionRejectionLowP = kTRUE;
2121 fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLine;
2124 AliError(Form("LowPRejectionSigmaCut not defined %d",LowPRejectionSigmaCut));
2130 ///________________________________________________________________________
2131 Bool_t AliConversionPhotonCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
2133 switch(TOFelectronPID){
2135 fUseTOFpid = kFALSE;
2136 fTofPIDnSigmaBelowElectronLine=-100;
2137 fTofPIDnSigmaAboveElectronLine=100;
2141 fTofPIDnSigmaBelowElectronLine=-7;
2142 fTofPIDnSigmaAboveElectronLine=7;
2146 fTofPIDnSigmaBelowElectronLine=-5;
2147 fTofPIDnSigmaAboveElectronLine=5;
2151 fTofPIDnSigmaBelowElectronLine=-3;
2152 fTofPIDnSigmaAboveElectronLine=5;
2156 fTofPIDnSigmaBelowElectronLine=-2;
2157 fTofPIDnSigmaAboveElectronLine=3;
2161 fTofPIDnSigmaBelowElectronLine=-3;
2162 fTofPIDnSigmaAboveElectronLine=3;
2165 AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
2171 ///________________________________________________________________________
2172 Bool_t AliConversionPhotonCuts::SetQtMaxCut(Int_t QtMaxCut)
2177 fDoQtGammaSelection=kFALSE;
2217 AliError(Form("Warning: QtMaxCut not defined %d",QtMaxCut));
2223 ///________________________________________________________________________
2224 Bool_t AliConversionPhotonCuts::SetChi2GammaCut(Int_t chi2GammaCut)
2227 switch(chi2GammaCut){
2229 fChi2CutConversion = 100.;
2232 fChi2CutConversion = 50.;
2235 fChi2CutConversion = 30.;
2238 fChi2CutConversion = 200.;
2241 fChi2CutConversion = 500.;
2244 fChi2CutConversion = 100000.;
2247 fChi2CutConversion = 5.;
2250 fChi2CutConversion = 10.;
2253 fChi2CutConversion = 20.;
2256 fChi2CutConversion = 15.;
2259 AliError(Form("Warning: Chi2GammaCut not defined %d",chi2GammaCut));
2265 ///________________________________________________________________________
2266 Bool_t AliConversionPhotonCuts::SetPsiPairCut(Int_t psiCut) {
2270 fPsiPairCut = 10000; //
2273 fPsiPairCut = 0.1; //
2276 fPsiPairCut = 0.05; // Standard
2279 fPsiPairCut = 0.035; //
2282 fPsiPairCut = 0.2; //
2285 fPsiPairCut = 0.1; //
2286 fDo2DPsiPairChi2 = kTRUE;
2289 fPsiPairCut = 0.05; //
2290 fDo2DPsiPairChi2 = kTRUE;
2293 fPsiPairCut = 0.035; //
2294 fDo2DPsiPairChi2 = kTRUE;
2297 fPsiPairCut = 0.2; //
2298 fDo2DPsiPairChi2 = kTRUE; //
2301 fPsiPairCut = 0.5; //
2304 AliError(Form("PsiPairCut not defined %d",psiCut));
2311 ///________________________________________________________________________
2312 Bool_t AliConversionPhotonCuts::SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut){
2314 switch(doPhotonAsymmetryCut){
2316 fDoPhotonAsymmetryCut=0;
2317 fMinPPhotonAsymmetryCut=100.;
2318 fMinPhotonAsymmetry=0.;
2321 fDoPhotonAsymmetryCut=1;
2322 fMinPPhotonAsymmetryCut=3.5;
2323 fMinPhotonAsymmetry=0.04;
2326 fDoPhotonAsymmetryCut=1;
2327 fMinPPhotonAsymmetryCut=3.5;
2328 fMinPhotonAsymmetry=0.06;
2331 fDoPhotonAsymmetryCut=1;
2332 fMinPPhotonAsymmetryCut=0.0;
2333 fMinPhotonAsymmetry=0.05;
2336 AliError(Form("PhotonAsymmetryCut not defined %d",doPhotonAsymmetryCut));
2339 fCuts[kdoPhotonAsymmetryCut]=doPhotonAsymmetryCut;
2343 ///________________________________________________________________________
2344 Bool_t AliConversionPhotonCuts::SetCosPAngleCut(Int_t cosCut) {
2354 fCosPAngleCut = 0.5;
2357 fCosPAngleCut = 0.75;
2360 fCosPAngleCut = 0.85;
2363 fCosPAngleCut = 0.88;
2366 fCosPAngleCut = 0.9;
2369 fCosPAngleCut = 0.95;
2372 AliError(Form("Cosine Pointing Angle cut not defined %d",cosCut));
2379 ///________________________________________________________________________
2380 Bool_t AliConversionPhotonCuts::SetSharedElectronCut(Int_t sharedElec) {
2384 fDoSharedElecCut = kFALSE;
2385 fDoPhotonQualitySelectionCut = kFALSE;
2386 fPhotonQualityCut = 0;
2389 fDoSharedElecCut = kTRUE;
2390 fDoPhotonQualitySelectionCut = kFALSE;
2391 fPhotonQualityCut = 0;
2394 fDoSharedElecCut = kFALSE;
2395 fDoPhotonQualitySelectionCut = kTRUE;
2396 fPhotonQualityCut = 1;
2399 fDoSharedElecCut = kFALSE;
2400 fDoPhotonQualitySelectionCut = kTRUE;
2401 fPhotonQualityCut = 2;
2404 fDoSharedElecCut = kFALSE;
2405 fDoPhotonQualitySelectionCut = kTRUE;
2406 fPhotonQualityCut = 3;
2409 AliError(Form("Shared Electron Cut not defined %d",sharedElec));
2416 ///________________________________________________________________________
2417 Bool_t AliConversionPhotonCuts::SetToCloseV0sCut(Int_t toClose) {
2421 fDoToCloseV0sCut = kFALSE;
2425 fDoToCloseV0sCut = kTRUE;
2429 fDoToCloseV0sCut = kTRUE;
2433 fDoToCloseV0sCut = kTRUE;
2437 AliError(Form("Shared Electron Cut not defined %d",toClose));
2443 ///________________________________________________________________________
2444 Bool_t AliConversionPhotonCuts::SetTRDElectronCut(Int_t TRDElectronCut)
2446 switch(TRDElectronCut){
2452 fPIDTRDEfficiency=0.1;
2456 fPIDTRDEfficiency=0.8;
2460 fPIDTRDEfficiency=0.9;
2463 AliError(Form("TRDElectronCut not defined %d",TRDElectronCut));
2470 ///________________________________________________________________________
2471 Bool_t AliConversionPhotonCuts::SetDCAZPhotonPrimVtxCut(Int_t DCAZPhotonPrimVtx){
2473 switch(DCAZPhotonPrimVtx){
2475 fDCAZPrimVtxCut = 1000;
2478 fDCAZPrimVtxCut = 10;
2481 fDCAZPrimVtxCut = 5;
2484 fDCAZPrimVtxCut = 4;
2487 fDCAZPrimVtxCut = 3;
2490 fDCAZPrimVtxCut = 2.5;
2493 fDCAZPrimVtxCut = 2;
2496 fDCAZPrimVtxCut = 1.5;
2499 fDCAZPrimVtxCut = 1;
2502 fDCAZPrimVtxCut = 0.5;
2505 cout<<"Warning: DCAZPhotonPrimVtx not defined "<<DCAZPhotonPrimVtx<<endl;
2511 ///________________________________________________________________________
2512 Bool_t AliConversionPhotonCuts::SetDCARPhotonPrimVtxCut(Int_t DCARPhotonPrimVtx){
2514 switch(DCARPhotonPrimVtx){
2516 fDCARPrimVtxCut = 1000;
2519 fDCARPrimVtxCut = 10;
2522 fDCARPrimVtxCut = 5;
2525 fDCARPrimVtxCut = 4;
2528 fDCARPrimVtxCut = 3;
2531 fDCARPrimVtxCut = 2.5;
2534 fDCARPrimVtxCut = 2;
2537 fDCARPrimVtxCut = 1.5;
2540 fDCARPrimVtxCut = 1;
2543 fDCARPrimVtxCut = 0.5;
2546 cout<<"Warning: DCARPhotonPrimVtx not defined "<<DCARPhotonPrimVtx<<endl;
2552 ///________________________________________________________________________
2553 Bool_t AliConversionPhotonCuts::SetInPlaneOutOfPlane(Int_t inOutPlane){
2557 fInPlaneOutOfPlane = 0; // No Event Plane
2560 fInPlaneOutOfPlane = 1; // In-Plane
2563 fInPlaneOutOfPlane = 2; // Out-Of-Plane
2566 cout<<"Warning: In-Plane or Out-Of-Plane not defined "<<inOutPlane<<endl;
2573 ///________________________________________________________________________
2574 Int_t AliConversionPhotonCuts::GetFirstTPCRow(Double_t radius){
2575 // Get first TPC row
2576 Int_t firstTPCRow = 0;
2577 Double_t radiusI = 84.8;
2578 Double_t radiusO = 134.6;
2579 Double_t radiusOB = 198.;
2580 Double_t rSizeI = 0.75;
2581 Double_t rSizeO = 1.;
2582 Double_t rSizeOB = 1.5;
2586 if(radius <= radiusI){
2589 if(radius>radiusI && radius<=radiusO){
2590 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
2592 if(radius>radiusO && radius<=radiusOB){
2593 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
2596 if(radius>radiusOB){
2597 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
2603 ///________________________________________________________________________
2604 Bool_t AliConversionPhotonCuts::CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const {
2605 ///Check if passes cosine of pointing angle cut
2606 if(GetCosineOfPointingAngle(photon, event) < fCosPAngleCut){
2612 ///________________________________________________________________________
2613 Double_t AliConversionPhotonCuts::GetCosineOfPointingAngle( const AliConversionPhotonBase * photon, AliVEvent * event) const{
2614 // calculates the pointing angle of the recalculated V0
2616 Double_t momV0[3] = {0,0,0};
2617 if(event->IsA()==AliESDEvent::Class()){
2618 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
2619 if(!esdEvent) return -999;
2620 AliESDv0 *v0 = esdEvent->GetV0(photon->GetV0Index());
2621 if(!v0) return -999;
2622 v0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
2624 if(event->IsA()==AliAODEvent::Class()){
2625 momV0[0] = photon->GetPx();
2626 momV0[1] = photon->GetPy();
2627 momV0[2] = photon->GetPz();
2630 //Double_t momV0[3] = { photon->GetPx(), photon->GetPy(), photon->GetPz() }; //momentum of the V0
2631 Double_t PosV0[3] = { photon->GetConversionX() - event->GetPrimaryVertex()->GetX(),
2632 photon->GetConversionY() - event->GetPrimaryVertex()->GetY(),
2633 photon->GetConversionZ() - event->GetPrimaryVertex()->GetZ() }; //Recalculated V0 Position vector
2635 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
2636 Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
2639 Double_t cosinePointingAngle = -999;
2640 if(momV02*PosV02 > 0.0)
2641 cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
2643 return cosinePointingAngle;
2646 ///________________________________________________________________________
2647 Bool_t AliConversionPhotonCuts::PsiPairCut(const AliConversionPhotonBase * photon) const {
2649 if (fDo2DPsiPairChi2){
2650 if (abs(photon->GetPsiPair()) < -fPsiPairCut/fChi2CutConversion*photon->GetChi2perNDF() + fPsiPairCut ){
2656 if(abs(photon->GetPsiPair()) > fPsiPairCut){
2662 ///________________________________________________________________________
2663 TString AliConversionPhotonCuts::GetCutNumber(){
2664 // returns TString with current cut number
2666 for(Int_t ii=0;ii<kNCuts;ii++){
2667 a.Append(Form("%d",fCuts[ii]));
2672 ///________________________________________________________________________
2673 void AliConversionPhotonCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
2675 Int_t posLabel = photon->GetTrackLabelPositive();
2676 Int_t negLabel = photon->GetTrackLabelNegative();
2678 fElectronLabelArray[nV0*2] = posLabel;
2679 fElectronLabelArray[(nV0*2)+1] = negLabel;
2681 ///________________________________________________________________________
2682 Bool_t AliConversionPhotonCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
2684 Int_t posLabel = photon->GetTrackLabelPositive();
2685 Int_t negLabel = photon->GetTrackLabelNegative();
2687 for(Int_t i = 0; i<nV0s*2;i++){
2688 if(i==nV0*2) continue;
2689 if(i==(nV0*2)+1) continue;
2690 if(fElectronLabelArray[i] == posLabel){
2692 if(fElectronLabelArray[i] == negLabel){
2699 ///________________________________________________________________________
2700 Bool_t AliConversionPhotonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
2703 Double_t posX = photon->GetConversionX();
2704 Double_t posY = photon->GetConversionY();
2705 Double_t posZ = photon->GetConversionZ();
2707 for(Int_t i = 0;i<photons->GetEntries();i++){
2708 if(nV0 == i) continue;
2709 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
2710 Double_t posCompX = photonComp->GetConversionX();
2711 Double_t posCompY = photonComp->GetConversionY();
2712 Double_t posCompZ = photonComp->GetConversionZ();
2714 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
2716 if(dist < fminV0Dist*fminV0Dist){
2717 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
2727 ///________________________________________________________________________
2728 AliConversionPhotonCuts* AliConversionPhotonCuts::GetStandardCuts2010PbPb(){
2729 //Create and return standard 2010 PbPb cuts
2730 AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
2731 if(!cuts->InitializeCutsFromCutString("04209297002322000000")){
2732 cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
2736 ///________________________________________________________________________
2737 AliConversionPhotonCuts* AliConversionPhotonCuts::GetStandardCuts2010pp(){
2738 //Create and return standard 2010 PbPb cuts
2739 AliConversionPhotonCuts *cuts=new AliConversionPhotonCuts("StandardCuts2010pp","StandardCuts2010pp");
2740 if(!cuts->InitializeCutsFromCutString("00209366300380000000")){
2741 cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
2745 ///________________________________________________________________________
2746 Bool_t AliConversionPhotonCuts::InPlaneOutOfPlaneCut(Double_t photonPhi, Double_t eventPlaneAngle, Bool_t fill){
2748 //GetPhotonPhi() 0-2 Pi //eventPlaneAngle -1pi-1pi
2749 eventPlaneAngle=eventPlaneAngle+TMath::Pi();
2750 Double_t gammaToEPAngle = eventPlaneAngle-photonPhi;
2751 if(gammaToEPAngle < 0) gammaToEPAngle=gammaToEPAngle+2*TMath::Pi();
2752 gammaToEPAngle = gammaToEPAngle-TMath::Pi(); // angle from -pi +pi
2754 if(!fInPlaneOutOfPlane){
2755 if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
2758 else if(fInPlaneOutOfPlane == 1){
2759 if(abs(gammaToEPAngle)<=0.25*TMath::Pi() || abs(gammaToEPAngle)>=0.75*TMath::Pi()){
2760 if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
2765 else if(fInPlaneOutOfPlane == 2){
2766 if(abs(gammaToEPAngle)>0.25*TMath::Pi() && abs(gammaToEPAngle)<0.75*TMath::Pi()){
2767 if(fill&&hEventPlanePhi)hEventPlanePhi->Fill(gammaToEPAngle);
2775 ///________________________________________________________________________
2776 UChar_t AliConversionPhotonCuts::DeterminePhotonQualityAOD(AliAODConversionPhoton* photon, AliVEvent* eventDummy){
2778 AliAODTrack * negTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelNegative()));
2779 AliAODTrack * posTrack = static_cast<AliAODTrack*>(GetTrack(eventDummy, photon->GetTrackLabelPositive()));
2781 if(!negTrack || !posTrack) {
2784 if(negTrack->Charge() == posTrack->Charge()){
2787 Int_t nClusterITSneg = negTrack->GetITSNcls();
2788 Int_t nClusterITSpos = posTrack->GetITSNcls();
2789 // cout << nClusterITSneg << "\t" << nClusterITSpos <<endl;
2791 if (nClusterITSneg > 1 && nClusterITSpos > 1){
2793 } else if (nClusterITSneg > 1 || nClusterITSpos > 1){