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