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