AliPhysics  fde8a9f (fde8a9f)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliRDHFCutsXictoeleXifromAODtracks.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
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  **************************************************************************/
15 
16 /* $Id$ */
17 
19 //
20 // Class for cuts on AOD reconstructed Xic->e+Xi
21 //
22 // Modified by Y.S Watanabe - wyosuke@cns.s.u-tokyo.ac.jp
23 //
25 
26 #include <Riostream.h>
27 
28 #include <TDatabasePDG.h>
29 #include <TMath.h>
30 #include <TVector3.h>
31 
32 #include "AliAnalysisManager.h"
33 #include "AliInputEventHandler.h"
34 #include "AliPIDResponse.h"
36 #include "AliAODRecoCascadeHF.h"
37 #include "AliAODTrack.h"
38 #include "AliESDtrack.h"
39 #include "AliESDVertex.h"
40 #include "AliAODVertex.h"
41 #include "AliAODv0.h"
42 #include "AliAODcascade.h"
43 #include "AliESDv0.h"
44 
45 using std::cout;
46 using std::endl;
47 
51 
52 
53 //--------------------------------------------------------------------------
55 AliRDHFCuts(name),
56  fPIDStrategy(kNSigmaCuts),
57  fCombinedPIDThreshold(0.),
58  fUseCascadePID(kFALSE),
59  fPidObjCascPi(0),
60  fPidObjCascPr(0),
61  fUseV0Topology(0),
62  fBzkG(0),
63  fProdTrackTPCNclsPIDMin(0),
64  fProdTrackTPCNclsRatioMin(0.0),
65  fProdUseAODFilterBit(kTRUE),
66  fProdAODFilterBit(4),
67  fProdRejectTrackWithShared(kFALSE),
68  fProdMassTolLambda(0.010),
69  fProdMassTolXiRough(0.020),
70  fProdMassTolXi(0.008),
71  fProdMassRejOmega(0.008),
72  fProdRfidMinV0(0.6),
73  fProdRfidMaxV0(100.0),
74  fProdRfidMinXi(0.6),
75  fProdRfidMaxXi(100.0),
76  fProdCascProperDecayLengthMax(100.0),
77  fProdDcaXiDaughtersMax(100.),
78  fProdDcaV0DaughtersMax(100.),
79  fProdDcaBachToPrimVertexMin(0.),
80  fProdDcaV0ToPrimVertexMin(0.),
81  fProdDcaV0PrToPrimVertexMin(0.),
82  fProdDcaV0PiToPrimVertexMin(0.),
83  fProdXiCosineOfPoiningAngleMin(-1.),
84  fProdV0CosineOfPoiningAngleXiMin(-1.),
85  fProdCascNTPCClustersMin(0.0),
86  fProdCascEtaMin(-9999.),
87  fProdCascEtaMax(9999.),
88  fProdCascRapMin(-9999.),
89  fProdCascRapMax(9999.),
90  fProdCascPtMin(0.),
91  fProdCascPtMax(9999.),
92  fProdRoughMassTol(0.25),
93  fProdRoughPtMin(0.0),
94  fExcludePionTPC(kFALSE),
95  fExcludeProtonTPC(kFALSE),
96  fExcludeKaonTPC(kFALSE),
97  fExcludenSigmaPionTPC(3.),
98  fExcludenSigmaProtonTPC(3.),
99  fExcludenSigmaKaonTPC(3.),
100  fSigmaElectronTPCMin(-9999.),
101  fSigmaElectronTPCPtDepPar0(-9999.),
102  fSigmaElectronTPCPtDepPar1(-9999.),
103  fSigmaElectronTPCPtDepPar2(0.),
104  fSigmaElectronTPCMax(9999.),
105  fSigmaElectronTOFMin(-9999.),
106  fSigmaElectronTOFMax(9999.),
107  fConversionMassMax(-1.),
108  fEleXiMassMax(2.5)
109 {
110  //
111  // Default Constructor
112  //
113  for(Int_t i=0;i<3;i++){
114  fPrimVert[i] = 0.;
115  }
116 
117  const Int_t nvars=4;
118  SetNVars(nvars);
119  TString varNames[nvars]={
120  "InvMass [GeV/c2]", //0
121  "cos(Opening angle) [cos(rad)]", //1
122  "dPhiS", //2
123  "dEtaS" //3
124  };
125 
126  Bool_t isUpperCut[nvars]={
127  kTRUE, //0
128  kFALSE, //1
129  kFALSE, //2
130  kFALSE //3
131  };
132  SetVarNames(nvars,varNames,isUpperCut);
133  Bool_t forOpt[nvars]={
134  kTRUE, //0
135  kTRUE, //1
136  kTRUE, //2
137  kTRUE //3
138  };
139  SetVarsForOpt(nvars,forOpt);
140 
141  Float_t limits[2]={0,999999999.};
142  SetPtBins(2,limits);
143 }
144 //--------------------------------------------------------------------------
146  AliRDHFCuts(source),
147  fPIDStrategy(source.fPIDStrategy),
148  fCombinedPIDThreshold(source.fCombinedPIDThreshold),
149  fUseCascadePID(source.fUseCascadePID),
150  fPidObjCascPi(source.fPidObjCascPi),
151  fPidObjCascPr(source.fPidObjCascPr),
152  fUseV0Topology(source.fUseV0Topology),
153  fBzkG(source.fBzkG),
154  fProdTrackTPCNclsPIDMin(source.fProdTrackTPCNclsPIDMin),
155  fProdTrackTPCNclsRatioMin(source.fProdTrackTPCNclsRatioMin),
156  fProdUseAODFilterBit(source.fProdUseAODFilterBit),
157  fProdAODFilterBit(source.fProdAODFilterBit),
158  fProdRejectTrackWithShared(source.fProdRejectTrackWithShared),
159  fProdMassTolLambda(source.fProdMassTolLambda),
160  fProdMassTolXiRough(source.fProdMassTolXiRough),
161  fProdMassTolXi(source.fProdMassTolXi),
162  fProdMassRejOmega(source.fProdMassRejOmega),
163  fProdRfidMinV0(source.fProdRfidMinV0),
164  fProdRfidMaxV0(source.fProdRfidMaxV0),
165  fProdRfidMinXi(source.fProdRfidMinXi),
166  fProdRfidMaxXi(source.fProdRfidMaxXi),
167  fProdCascProperDecayLengthMax(source.fProdCascProperDecayLengthMax),
168  fProdDcaXiDaughtersMax(source.fProdDcaXiDaughtersMax),
169  fProdDcaV0DaughtersMax(source.fProdDcaV0DaughtersMax),
170  fProdDcaBachToPrimVertexMin(source.fProdDcaBachToPrimVertexMin),
171  fProdDcaV0ToPrimVertexMin(source.fProdDcaV0ToPrimVertexMin),
172  fProdDcaV0PrToPrimVertexMin(source.fProdDcaV0PrToPrimVertexMin),
173  fProdDcaV0PiToPrimVertexMin(source.fProdDcaV0PiToPrimVertexMin),
174  fProdXiCosineOfPoiningAngleMin(source.fProdXiCosineOfPoiningAngleMin),
175  fProdV0CosineOfPoiningAngleXiMin(source.fProdV0CosineOfPoiningAngleXiMin),
176  fProdCascNTPCClustersMin(source.fProdCascNTPCClustersMin),
177  fProdCascEtaMin(source.fProdCascEtaMin),
178  fProdCascEtaMax(source.fProdCascEtaMax),
179  fProdCascRapMin(source.fProdCascRapMin),
180  fProdCascRapMax(source.fProdCascRapMax),
181  fProdCascPtMin(source.fProdCascPtMin),
182  fProdCascPtMax(source.fProdCascPtMax),
183  fProdRoughMassTol(source.fProdRoughMassTol),
184  fProdRoughPtMin(source.fProdRoughPtMin),
185  fExcludePionTPC(source.fExcludePionTPC),
186  fExcludeProtonTPC(source.fExcludeProtonTPC),
187  fExcludeKaonTPC(source.fExcludeKaonTPC),
188  fExcludenSigmaPionTPC(source.fExcludenSigmaPionTPC),
189  fExcludenSigmaProtonTPC(source.fExcludenSigmaProtonTPC),
190  fExcludenSigmaKaonTPC(source.fExcludenSigmaKaonTPC),
191  fSigmaElectronTPCMin(source.fSigmaElectronTPCMin),
192  fSigmaElectronTPCPtDepPar0(source.fSigmaElectronTPCPtDepPar0),
193  fSigmaElectronTPCPtDepPar1(source.fSigmaElectronTPCPtDepPar1),
194  fSigmaElectronTPCPtDepPar2(source.fSigmaElectronTPCPtDepPar2),
195  fSigmaElectronTPCMax(source.fSigmaElectronTPCMax),
196  fSigmaElectronTOFMin(source.fSigmaElectronTOFMin),
197  fSigmaElectronTOFMax(source.fSigmaElectronTOFMax),
198  fConversionMassMax(source.fConversionMassMax),
199  fEleXiMassMax(source.fEleXiMassMax)
200 {
201  //
202  // Copy constructor
203  //
204  for(Int_t i=0;i<3;i++){
205  fPrimVert[i] = source.fPrimVert[i];
206  }
207 }
208 //--------------------------------------------------------------------------
210 {
211  //
212  // assignment operator
213  //
214 
215  if (this != &source) {
216  AliRDHFCuts::operator=(source);
217  }
218 
219  fPIDStrategy = source.fPIDStrategy;
222  fPidObjCascPi = source.fPidObjCascPi;
223  fPidObjCascPr = source.fPidObjCascPr;
225  fBzkG = source.fBzkG;
271  fEleXiMassMax = source.fEleXiMassMax;
272 
273  for(Int_t i=0;i<3;i++){
274  fPrimVert[i] = source.fPrimVert[i];
275  }
276 
277  return *this;
278 }
279 
280 //---------------------------------------------------------------------------
282  //
283  // Default Destructor
284  //
285 
286 }
287 
288 //---------------------------------------------------------------------------
290  //
291  // Fills in vars the values of the variables
292  //
293 
294  if (pdgdaughters[0]==-9999) return; // dummy
295 
297  if(!dd){
298  AliError("No AliAODRecoCascadeHF object found\n");
299  return;
300  }
301 
302  if (nvars!=fnVarsForOpt) {
303  AliError("Cut object seems to have the wrong number of variables\n");
304  return;
305  }
306 
307  //Double_t ptD=d->Pt();
308  //Int_t ptbin=PtBin(ptD);
309  Int_t iter=-1;
310 
311  if(fVarsForOpt[0]){
312  iter++;
313  UInt_t pdgdg[2]={11,3312};
314  vars[iter]= dd->InvMass(2,pdgdg);
315  }
316  if(fVarsForOpt[1]){
317  iter++;
318  Double_t xipx = dd->PxProng(1);
319  Double_t xipy = dd->PyProng(1);
320  Double_t xipz = dd->PzProng(1);
321  Double_t epx = dd->PxProng(0);
322  Double_t epy = dd->PyProng(0);
323  Double_t epz = dd->PzProng(0);
324  vars[iter]= (xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz);
325  }
326 
327  return;
328 }
329 
330 //---------------------------------------------------------------------------
332  //
333  // Apply selection
334  //
335 
336  if (!fCutsRD) {
337  AliFatal("Cut matrix not inizialized. Exit...");
338  return 0;
339  }
340 
342  if(!d){
343  AliDebug(2,"AliAODRecoCascadeHF null");
344  return 0;
345  }
346 
347  Double_t ptD=d->Pt();
348  if(ptD<fMinPtCand) return 0;
349  if(ptD>fMaxPtCand) return 0;
350 
351  if (selectionLevel==AliRDHFCuts::kAll ||
352  selectionLevel==AliRDHFCuts::kTracks) {
353  //Performed in production stage
354  }
355 
356  Int_t returnvalueCuts=1;
357  // selection on candidate
358  if (selectionLevel==AliRDHFCuts::kAll ||
359  selectionLevel==AliRDHFCuts::kCandidate) {
360 
361  Double_t pt=d->Pt();
362  Int_t ptbin=PtBin(pt);
363  if (ptbin==-1) {
364  return 0;
365  }
366  Bool_t okcand=kTRUE;
367 
368  Double_t mxiPDG = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
369  UInt_t pdgdg[2]={11,3312};
370  Double_t InvMassEleXi = d->InvMass(2,pdgdg);
371  Double_t xipx = d->PxProng(1);
372  Double_t xipy = d->PyProng(1);
373  Double_t xipz = d->PzProng(1);
374  Double_t epx = d->PxProng(0);
375  Double_t epy = d->PyProng(0);
376  Double_t epz = d->PzProng(0);
377  Double_t cosoa = (xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz);
378 
379  Double_t dphis_e_pr, detas_e_pr, dphis_e_pi, detas_e_pi, dphis_e_bach, detas_e_bach;
380  dphis_e_pr = 9999.;
381  detas_e_pr = 9999.;
382  dphis_e_pi = 9999.;
383  detas_e_pi = 9999.;
384  dphis_e_bach = 9999.;
385  detas_e_bach = 9999.;
386  if(fCutsRD[GetGlobalIndex(2,ptbin)]>0 || fCutsRD[GetGlobalIndex(3,ptbin)]>0){
387  AliAODTrack *trke = (AliAODTrack*)d->GetDaughter(0);
388  AliAODcascade *casc = (AliAODcascade*)d->GetDaughter(1);
389  if(trke && casc){
390  AliAODTrack *cprtrk = 0;
391  AliAODTrack *cpitrk = 0;
392  AliAODTrack *cbtrk = 0;
393  if(casc->ChargeXi()<0){
394  cprtrk = (AliAODTrack*)casc->GetDaughter(0);
395  cpitrk = (AliAODTrack*)casc->GetDaughter(1);
396  cbtrk = (AliAODTrack*)casc->GetDecayVertexXi()->GetDaughter(0);
397  }else{
398  cprtrk = (AliAODTrack*)casc->GetDaughter(1);
399  cpitrk = (AliAODTrack*)casc->GetDaughter(0);
400  cbtrk = (AliAODTrack*)casc->GetDecayVertexXi()->GetDaughter(0);
401  }
402  if(cprtrk && cpitrk && cbtrk)
403  GetdPhiSdEtaSR125(trke,cprtrk,cpitrk,cbtrk,fBzkG,fPrimVert, dphis_e_pr,detas_e_pr,dphis_e_pi,detas_e_pi,dphis_e_bach,detas_e_bach);
404  }
405  }
406 
407  if(InvMassEleXi > fCutsRD[GetGlobalIndex(0,ptbin)])
408  {
409  okcand = kFALSE;
410  }
411  if(cosoa < fCutsRD[GetGlobalIndex(1,ptbin)])
412  {
413  okcand = kFALSE;
414  }
415  if(fabs(dphis_e_pr) < fCutsRD[GetGlobalIndex(2,ptbin)] && fabs(detas_e_pr) < fCutsRD[GetGlobalIndex(3,ptbin)])
416  {
417  okcand = kFALSE;
418  }
419  if(fabs(dphis_e_pi) < fCutsRD[GetGlobalIndex(2,ptbin)] && fabs(detas_e_pi) < fCutsRD[GetGlobalIndex(3,ptbin)])
420  {
421  okcand = kFALSE;
422  }
423  if(fabs(dphis_e_bach) < fCutsRD[GetGlobalIndex(2,ptbin)] && fabs(detas_e_bach) < fCutsRD[GetGlobalIndex(3,ptbin)])
424  {
425  okcand = kFALSE;
426  }
427 
428  if(!okcand) return 0;
429  returnvalueCuts = 1;
430  }
431 
432  Int_t returnvaluePID=1;
433  if(selectionLevel==AliRDHFCuts::kAll ||
434  selectionLevel==AliRDHFCuts::kCandidate||
435  selectionLevel==AliRDHFCuts::kPID) {
436  //not used. applied at single level
437  }
438 
439  Int_t returnvalue = 0;
440  if(returnvalueCuts==1 && returnvaluePID==1) returnvalue=1;
441 
442  return returnvalue;
443 }
444 
445 //---------------------------------------------------------------------------
447 {
448  //
449  // IsSelectedPID
450  //
451 
452  if(!fUsePID || !obj) return 1;
453 
455  AliAODTrack *part = dd->GetBachelor();
456 
457  Int_t returnvalue=1;
458 
459  if(fPidHF->GetPidResponse()==0x0){
460  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
461  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
462  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
463  fPidHF->SetPidResponse(pidResp);
464  }
465 
466  Int_t isElectron=fPidHF->MakeRawPid(part,0);
467  if(isElectron<1) returnvalue = 0;
468 
469  return returnvalue;
470 }
471 
472 //---------------------------------------------------------------------------
474  //
475  // IsSelectedCombinedPID
476  //
477 
478  if(!fUsePID || !obj) {return 1;}
479 
481  AliAODTrack *part = dd->GetBachelor();
482  if(!part) return 0;
483 
484  Int_t returnvalue=1;
485 
486  return returnvalue;
487 }
488 
489 //________________________________________________________________________
490 Bool_t AliRDHFCutsXictoeleXifromAODtracks::SingleTrkCuts(AliAODTrack *trk, AliAODTrack *trkpid, AliAODVertex *primVert)
491 {
492  //
493  // Single Track Cut to be applied before object creation
494  //
495 
496  //if(trk->GetStatus()&AliESDtrack::kITSpureSA) return kFALSE;
497  //if(!(trk->GetStatus()&AliESDtrack::kITSin)) return kFALSE;
498  //if(fProdUseAODFilterBit && !trk->TestFilterMask(BIT(4))) return kFALSE;
499 
500  if(fTrackCuts){
501  if(fProdAODFilterBit==7){
503  fTrackCuts->GetPtRange(ptmin,ptmax);
504  fTrackCuts->GetEtaRange(etamin,etamax);
505  if(trk->Pt()<ptmin || trk->Pt()>ptmax) return kFALSE;
506  if(trk->Eta()<etamin || trk->Eta()>etamax) return kFALSE;
507  }else{
508  Double_t pos[3]; primVert->GetXYZ(pos);
509  Double_t cov[6]; primVert->GetCovarianceMatrix(cov);
510  const AliESDVertex vESD(pos,cov,100.,100);
511  if(!IsDaughterSelected(trk,&vESD,fTrackCuts)) return kFALSE;
512  }
513  }
514 
515  if(trkpid->GetTPCsignalN()<fProdTrackTPCNclsPIDMin) return kFALSE;
516  if(trk->GetTPCNclsF()>0){
517  Float_t tpcratio = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
518  if(tpcratio<fProdTrackTPCNclsRatioMin) return kFALSE;
519  }
520 
522  const TBits sharedMap = trk->GetTPCSharedMap();
523  if((sharedMap.CountBits()) >= 1){
524  return kFALSE;
525  }
526  }
527 
528  if(fUsePID)
529  {
530  if(fPidHF->GetPidResponse()==0x0){
531  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
532  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
533  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
534  fPidHF->SetPidResponse(pidResp);
535  }
536 
537  switch(fPIDStrategy){
538  case kNSigmaCuts:
539  return IsSelectedeID(trkpid);
540  break;
542  return IsSelectedCustomizedeID(trkpid);
543  break;
545  return IsSelectedCustomizedPtDepeID(trk,trkpid);
546  break;
547  case kCombinedCuts:
548  return IsSelectedCombinedeID(trkpid);
549  break;
550  }
551  }
552 
553  return kTRUE;
554 }
555 //________________________________________________________________________
556 Bool_t AliRDHFCutsXictoeleXifromAODtracks::SingleTrkCutsNoPID(AliAODTrack *trk, AliAODTrack *trkpid, AliAODVertex *primVert)
557 {
558  //
559  // Single Track Cut to be applied before object creation
560  //
561 
562  //if(trk->GetStatus()&AliESDtrack::kITSpureSA) return kFALSE;
563  //if(!(trk->GetStatus()&AliESDtrack::kITSin)) return kFALSE;
564  //if(fProdUseAODFilterBit && !trk->TestFilterMask(BIT(4))) return kFALSE;
565  if(fTrackCuts){
566  if(fProdAODFilterBit==7){
568  fTrackCuts->GetPtRange(ptmin,ptmax);
569  fTrackCuts->GetEtaRange(etamin,etamax);
570  if(trk->Pt()<ptmin || trk->Pt()>ptmax) return kFALSE;
571  if(trk->Eta()<etamin || trk->Eta()>etamax) return kFALSE;
572  }else{
573  Double_t pos[3]; primVert->GetXYZ(pos);
574  Double_t cov[6]; primVert->GetCovarianceMatrix(cov);
575  const AliESDVertex vESD(pos,cov,100.,100);
576  if(!IsDaughterSelected(trk,&vESD,fTrackCuts)) return kFALSE;
577  }
578  }
579 
580  if(trkpid->GetTPCsignalN()<fProdTrackTPCNclsPIDMin) return kFALSE;
581  if(trk->GetTPCNclsF()>0){
582  Float_t tpcratio = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
583  if(tpcratio<fProdTrackTPCNclsRatioMin) return kFALSE;
584  }
585 
587  const TBits sharedMap = trk->GetTPCSharedMap();
588  if((sharedMap.CountBits()) >= 1){
589  return kFALSE;
590  }
591  }
592 
593 
594  return kTRUE;
595 }
596 //________________________________________________________________________
598 {
599  //
600  // electron ID first shot
601  //
602 
603  Double_t nSigmaPion = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
604  if(fExcludePionTPC){
605  if(TMath::Abs(nSigmaPion)<fExcludenSigmaPionTPC){
606  return kFALSE;
607  }
608  }
609 
610  Double_t nSigmaProton = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
611  if(fExcludeProtonTPC){
612  if(TMath::Abs(nSigmaProton)<fExcludenSigmaProtonTPC){
613  return kFALSE;
614  }
615  }
616 
617  Double_t nSigmaKaon = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
618  if(fExcludeKaonTPC){
619  if(TMath::Abs(nSigmaKaon)<fExcludenSigmaKaonTPC){
620  return kFALSE;
621  }
622  }
623 
624  Int_t isElectron=fPidHF->MakeRawPid(trk,0);
625  if(isElectron<1) return kFALSE;
626 
627  return kTRUE;
628 }
629 //________________________________________________________________________
631 {
632  //
633  // electron ID first shot
634  //
635 
636  Double_t nSigmaPion = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
637  if(fExcludePionTPC){
638  if(TMath::Abs(nSigmaPion)<fExcludenSigmaPionTPC){
639  return kFALSE;
640  }
641  }
642 
643  Double_t nSigmaProton = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
644  if(fExcludeProtonTPC){
645  if(TMath::Abs(nSigmaProton)<fExcludenSigmaProtonTPC){
646  return kFALSE;
647  }
648  }
649 
650  Double_t nSigmaKaon = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
651  if(fExcludeKaonTPC){
652  if(TMath::Abs(nSigmaKaon)<fExcludenSigmaKaonTPC){
653  return kFALSE;
654  }
655  }
656 
657  Double_t nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
658  Double_t nSigmaTOFele = fPidHF->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
659 
660  if(nSigmaTPCele<fSigmaElectronTPCMin) return kFALSE;
661  if(nSigmaTPCele>fSigmaElectronTPCMax) return kFALSE;
662  if(fabs(fSigmaElectronTOFMin)<10.&&fabs(fSigmaElectronTOFMax)<10.){
663  if(nSigmaTOFele<fSigmaElectronTOFMin) return kFALSE;
664  if(nSigmaTOFele>fSigmaElectronTOFMax) return kFALSE;
665  }
666 
667  return kTRUE;
668 }
669 //________________________________________________________________________
671 {
672  //
673  // electron ID pt dependent
674  //
675 
676  Double_t nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kElectron);
677  Double_t nSigmaTOFele = fPidHF->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kElectron);
678 
679  if(nSigmaTOFele<fSigmaElectronTOFMin) return kFALSE;
680  if(nSigmaTOFele>fSigmaElectronTOFMax) return kFALSE;
681 
682  Double_t pte = trk->Pt();
685  if(nSigmaTPCele<nsigmamin) return kFALSE;
686  if(nSigmaTPCele>fSigmaElectronTPCMax) return kFALSE;
687 
688  return kTRUE;
689 }
690 //________________________________________________________________________
692 {
693  //
694  // electron ID Basyian not implemented
695  //
696 
697  return kTRUE;
698 }
699 //________________________________________________________________________
701 {
702  //
703  // Single Cascade Cut
704  //
705 
706  if(!casc) return kFALSE;
707  if(!(casc->GetSecondaryVtx())) return kFALSE;
708  if(!(casc->GetDecayVertexXi())) return kFALSE;
709 
710  AliAODTrack *ptrack = (AliAODTrack*) (casc->GetDaughter(0));
711  AliAODTrack *ntrack = (AliAODTrack*) (casc->GetDaughter(1));
712  AliAODTrack *btrack = (AliAODTrack*) (casc->GetDecayVertexXi()->GetDaughter(0));
713 
714  if(!ptrack||!ntrack||!btrack) return kFALSE;
715 
716  if(ptrack->Charge()<0 && ntrack->Charge()>0){
717  ptrack = (AliAODTrack*) (casc->GetDaughter(1));
718  ntrack = (AliAODTrack*) (casc->GetDaughter(0));
719  }
720 
721  if(ptrack->GetTPCClusterInfo(2,1)<fProdCascNTPCClustersMin) return kFALSE;
722  if(ntrack->GetTPCClusterInfo(2,1)<fProdCascNTPCClustersMin) return kFALSE;
723  if(btrack->GetTPCClusterInfo(2,1)<fProdCascNTPCClustersMin) return kFALSE;
724 
725  Double_t pxxi = casc->MomXiX();
726  Double_t pyxi = casc->MomXiY();
727  Double_t ptxi = sqrt(pxxi*pxxi+pyxi*pyxi);
728  if(ptxi<fProdCascPtMin || ptxi>fProdCascPtMax) return kFALSE;
729 
730  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
731  Double_t mxiPDG = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
732  Double_t momegaPDG = TDatabasePDG::Instance()->GetParticle(3334)->Mass();
733 
734  Double_t massLambda = casc->MassLambda();
735  Double_t massAntiLambda = casc->MassAntiLambda();
736  if(TMath::Abs(massLambda-mLPDG)>fProdMassTolLambda && TMath::Abs(massAntiLambda-mLPDG)>fProdMassTolLambda)
737  return kFALSE;
738 
739  Bool_t isparticle = kTRUE;
740  //if(TMath::Abs(massAntiLambda-mLPDG)<fProdMassTolLambda) isparticle = kFALSE;
741  if(casc->ChargeXi()>0) isparticle = kFALSE;
742 
743  Double_t massXi = casc->MassXi();
744  if(TMath::Abs(massXi-mxiPDG)>fProdMassTolXiRough)
745  return kFALSE;
746 
747  Double_t massOmega = casc->MassOmega();
748  if(TMath::Abs(massOmega-momegaPDG)<fProdMassRejOmega)
749  return kFALSE;
750 
751 
752  Double_t lPosXi[3];
753  lPosXi[0] = casc->DecayVertexXiX();
754  lPosXi[1] = casc->DecayVertexXiY();
755  lPosXi[2] = casc->DecayVertexXiZ();
756  Double_t decayvertXi = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
757  Double_t lPosV0[3];
758  lPosV0[0] = casc->DecayVertexV0X();
759  lPosV0[1] = casc->DecayVertexV0Y();
760  lPosV0[2] = casc->DecayVertexV0Z();
761  Double_t decayvertV0 = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
762 
763  if(decayvertV0<fProdRfidMinV0 || decayvertV0>fProdRfidMaxV0) return kFALSE;
764  if(decayvertXi<fProdRfidMinXi || decayvertXi>fProdRfidMaxXi) return kFALSE;
765 
766  Double_t ptotxi = TMath::Sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)+pow(casc->MomXiZ(),2));
767  Double_t properdl = casc->DecayLengthXi(primvert[0],primvert[1],primvert[2])*mxiPDG/ptotxi;
768  if(properdl>fProdCascProperDecayLengthMax) return kFALSE;
769 
770  Double_t lDcaXiDaughters = casc->DcaXiDaughters();
771  Double_t lDcaV0Daughters = casc->DcaV0Daughters();
772  if(lDcaXiDaughters > fProdDcaXiDaughtersMax) return kFALSE;
773  if(lDcaV0Daughters > fProdDcaV0DaughtersMax) return kFALSE;
774 
775  Double_t lDcaBachToPrimVertex = casc->DcaBachToPrimVertex();
776  Double_t lDcaV0ToPrimVertex = casc->DcaV0ToPrimVertex();
777  Double_t lDcaPosToPrimVertex = casc->DcaPosToPrimVertex();
778  Double_t lDcaNegToPrimVertex = casc->DcaNegToPrimVertex();
779  if(lDcaBachToPrimVertex < fProdDcaBachToPrimVertexMin) return kFALSE;
780  if(lDcaV0ToPrimVertex < fProdDcaV0ToPrimVertexMin) return kFALSE;
781  if(isparticle){
782  if(lDcaPosToPrimVertex < fProdDcaV0PrToPrimVertexMin) return kFALSE;
783  if(lDcaNegToPrimVertex < fProdDcaV0PiToPrimVertexMin) return kFALSE;
784  }else{
785  if(lDcaPosToPrimVertex < fProdDcaV0PiToPrimVertexMin) return kFALSE;
786  if(lDcaNegToPrimVertex < fProdDcaV0PrToPrimVertexMin) return kFALSE;
787  }
788 
789  Double_t lXiCosineOfPointingAngle = casc->CosPointingAngleXi(primvert[0],primvert[1],primvert[2]);
790  Double_t lV0CosineOfPointingAngleXi = casc->CosPointingAngle(lPosXi);
791 
792  if(lXiCosineOfPointingAngle < fProdXiCosineOfPoiningAngleMin) return kFALSE;
793  if(lV0CosineOfPointingAngleXi < fProdV0CosineOfPoiningAngleXiMin) return kFALSE;
794 
795  if(fUseCascadePID)
796  {
797  if(fPidObjCascPi->GetPidResponse()==0x0){
798  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
799  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
800  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
801  fPidObjCascPi->SetPidResponse(pidResp);
802  }
803  if(fPidObjCascPr->GetPidResponse()==0x0){
804  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
805  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
806  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
807  fPidObjCascPr->SetPidResponse(pidResp);
808  }
809  if(isparticle){
810  Int_t isProton = -9999;
811  Int_t isPion1 = -9999;
812  Int_t isPion2 = -9999;
813  Double_t nsigmatpc_proton = fPidObjCascPr->GetSigma(0);
814  Double_t nsigmatpc_pion = fPidObjCascPi->GetSigma(0);
815  Double_t nSigmaTPCpr = fPidObjCascPr->GetPidResponse()->NumberOfSigmasTPC(ptrack,AliPID::kProton);
816  Double_t nSigmaTPCpi1 = fPidObjCascPi->GetPidResponse()->NumberOfSigmasTPC(ntrack,AliPID::kPion);
817  Double_t nSigmaTPCpi2 = fPidObjCascPi->GetPidResponse()->NumberOfSigmasTPC(btrack,AliPID::kPion);
818  if(fabs(nSigmaTPCpr)<nsigmatpc_proton) isProton = 1;
819  if(fabs(nSigmaTPCpi1)<nsigmatpc_pion) isPion1 = 1;
820  if(fabs(nSigmaTPCpi2)<nsigmatpc_pion) isPion2 = 1;
821  if(isProton<1) return kFALSE;
822  if(isPion1<1) return kFALSE;
823  if(isPion2<1) return kFALSE;
824  }else{
825  Int_t isProton = -9999;
826  Int_t isPion1 = -9999;
827  Int_t isPion2 = -9999;
828  Double_t nsigmatpc_proton = fPidObjCascPr->GetSigma(0);
829  Double_t nsigmatpc_pion = fPidObjCascPi->GetSigma(0);
830  Double_t nSigmaTPCpr = fPidObjCascPr->GetPidResponse()->NumberOfSigmasTPC(ntrack,AliPID::kProton);
831  Double_t nSigmaTPCpi1 = fPidObjCascPi->GetPidResponse()->NumberOfSigmasTPC(ptrack,AliPID::kPion);
832  Double_t nSigmaTPCpi2 = fPidObjCascPi->GetPidResponse()->NumberOfSigmasTPC(btrack,AliPID::kPion);
833  if(fabs(nSigmaTPCpr)<nsigmatpc_proton) isProton = 1;
834  if(fabs(nSigmaTPCpi1)<nsigmatpc_pion) isPion1 = 1;
835  if(fabs(nSigmaTPCpi2)<nsigmatpc_pion) isPion2 = 1;
836  if(isProton<1) return kFALSE;
837  if(isPion1<1) return kFALSE;
838  if(isPion2<1) return kFALSE;
839  }
840  }
841 
842  Double_t RapXi = casc->RapXi();
843  if(RapXi<fProdCascRapMin || RapXi>fProdCascRapMax) return kFALSE;
844 
845  Double_t EtaXi = 0.5*TMath::Log((ptotxi+casc->MomXiZ())/(ptotxi-casc->MomXiZ()));
846  if(EtaXi<fProdCascEtaMin || EtaXi>fProdCascEtaMax) return kFALSE;
847 
849  const TBits sharedMap1 = ptrack->GetTPCSharedMap();
850  const TBits sharedMap2 = ntrack->GetTPCSharedMap();
851  const TBits sharedMap3 = btrack->GetTPCSharedMap();
852  if((sharedMap1.CountBits() >= 1) || (sharedMap2.CountBits() >= 1) ||
853  (sharedMap3.CountBits() >= 1))
854  {
855  return kFALSE;
856  }
857  }
858 
859  if(fUseV0Topology>0){
860  Double_t dphiprlam = 0.;
861  if(isparticle){
862  TVector3 v3v0pr(casc->MomPosX(),casc->MomPosY(),casc->MomPosZ());
863  TVector3 v3lam(casc->Px(),casc->Py(),casc->Pz());
864  dphiprlam = v3v0pr.DeltaPhi(v3lam);
865  }else{
866  TVector3 v3v0pr(casc->MomNegX(),casc->MomNegY(),casc->MomNegZ());
867  TVector3 v3lam(casc->Px(),casc->Py(),casc->Pz());
868  dphiprlam = -1.*v3v0pr.DeltaPhi(v3lam);
869  }
870  if(fUseV0Topology==1){
871  if(dphiprlam>0) return kFALSE;
872  }else if(fUseV0Topology==2){
873  if(dphiprlam<0) return kFALSE;
874  }
875  }
876 
877  return kTRUE;
878 }
879 
880 //________________________________________________________________________
882 {
883  //
884  // Mass and pT Cut to be applied before object creation
885  // Not used now
886  //
887  if(!casc) return kFALSE;
888  if(!part) return kFALSE;
889 
890  return kTRUE;
891 }
892 
893 //________________________________________________________________________
895 {
896  Double_t mxiPDG = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
897  Double_t massXi = casc->MassXi();
898  if(TMath::Abs(massXi-mxiPDG)<fProdMassTolXi)
899  return kTRUE;
900  return kFALSE;
901 }
902 
903 //________________________________________________________________________
905 {
906  Double_t mxiPDG = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
907  Double_t massXi = casc->M();
908  if(TMath::Abs(massXi-mxiPDG)<fProdMassTolXi)
909  return kTRUE;
910  return kFALSE;
911 }
912 
913 //________________________________________________________________________
915 {
916  Double_t mxiPDG = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
917  Double_t massXi = casc->MassXi();
918  Bool_t issideband = kFALSE;
919  if((massXi-mxiPDG)>fProdMassTolXiRough-fProdMassTolXi) issideband = kTRUE;
920  if((massXi-mxiPDG)<-fProdMassTolXiRough+fProdMassTolXi) issideband = kTRUE;
921  return issideband;
922 }
923 
924 //________________________________________________________________________
926 {
927  Double_t mxiPDG = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
928  Double_t massXi = casc->M();
929  Bool_t issideband = kFALSE;
930  if((massXi-mxiPDG)>fProdMassTolXiRough-fProdMassTolXi) issideband = kTRUE;
931  if((massXi-mxiPDG)<-fProdMassTolXiRough+fProdMassTolXi) issideband = kTRUE;
932  return issideband;
933 }
934 
935 //________________________________________________________________________
937 {
938  //
939  // Tag conversion electron tracks
940  //
941  if(fConversionMassMax<0.) return kFALSE;
942 
943  Bool_t isconv = kFALSE;
944  minmass = 9999.;
945 
946  Int_t trkid = etrk->GetID();
947  Double_t px1 = etrk->Px();
948  Double_t py1 = etrk->Py();
949  Double_t pz1 = etrk->Pz();
950  Double_t E1 = sqrt(px1*px1+py1*py1+pz1*pz1+0.000511*0.000511);
951 
952  for(Int_t it=0;it<ntrk;it++){
953  AliAODTrack *trk2 = (AliAODTrack*) evt->GetTrack(it);
954  if(!trk2) continue;
955  Int_t trkid2 = trk2->GetID();
956  if(abs(trkid)==abs(trkid2)) continue;
957  if(etrk->Charge()*trk2->Charge()>0) continue;
958 
959  if(fProdAODFilterBit==7){
960  if(!trk2->TestFilterBit(BIT(fProdAODFilterBit))) continue;
961  }else{
962  if(!trk2->TestFilterMask(BIT(fProdAODFilterBit))) continue;
963  }
964 
965  Double_t nSigmaTPCele = 9999.;
966  if(fProdAODFilterBit==7){
967  if(-trkid2-1>=19000) continue;
968  if(-trkid2-1<0) continue;
969  Int_t index = id2index[-trkid2-1];
970  AliAODTrack *partpid = (AliAODTrack*)evt->GetTrack(index);
971  nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(partpid,AliPID::kElectron);
972  }else{
973  nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk2,AliPID::kElectron);
974  }
975  if(fabs(nSigmaTPCele)>5.) continue;
976 
977  Double_t px2 = trk2->Px();
978  Double_t py2 = trk2->Py();
979  Double_t pz2 = trk2->Pz();
980  Double_t E2 = sqrt(px2*px2+py2*py2+pz2*pz2+0.000511*0.000511);
981 
982  Double_t mass = sqrt(pow(E1+E2,2)-pow(px1+px2,2)-pow(py1+py2,2)-pow(pz1+pz2,2));
983  if(mass<minmass) minmass = mass;
984  }
985 
986  if(minmass<fConversionMassMax) isconv = kTRUE;
987 
988  return isconv;
989 }
990 //________________________________________________________________________
992 {
993  //
994  // Tag conversion electron tracks
995  //
996  if(fConversionMassMax<0.) return kFALSE;
997 
998  Bool_t isconv = kFALSE;
999  minmass = 9999.;
1000 
1001  Int_t trkid = etrk->GetID();
1002  Double_t px1 = etrk->Px();
1003  Double_t py1 = etrk->Py();
1004  Double_t pz1 = etrk->Pz();
1005  Double_t E1 = sqrt(px1*px1+py1*py1+pz1*pz1+0.000511*0.000511);
1006 
1007  for(Int_t it=0;it<ntrk;it++){
1008  AliAODTrack *trk2 = (AliAODTrack*) evt->GetTrack(it);
1009  if(!trk2) continue;
1010  Int_t trkid2 = trk2->GetID();
1011  if(abs(trkid)==abs(trkid2)) continue;
1012  if(etrk->Charge()*trk2->Charge()<0) continue;
1013 
1014  if(fProdAODFilterBit==7){
1015  if(!trk2->TestFilterBit(BIT(fProdAODFilterBit))) continue;
1016  }else{
1017  if(!trk2->TestFilterMask(BIT(fProdAODFilterBit))) continue;
1018  }
1019 
1020  Double_t nSigmaTPCele = 9999.;
1021  if(fProdAODFilterBit==7){
1022  if(-trkid2-1>=19000) continue;
1023  if(-trkid2-1<0) continue;
1024  Int_t index = id2index[-trkid2-1];
1025  AliAODTrack *partpid = (AliAODTrack*)evt->GetTrack(index);
1026  nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(partpid,AliPID::kElectron);
1027  }else{
1028  nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk2,AliPID::kElectron);
1029  }
1030  if(fabs(nSigmaTPCele)>5.) continue;
1031 
1032  Double_t px2 = trk2->Px();
1033  Double_t py2 = trk2->Py();
1034  Double_t pz2 = trk2->Pz();
1035  Double_t E2 = sqrt(px2*px2+py2*py2+pz2*pz2+0.000511*0.000511);
1036 
1037  Double_t mass = sqrt(pow(E1+E2,2)-pow(px1+px2,2)-pow(py1+py2,2)-pow(pz1+pz2,2));
1038  if(mass<minmass) minmass = mass;
1039  }
1040 
1041  if(minmass<fConversionMassMax) isconv = kTRUE;
1042 
1043  return isconv;
1044 }
1045 
1046 //________________________________________________________________________
1047 void AliRDHFCutsXictoeleXifromAODtracks::SetSftPosR125(AliAODTrack *track,Double_t bfield,Double_t priVtx[3],Double_t *XSftR125)
1048 {
1049  //
1050  // Sets the spatial position of the track at the radius R=1.25m in the shifted coordinate system
1051  //
1052 
1053  // Initialize the array to something indicating there was no propagation
1054  XSftR125[0]=-9999.;
1055  XSftR125[1]=-9999.;
1056  XSftR125[2]=-9999.;
1057  // Make a copy of the track to not change parameters of the track
1058  AliExternalTrackParam etp;
1059  etp.CopyFromVTrack(track);
1060 
1061  // The global position of the the track
1062  Double_t xyz[3]={-9999.,-9999.,-9999.};
1063 
1064  // The radius we want to propagate to, squared
1065  const Float_t RSquaredWanted(125.*125.);
1066 
1067 
1068  // Propagation is done in local x of the track
1069  for (Float_t x = 58.;x<247.;x+=1.){
1070  // Starts at 83 / Sqrt(2) and goes outwards. 85/Sqrt(2) is the smallest local x
1071  // for global radius 85 cm. x = 245 is the outer radial limit of the TPC when
1072  // the track is straight, i.e. has inifinite pt and doesn't get bent.
1073  // If the track's momentum is smaller than infinite, it will develop a y-component,
1074  // which adds to the global radius
1075  // We don't change the propagation steps to not mess up things!
1076 
1077  // Stop if the propagation was not succesful. This can happen for low pt tracks
1078  // that don't reach outer radii
1079  if(!etp.PropagateTo(x,(Float_t)bfield))break;
1080  etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1081 
1082  // Calculate the shifted radius we are at, squared.
1083  // Compare squared radii for faster code
1084  Float_t shiftedRadiusSquared = (xyz[0]-priVtx[0])*(xyz[0]-priVtx[0])
1085  + (xyz[1]-priVtx[1])*(xyz[1]-priVtx[1]);
1086 
1087  // Roughly reached the radius we want
1088  if(shiftedRadiusSquared > RSquaredWanted){
1089 
1090  // Bigger loop has bad precision, we're nearly one centimeter too far,
1091  // go back in small steps.
1092  while (shiftedRadiusSquared>RSquaredWanted){
1093  // Propagate a mm inwards
1094  x-=.1;
1095  if(!etp.PropagateTo(x,bfield)){
1096  // Propagation failed but we're already with a
1097  // cm precision at R=1.25m so we only break the
1098  // inner loop
1099  break;
1100  }
1101  // Get the global position
1102  etp.GetXYZ(xyz);
1103  // Calculate shifted radius, squared
1104  shiftedRadiusSquared = (xyz[0]-priVtx[0])*(xyz[0]-priVtx[0])
1105  + (xyz[1]-priVtx[1])*(xyz[1]-priVtx[1]);
1106  }
1107  // We reached R=1.25m with a precission of a cm to a mm,
1108  // set the spatial position
1109  XSftR125[0]=xyz[0]-priVtx[0];
1110  XSftR125[1]=xyz[1]-priVtx[1];
1111  XSftR125[2]=xyz[2]-priVtx[2];
1112  // Done
1113  return;
1114  } // End of if roughly reached radius
1115  } // End of coarse propagation loop
1116 }
1117 
1118 //________________________________________________________________________
1120 {
1121  //
1122  // Returns the pseudorapidity star difference
1123  //
1124 
1125  // It is important to keep the calculations easy and separated.
1126  // The calculation of EtaS is straight forward, one just has to
1127  // do it step by step to not get confused.
1128  Double_t ThetaS1 = TMath::Pi()/2. - TMath::ATan(postrack1[2]/125.);
1129  Double_t ThetaS2 = TMath::Pi()/2. - TMath::ATan(postrack2[2]/125.);
1130  Double_t EtaS1 = -TMath::Log( TMath::Tan(ThetaS1/2.) );
1131  Double_t EtaS2 = -TMath::Log( TMath::Tan(ThetaS2/2.) );
1132 
1133  return EtaS1-EtaS2;
1134 }
1135 
1136 //________________________________________________________________________
1138 {
1139  //
1140  // returns delta phi star at R=1.25m
1141  // position5 at R=1.2m is stored as second radius
1142  //
1143  //
1144  Double_t distSft= TMath::Sqrt(TMath::Power(postrack1[0] - postrack2[0],2)
1145  +TMath::Power(postrack1[1] - postrack2[1],2));
1146  return 2.0 * TMath::ATan(distSft/2./(125.));
1147 }
1148 
1149 //________________________________________________________________________
1150 Double_t AliRDHFCutsXictoeleXifromAODtracks::GetdPhiSdEtaSR125(AliAODTrack *tracke, AliAODTrack *trackp,AliAODTrack *trackb,
1151  AliAODTrack *trackn, Double_t bfield, Double_t priVtx[3], Double_t &dPhiS_ep, Double_t &dEtaS_ep,
1152  Double_t &dPhiS_en, Double_t &dEtaS_en, Double_t &dPhiS_eb, Double_t &dEtaS_eb)
1153 {
1154  //
1155  // Returns dPhi and dEta at R 125
1156  //
1157  Double_t XSftR125_e[3];
1158  SetSftPosR125(tracke,bfield,priVtx, XSftR125_e);
1159  Double_t XSftR125_p[3];
1160  SetSftPosR125(trackp,bfield,priVtx, XSftR125_p);
1161  Double_t XSftR125_n[3];
1162  SetSftPosR125(trackn,bfield,priVtx, XSftR125_n);
1163  Double_t XSftR125_b[3];
1164  SetSftPosR125(trackb,bfield,priVtx, XSftR125_b);
1165  dPhiS_ep = dPhiSR125(XSftR125_e,XSftR125_p);
1166  dEtaS_ep = dEtaSR125(XSftR125_e,XSftR125_p);
1167  dPhiS_en = dPhiSR125(XSftR125_e,XSftR125_n);
1168  dEtaS_en = dEtaSR125(XSftR125_e,XSftR125_n);
1169  dPhiS_eb = dPhiSR125(XSftR125_e,XSftR125_b);
1170  dEtaS_eb = dEtaSR125(XSftR125_e,XSftR125_b);
1171 }
1172 
1173 //---------------------------------------------------------------------------
1174 Int_t AliRDHFCutsXictoeleXifromAODtracks::IsSelected(TLorentzVector* vtrk, TLorentzVector *vcasc, Double_t *cutvars, Int_t selectionLevel)
1175 {
1176  //
1177  // Apply selection on mixed event tracks
1178  //
1179 
1180  if (!fCutsRD) {
1181  AliFatal("Cut matrix not inizialized. Exit...");
1182  return 0;
1183  }
1184 
1185  Double_t ptD=sqrt(pow(vtrk->Px()+vcasc->Px(),2)+pow(vtrk->Px()+vcasc->Py(),2));
1186  if(ptD<fMinPtCand) return 0;
1187  if(ptD>fMaxPtCand) return 0;
1188 
1189  Double_t pt=ptD;
1190  Int_t ptbin=PtBin(pt);
1191  if (ptbin==-1) {
1192  return 0;
1193  }
1194 
1195  if (selectionLevel==AliRDHFCuts::kAll ||
1196  selectionLevel==AliRDHFCuts::kTracks) {
1197  //Performed in production stage
1198  }
1199 
1200  Int_t returnvalueCuts=1;
1201  // selection on candidate
1202  if (selectionLevel==AliRDHFCuts::kAll ||
1203  selectionLevel==AliRDHFCuts::kCandidate) {
1204 
1205  Bool_t okcand=kTRUE;
1206 
1207  Double_t mlcPDG = TDatabasePDG::Instance()->GetParticle(4132)->Mass();
1208  Double_t melePDG = TDatabasePDG::Instance()->GetParticle(11)->Mass();
1209  Double_t mxiPDG = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
1210  Double_t v0px = vcasc->Px();
1211  Double_t v0py = vcasc->Py();
1212  Double_t v0pz = vcasc->Pz();
1213  Double_t epx = vtrk->Px();
1214  Double_t epy = vtrk->Py();
1215  Double_t epz = vtrk->Pz();
1216  Double_t cosoa = (v0px*epx+v0py*epy+v0pz*epz)/sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz)/sqrt(epx*epx+epy*epy+epz*epz);
1217 
1218  TLorentzVector vele, vxi,vlc;
1219  vele.SetXYZM(epx,epy,epz,melePDG);
1220  vxi.SetXYZM(v0px,v0py,v0pz,mxiPDG);
1221  vlc = vele + vxi;
1222 
1223  Double_t dphis_e_pr = 9999.;
1224  Double_t detas_e_pr = 9999.;
1225  Double_t dphis_e_pi = 9999.;
1226  Double_t detas_e_pi = 9999.;
1227  Double_t dphis_e_bach = 9999.;
1228  Double_t detas_e_bach = 9999.;
1229  if(fCutsRD[GetGlobalIndex(2,ptbin)]>0 || fCutsRD[GetGlobalIndex(3,ptbin)]>0){
1230  Double_t xyzR125_e[3], xyzR125_pr[3], xyzR125_pi[3], xyzR125_bach[3];
1231  xyzR125_e[0] = cutvars[0];
1232  xyzR125_e[1] = cutvars[1];
1233  xyzR125_e[2] = cutvars[2];
1234  xyzR125_pr[0] = cutvars[3];
1235  xyzR125_pr[1] = cutvars[4];
1236  xyzR125_pr[2] = cutvars[5];
1237  xyzR125_pi[0] = cutvars[6];
1238  xyzR125_pi[1] = cutvars[7];
1239  xyzR125_pi[2] = cutvars[8];
1240  xyzR125_bach[0] = cutvars[9];
1241  xyzR125_bach[1] = cutvars[10];
1242  xyzR125_bach[2] = cutvars[11];
1243  dphis_e_pr = dPhiSR125(xyzR125_e,xyzR125_pr);
1244  detas_e_pr = dPhiSR125(xyzR125_e,xyzR125_pr);
1245  dphis_e_pi = dPhiSR125(xyzR125_e,xyzR125_pi);
1246  detas_e_pi = dPhiSR125(xyzR125_e,xyzR125_pi);
1247  dphis_e_bach = dPhiSR125(xyzR125_e,xyzR125_bach);
1248  detas_e_bach = dPhiSR125(xyzR125_e,xyzR125_bach);
1249  }
1250 
1251  if(vlc.M() > fCutsRD[GetGlobalIndex(0,ptbin)])
1252  {
1253  okcand = kFALSE;
1254  }
1255  if(cosoa < fCutsRD[GetGlobalIndex(1,ptbin)])
1256  {
1257  okcand = kFALSE;
1258  }
1259  if(fabs(dphis_e_pr) < fCutsRD[GetGlobalIndex(2,ptbin)] && fabs(detas_e_pr) < fCutsRD[GetGlobalIndex(3,ptbin)])
1260  {
1261  okcand = kFALSE;
1262  }
1263  if(fabs(dphis_e_pi) < fCutsRD[GetGlobalIndex(2,ptbin)] && fabs(detas_e_pi) < fCutsRD[GetGlobalIndex(3,ptbin)])
1264  {
1265  okcand = kFALSE;
1266  }
1267  if(fabs(dphis_e_bach) < fCutsRD[GetGlobalIndex(2,ptbin)] && fabs(detas_e_bach) < fCutsRD[GetGlobalIndex(3,ptbin)])
1268  {
1269  okcand = kFALSE;
1270  }
1271 
1272  if(!okcand) return 0;
1273  returnvalueCuts = 1;
1274  }
1275 
1276  Int_t returnvaluePID=1;
1277  if(selectionLevel==AliRDHFCuts::kAll ||
1278  selectionLevel==AliRDHFCuts::kCandidate||
1279  selectionLevel==AliRDHFCuts::kPID) {
1280  }
1281 
1282  Int_t returnvalue = 0;
1283  if(returnvalueCuts==1 && returnvaluePID==1) returnvalue=1;
1284 
1285  return returnvalue;
1286 }
1287 //________________________________________________________________________
1288 Double_t AliRDHFCutsXictoeleXifromAODtracks::DeltaPhi(AliAODcascade *casc, AliAODTrack *trk)
1289 {
1290  //
1291  // Calculate Delta phi
1292  //
1293  Double_t phiv = atan2(casc->MomXiY(),casc->MomXiX());
1294  if(phiv<-M_PI) phiv += 2 *M_PI;
1295  if(phiv> M_PI) phiv -= 2 *M_PI;
1296  Double_t phie = trk->Phi();
1297  if(phie<-M_PI) phie += 2 *M_PI;
1298  if(phie> M_PI) phie -= 2 *M_PI;
1299  Double_t dphi = phiv - phie;
1300  if(dphi<-M_PI) dphi += 2 *M_PI;
1301  if(dphi> M_PI) dphi -= 2 *M_PI;
1302  return dphi;
1303 }
1304 //________________________________________________________________________
1305 Double_t AliRDHFCutsXictoeleXifromAODtracks::DeltaEta(AliAODcascade *casc, AliAODTrack *trk)
1306 {
1307  //
1308  // Calculate Delta Eta
1309  //
1310  Double_t ptotxi = TMath::Sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)+pow(casc->MomXiZ(),2));
1311  Double_t etav = 0.5*TMath::Log((ptotxi+casc->MomXiZ())/(ptotxi-casc->MomXiZ()));
1312  Double_t etae = trk->Eta();
1313  Double_t deta = etav - etae;
1314  return deta;
1315 }
1316 
1317 //________________________________________________________________________
1319 {
1320  //
1321  // Calculate Cosine of opening angle
1322  //
1323 
1324  Double_t xipx = casc->MomXiX();
1325  Double_t xipy = casc->MomXiY();
1326  Double_t xipz = casc->MomXiZ();
1327  Double_t epx = trk->Px();
1328  Double_t epy = trk->Py();
1329  Double_t epz = trk->Pz();
1330  Double_t cosoa = (xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz);
1331  return cosoa;
1332 }
1333 
Bool_t IsSelectedCustomizedPtDepeID(AliAODTrack *trk, AliAODTrack *trkpid)
Int_t fUseV0Topology
PID object for cascade-proton.
Double_t fConversionMassMax
nSigma to exclude for Kaon band
Double_t fSigmaElectronTPCMax
nSigma electron lower limit (par2)
AliRDHFCutsXictoeleXifromAODtracks(const char *name="CutsXictoeleXi")
Bool_t fExcludePionTPC
pT cut for Lc used before object creation
Double_t fProdRfidMaxV0
Minimum Decay vertex of V0.
Bool_t SingleCascadeCuts(AliAODcascade *casc, Double_t *vert)
Double_t dEtaSR125(Double_t *postrack1, Double_t *postrack2)
double Double_t
Definition: External.C:58
AliRDHFCutsXictoeleXifromAODtracks & operator=(const AliRDHFCutsXictoeleXifromAODtracks &source)
Double_t fProdDcaV0PrToPrimVertexMin
Min Dca between v0 and PV.
Bool_t fExcludeKaonTPC
Flag wheter to exlude proton band.
Double_t fProdV0CosineOfPoiningAngleXiMin
Min Xi cos pointing angle to PV.
Double_t fExcludenSigmaPionTPC
Flag wheter to exlude proton band.
Double_t GetSigma(Int_t idet) const
Definition: AliAODPidHF.h:134
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Double_t fProdCascEtaMin
Minimum number of TPC clusters.
Double_t fProdMassTolXi
Tolerance of Xi mass from PDG value (including sideband)
Double_t fProdDcaBachToPrimVertexMin
Max Dca between V0 daughters.
Double_t fProdMassRejOmega
Tolerance of Xi mass from PDG value.
Double_t fProdTrackTPCNclsRatioMin
Min. Number of TPC PID cluster.
Double_t fProdDcaV0DaughtersMax
Max Dca between Xi daughters.
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *obj)
Double_t mass
Double_t fExcludenSigmaKaonTPC
nSigma to exclude for proton band
Double_t fProdRfidMaxXi
Minimum Decay vertex of Xi.
Double_t fSigmaElectronTPCMin
nSigma to exclude for Kaon band
Double_t fProdDcaV0ToPrimVertexMin
Min Dca between Bachelor and PV.
Bool_t fExcludeProtonTPC
Flag wheter to exlude pion band.
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:376
Double_t CosOpeningAngle(AliAODcascade *casc, AliAODTrack *trk)
Bool_t TagConversionsSameSign(AliAODTrack *etrk, Int_t *id2index, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
AliAODPidHF * fPidObjCascPr
PID object for cascade-pion.
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Bool_t fUsePID
Definition: AliRDHFCuts.h:403
Bool_t TagConversions(AliAODTrack *etrk, Int_t *id2index, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
Bool_t fUseCascadePID
Threshold used in IsSelectedCombinedPID.
Double_t fSigmaElectronTOFMin
nSigma to exclude for Kaon band
Double_t fProdDcaV0PiToPrimVertexMin
Min Dca between v0-proton and PV.
Bool_t fProdRejectTrackWithShared
AOD filter Bit used before object creation.
Double_t fProdMassTolLambda
Flag to Reject tracks with shared clusters.
const Double_t etamin
int Int_t
Definition: External.C:63
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:398
Bool_t SelectWithRoughCuts(AliAODcascade *casc, AliAODTrack *trk1)
unsigned int UInt_t
Definition: External.C:33
Double_t fSigmaElectronTPCPtDepPar1
nSigma electron lower limit (par0)
Double_t fBzkG
0: Cowboy+Sailor 1: Cowboy 2:Sailor
float Float_t
Definition: External.C:68
Double_t fSigmaElectronTPCPtDepPar0
nSigma to exclude for Kaon band
const Double_t ptmax
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:426
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:391
void SetSftPosR125(AliAODTrack *track, Double_t bfield, Double_t priVtx[3], Double_t *XSftR125)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Double_t fSigmaElectronTPCPtDepPar2
nSigma electron lower limit (par1)
AliAODTrack * GetBachelor() const
Double_t fSigmaElectronTOFMax
nSigma to exclude for Kaon band
const Double_t ptmin
Int_t MakeRawPid(AliAODTrack *track, Int_t specie)
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:401
Double_t fProdMassTolXiRough
Tolerance of Lambda mass from PDG value.
Double_t fProdXiCosineOfPoiningAngleMin
Min Dca between v0-pion and PV.
Double_t fProdCascProperDecayLengthMax
Max Decay vertex of Xi.
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Bool_t * fVarsForOpt
number of cut vars to be optimized for candidates
Definition: AliRDHFCuts.h:399
Double_t fProdCascNTPCClustersMin
Min V0 cos pointing angle to Xi vertex.
Double_t fProdCascRapMax
Minimum rapidity of cascade.
Bool_t fProdUseAODFilterBit
Min. Number of TPC PID cluster.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliAODPidHF * fPidObjCascPi
Use PID for cascade or not.
Double_t fProdRfidMinV0
Rejection range of Omega mass from PDG value.
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
const Double_t etamax
Double_t fExcludenSigmaProtonTPC
nSigma to exclude for pion band
Double_t fProdCascPtMin
Maximum rapidity of cascade.
Bool_t SingleTrkCutsNoPID(AliAODTrack *trk, AliAODTrack *trkpid, AliAODVertex *primvert)
Int_t fProdAODFilterBit
Flag for AOD filter Bit used before object creation.
Double_t fProdRoughPtMin
Mass cut for Lc used before object creation.
bool Bool_t
Definition: External.C:53
Bool_t SingleTrkCuts(AliAODTrack *trk, AliAODTrack *trkpid, AliAODVertex *primvert)
Double_t GetdPhiSdEtaSR125(AliAODTrack *tracke, AliAODTrack *trackp, AliAODTrack *trackn, AliAODTrack *trackb, Double_t bfield, Double_t priVtx[3], Double_t &dPhiS_ep, Double_t &dEtaS_ep, Double_t &dPhiS_en, Double_t &dEtaS_en, Double_t &dPhiS_eb, Double_t &dEtaS_eb)
Double_t DeltaPhi(AliAODcascade *casc, AliAODTrack *trk)
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:405
Double_t DeltaEta(AliAODcascade *casc, AliAODTrack *trk)
Int_t PtBin(Double_t pt) const
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:425
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts, const AliAODEvent *aod=0x0) const
Double_t dPhiSR125(Double_t *postrack1, Double_t *postrack2)
void SetPidResponse(AliPIDResponse *pidResp)
Definition: AliAODPidHF.h:111