AliPhysics  master (3d17d9d)
AliRDHFCutsB0toDPi.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: AliRDHFCutsB0toDPi.cxx $ */
17 
19 //
20 // Class for cuts on AOD reconstructed B0->DPlusPi->KPiPi
21 //
22 //
23 // Author Lennart van Doremalen
24 // Utrecht University - l.v.r.vandoremalen@uu.nl
25 //
26 // Several AliPhysics classes have been used as a basis for this code
27 //
28 //
30 
31 #include <TDatabasePDG.h>
32 #include <Riostream.h>
35 #include "AliRDHFCutsB0toDPi.h"
36 #include "AliAODTrack.h"
37 #include "AliESDtrack.h"
38 #include "AliAODPid.h"
39 #include "AliTPCPIDResponse.h"
40 #include "AliAODVertex.h"
41 #include "AliESDVertex.h"
42 
43 using std::cout;
44 using std::endl;
45 
47 ClassImp(AliRDHFCutsB0toDPi);
49 
50 
51 
52 //--------------------------------------------------------------------------
54  AliRDHFCuts(name),
55  fMaxPtPid(9999.),
56  fTPCflag(999.),
57  fCircRadius(0.),
58 
59  fIsCutUsed(0x0),
60 
61  fnVarsDPlusforDPlusptbin(0),
62  fnPtBinsDPlusforDPlusptbin(1),
63  fGlobalIndexDPlusforDPlusptbin(0),
64  fCutsRDDPlusforDPlusptbin(0x0),
65  fnPtBinLimitsDPlusforDPlusptbin(1),
66  fPtBinLimitsDPlusforDPlusptbin(0x0),
67  fIsUpperCutDPlusforDPlusptbin(0x0),
68  fIsCutUsedDPlusforDPlusptbin(0x0),
69  fVarNamesDPlusforDPlusptbin(0x0),
70 
71  fMinITSNclsDaughterType(),
72  fMinTPCNclsDaughterType(),
73  fUseITSRefitDaughterType(),
74  fUseTPCRefitDaughterType(),
75  fUseFilterBitDaughterType(),
76  fFilterBitDaughterType(),
77  fMinPtDaughterType(),
78  fMaxAbsEtaDaughterType(),
79  fHardSelectionArrayITSDaughterType(),
80  fSoftSelectionArrayITSDaughterType(),
81  fNSoftITSCutDaughterType(),
82  fMind0DaughterType(),
83  fMinNormd0DaughterType(),
84 
85  fFiducialYCut(0.8),
86 
87  fnVariablesForCutOptimization(0),
88  fnCutsForOptimization(0),
89  fGlobalIndexCutOptimization(0),
90  fCutsRDForCutOptimization(0x0),
91  fIsUpperCutForCutOptimization(0x0),
92  fCutIndexForCutOptimization(0x0),
93  fSigmaForCutOptimization(0x0),
94  fNumberOfSigmaBinsForCutOptimization(0)
95 {
96  //
97  // Default Constructor
98  //
99 
100  // Main cut setup as function of B0 pt bins
101  const Int_t nvars = 78;
102  SetNVars(nvars);
103 
104  TString varNames[nvars];
105  Int_t iterator = 0;
106 
107  //DPlus cut variables
108  varNames[iterator++] = /*-00-*/ "inv. mass width[GeV]";
109  varNames[iterator++] = /*-01-*/ "delta mass width [GeV]";
110  varNames[iterator++] = /*-02-*/ "pointing angle [Cos(theta)]";
111  varNames[iterator++] = /*-03-*/ "pointing angle XY [Cos(theta)]";
112  varNames[iterator++] = /*-04-*/ "dca12 [cm]";
113  varNames[iterator++] = /*-05-*/ "dca13 [cm]";
114  varNames[iterator++] = /*-06-*/ "dca23 [cm]";
115  varNames[iterator++] = /*-07-*/ "Pt DPlus [GeV/c]";
116  varNames[iterator++] = /*-08-*/ "Pt first daughter [GeV/c]";
117  varNames[iterator++] = /*-09-*/ "Pt second daughter [GeV/c]";
118  varNames[iterator++] = /*-10-*/ "Pt third daughter [GeV/c]";
119  varNames[iterator++] = /*-11-*/ "d0 DPlus [cm]";
120  varNames[iterator++] = /*-12-*/ "d0 first daughter [cm]";
121  varNames[iterator++] = /*-13-*/ "d0 second daughter [cm]";
122  varNames[iterator++] = /*-14-*/ "d0 third daughter [cm]";
123  varNames[iterator++] = /*-15-*/ "d0d0d0 [cm^3]";
124  varNames[iterator++] = /*-16-*/ "d0d012 [cm^2]";
125  varNames[iterator++] = /*-17-*/ "d0d013 [cm^2]";
126  varNames[iterator++] = /*-18-*/ "d0d023 [cm^2]";
127  varNames[iterator++] = /*-19-*/ "d0d0 XY [cm^2]";
128 
129  varNames[iterator++] = /*-20-*/ "smallest Angle Mother Daughters";
130  varNames[iterator++] = /*-21-*/ "largest Angle Mother Daughter";
131  varNames[iterator++] = /*-22-*/ "angle difference";
132  varNames[iterator++] = /*-23-*/ "vertexDistance [cm]";
133  varNames[iterator++] = /*-24-*/ "vertex distance XY [cm]";
134  varNames[iterator++] = /*-25-*/ "pseudoProperDecayTime";
135  varNames[iterator++] = /*-26-*/ "DecayTime";
136  varNames[iterator++] = /*-27-*/ "normalizedDecayTime";
137  varNames[iterator++] = /*-28-*/ "normDecayLength";
138  varNames[iterator++] = /*-29-*/ "normDecayLength XY";
139  varNames[iterator++] = /*-30-*/ "Chi2 per NDF vertex";
140 
141  varNames[iterator++] = /*-31-*/ "Normalized d0 DPlus First pion [cm]";
142  varNames[iterator++] = /*-32-*/ "Normalized d0 DPlus kaon [cm]";
143  varNames[iterator++] = /*-33-*/ "Normalized d0 DPlus Second pion [cm]";
144  varNames[iterator++] = /*-34-*/ "Normalized d0 DPlus [cm]";
145  varNames[iterator++] = /*-35-*/ "Normalized impact product DPlus [cm^3]";
146  varNames[iterator++] = /*-36-*/ "Dist12 [cm]";
147  varNames[iterator++] = /*-37-*/ "Dist23 [cm]";
148  varNames[iterator++] = /*-38-*/ "Sigma vertex";
149 
150  varNames[iterator++] = /*-39-*/ "pointingAngleToB0";
151  varNames[iterator++] = /*-40-*/ "d0MotherToB0";
152  varNames[iterator++] = /*-41-*/ "d0FirstDaughterToB0";
153  varNames[iterator++] = /*-42-*/ "d0SecondDaughterToB0";
154  varNames[iterator++] = /*-43-*/ "d0ThirdDaughterToB0";
155  varNames[iterator++] = /*-44-*/ "impactProductToB0";
156  varNames[iterator++] = /*-45-*/ "impactProductXYToB0";
157  varNames[iterator++] = /*-46-*/ "normDecayLengthToB0";
158  varNames[iterator++] = /*-47-*/ "pseudoProperDecayTimeToB0";
159  varNames[iterator++] = /*-48-*/ "DecayTimeToB0";
160  varNames[iterator++] = /*-49-*/ "normalizedDecayTimeToB0";
161 
162  //B0 cut variables
163  varNames[iterator++] = /*-50-*/ "inv. mass width[GeV]";
164  varNames[iterator++] = /*-51-*/ "delta mass width [GeV]";
165  varNames[iterator++] = /*-52-*/ "pointing angle [Cos(theta)]";
166  varNames[iterator++] = /*-53-*/ "pointing angle XY [Cos(theta)]";
167  varNames[iterator++] = /*-54-*/ "dca [cm]";
168  varNames[iterator++] = /*-55-*/ "Pt B0 [GeV/c]";
169  varNames[iterator++] = /*-56-*/ "Pt DPlus [GeV/c]";
170  varNames[iterator++] = /*-57-*/ "Pt Pion [GeV/c]";
171  varNames[iterator++] = /*-58-*/ "d0 B0 [cm]";
172  varNames[iterator++] = /*-59-*/ "d0 DPlus [cm]";
173  varNames[iterator++] = /*-60-*/ "d0 Pion [cm]";
174  varNames[iterator++] = /*-61-*/ "d0d0 [cm^2]";
175  varNames[iterator++] = /*-62-*/ "d0d0 XY [cm^2]";
176  varNames[iterator++] = /*-63-*/ "angleMotherFirstDaughter";
177  varNames[iterator++] = /*-64-*/ "angleMotherSecondDaughter";
178  varNames[iterator++] = /*-65-*/ "angleBetweenBothDaughters";
179  varNames[iterator++] = /*-66-*/ "cosThetaStar";
180 
181  varNames[iterator++] = /*-67-*/ "vertexDistance [cm]";
182  varNames[iterator++] = /*-68-*/ "vertex distance XY [cm]";
183  varNames[iterator++] = /*-69-*/ "pseudoProperDecayTime";
184  varNames[iterator++] = /*-70-*/ "DecayTime";
185  varNames[iterator++] = /*-71-*/ "normalizedDecayTime";
186  varNames[iterator++] = /*-72-*/ "normDecayLength";
187  varNames[iterator++] = /*-73-*/ "normDecayLength XY";
188  varNames[iterator++] = /*-74-*/ "Chi2 per NDF vertex";
189 
190  varNames[iterator++] = /*-75-*/ "Normalized d0 B0 pion [cm]";
191  varNames[iterator++] = /*-76-*/ "Normalized d0 B0 [cm]";
192  varNames[iterator++] = /*-77-*/ "Normalized impact product B0 [cm^2]";
193 
194  Bool_t isUpperCut[nvars] = {0};
195 
196  SetVarNames(nvars, varNames, isUpperCut);
197 
198  Float_t limits[2] = {0, 999999999.};
199  SetPtBins(2, limits);
200 
201 
202  //
203  // Initialization of DPlus cuts for DPlus pt bins
204  //
205 
206  const Int_t nvarsDPlusforDPlusptbin = 39;
207  SetNVarsDPlusforDPlusptbin(nvarsDPlusforDPlusptbin);
208 
209  TString varNamesDPlusforDPlusptbin[nvarsDPlusforDPlusptbin];
210  iterator = 0;
211 
212  //DPlus cut variables
213  varNamesDPlusforDPlusptbin[iterator++] = /*-00-*/ "inv. mass width[GeV]";
214  varNamesDPlusforDPlusptbin[iterator++] = /*-01-*/ "delta mass width [GeV]";
215  varNamesDPlusforDPlusptbin[iterator++] = /*-02-*/ "pointing angle [Cos(theta)]";
216  varNamesDPlusforDPlusptbin[iterator++] = /*-03-*/ "pointing angle XY [Cos(theta)]";
217  varNamesDPlusforDPlusptbin[iterator++] = /*-04-*/ "dca12 [cm]";
218  varNamesDPlusforDPlusptbin[iterator++] = /*-05-*/ "dca13 [cm]";
219  varNamesDPlusforDPlusptbin[iterator++] = /*-06-*/ "dca23 [cm]";
220  varNamesDPlusforDPlusptbin[iterator++] = /*-07-*/ "Pt DPlus [GeV/c]";
221  varNamesDPlusforDPlusptbin[iterator++] = /*-08-*/ "Pt first daughter [GeV/c]";
222  varNamesDPlusforDPlusptbin[iterator++] = /*-09-*/ "Pt second daughter [GeV/c]";
223  varNamesDPlusforDPlusptbin[iterator++] = /*-10-*/ "Pt third daughter [GeV/c]";
224  varNamesDPlusforDPlusptbin[iterator++] = /*-11-*/ "d0 DPlus [cm]";
225  varNamesDPlusforDPlusptbin[iterator++] = /*-12-*/ "d0 first daughter [cm]";
226  varNamesDPlusforDPlusptbin[iterator++] = /*-13-*/ "d0 second daughter [cm]";
227  varNamesDPlusforDPlusptbin[iterator++] = /*-14-*/ "d0 third daughter [cm]";
228  varNamesDPlusforDPlusptbin[iterator++] = /*-15-*/ "d0d0d0 [cm^3]";
229  varNamesDPlusforDPlusptbin[iterator++] = /*-16-*/ "d0d012 [cm^2]";
230  varNamesDPlusforDPlusptbin[iterator++] = /*-17-*/ "d0d013 [cm^2]";
231  varNamesDPlusforDPlusptbin[iterator++] = /*-18-*/ "d0d023 [cm^2]";
232  varNamesDPlusforDPlusptbin[iterator++] = /*-19-*/ "d0d0 XY [cm^2]";
233 
234  varNamesDPlusforDPlusptbin[iterator++] = /*-20-*/ "smallest Angle Mother Daughters";
235  varNamesDPlusforDPlusptbin[iterator++] = /*-21-*/ "largest Angle Mother Daughter";
236  varNamesDPlusforDPlusptbin[iterator++] = /*-22-*/ "angle difference";
237  varNamesDPlusforDPlusptbin[iterator++] = /*-23-*/ "vertexDistance [cm]";
238  varNamesDPlusforDPlusptbin[iterator++] = /*-24-*/ "vertex distance XY [cm]";
239  varNamesDPlusforDPlusptbin[iterator++] = /*-25-*/ "pseudoProperDecayTime";
240  varNamesDPlusforDPlusptbin[iterator++] = /*-26-*/ "DecayTime";
241  varNamesDPlusforDPlusptbin[iterator++] = /*-27-*/ "normalizedDecayTime";
242  varNamesDPlusforDPlusptbin[iterator++] = /*-28-*/ "normDecayLength";
243  varNamesDPlusforDPlusptbin[iterator++] = /*-29-*/ "normDecayLength XY";
244  varNamesDPlusforDPlusptbin[iterator++] = /*-30-*/ "Chi2 per NDF vertex";
245 
246  varNamesDPlusforDPlusptbin[iterator++] = /*-31-*/ "Normalized d0 DPlus First pion [cm]";
247  varNamesDPlusforDPlusptbin[iterator++] = /*-32-*/ "Normalized d0 DPlus kaon [cm]";
248  varNamesDPlusforDPlusptbin[iterator++] = /*-33-*/ "Normalized d0 DPlus Second pion [cm]";
249  varNamesDPlusforDPlusptbin[iterator++] = /*-34-*/ "Normalized d0 DPlus [cm]";
250  varNamesDPlusforDPlusptbin[iterator++] = /*-35-*/ "Normalized impact product DPlus [cm^3]";
251  varNamesDPlusforDPlusptbin[iterator++] = /*-36-*/ "Dist12 [cm]";
252  varNamesDPlusforDPlusptbin[iterator++] = /*-37-*/ "Dist23 [cm]";
253  varNamesDPlusforDPlusptbin[iterator++] = /*-38-*/ "Sigma vertex";
254 
255  Bool_t isUpperCutDPlusforDPlusptbin[nvarsDPlusforDPlusptbin] = {0};
256 
257  SetVarNamesDPlusforDPlusptbin(nvarsDPlusforDPlusptbin, varNamesDPlusforDPlusptbin, isUpperCutDPlusforDPlusptbin);
258 
259  Float_t limitsDPlusforDPlusptbin[2] = {0, 999999999.};
260  SetPtBinsDPlusforDPlusptbin(2, limitsDPlusforDPlusptbin);
261 
262  Bool_t forOpt[16] = {0}; //not used for B0 analysis
263  SetVarsForOpt(16, forOpt);
264 
265 }
266 //--------------------------------------------------------------------------
268  AliRDHFCuts(source),
269  fMaxPtPid(source.fMaxPtPid),
270  fTPCflag(source.fTPCflag),
271  fCircRadius(source.fCircRadius),
272  fIsCutUsed(0x0),
273 
283 
293 {
294  //
295  // Copy constructor
296  //
297 
300  if (source.fIsCutUsed)
301  {
302  if (fIsCutUsed) {
303  delete [] fIsCutUsed;
304  fIsCutUsed = nullptr;
305  }
306  fIsCutUsed = new Bool_t[(source.GetNPtBins()) * (source.GetNVars())];
307 
308  for (Int_t i = 0; i < source.fnVars; ++i)
309  {
310  for (Int_t j = 0; j < source.fnPtBins; j++)
311  {
312  Bool_t bUse = source.GetIsCutUsed(i, j);
313  SetIsCutUsed(i, j, bUse);
314  }
315  }
316  }
317  if (source.fIsCutUsedDPlusforDPlusptbin)
318  {
322  }
324  for (Int_t i = 0; i < source.fnVarsDPlusforDPlusptbin; ++i)
325  {
326  for (Int_t j = 0; j < source.fnPtBinsDPlusforDPlusptbin; j++)
327  {
328  Bool_t bUse = source.GetIsCutUsedDPlusforDPlusptbin(i, j);
329  SetIsCutUsedDPlusforDPlusptbin(i, j, bUse);
330  }
331  }
332  }
335  {
339  }
341  for (Int_t i = 0; i < source.fnVariablesForCutOptimization; i++)
342  {
343  Bool_t bUpperCut = source.GetIsUpperCutForCutOptimization(i);
344  SetIsUpperCutForCutOptimization(i, bUpperCut);
345  }
346  }
347  if (source.fCutIndexForCutOptimization)
348  {
350  delete [] fCutIndexForCutOptimization;
351  fCutIndexForCutOptimization = nullptr;
352  }
354  for (Int_t i = 0; i < source.fnVariablesForCutOptimization; i++)
355  {
356  Int_t nCutIndex = source.GetCutIndexForCutOptimization(i);
357  SetCutIndexForCutOptimization(i, nCutIndex);
358  }
359  }
360  if (source.fSigmaForCutOptimization)
361  {
363  delete [] fSigmaForCutOptimization;
364  fSigmaForCutOptimization = nullptr;
365  }
367  for (Int_t i = 0; i < source.fnPtBins; i++)
368  {
369  Double_t binSigma = source.GetSigmaForCutOptimization(i);
370  SetSigmaForCutOptimization(binSigma, i);
371  }
372  }
375 
376  Int_t nDaughterTypes = 3;
377  for (int i = 0; i < nDaughterTypes; ++i)
378  {
390 
391  Bool_t bHardArray[7] = {0}; Bool_t bSoftArray[7] = {0};
392  source.GetHardSelectionArrayITSDaughterType(i, bHardArray);
393  source.GetSoftSelectionArrayITSDaughterType(i, bSoftArray);
396  }
397 
398 }
399 //--------------------------------------------------------------------------
401  //
402  // Default Destructor
403  //
404 
405  if (fIsCutUsed) { delete [] fIsCutUsed; fIsCutUsed = nullptr; }
415 }
416 //--------------------------------------------------------------------------
418 {
419  //
420  // assignment operator
421  //
422 
423  if (&source == this) return *this;
424 
425  AliRDHFCuts::operator=(source);
426 
427  fMaxPtPid = source.fMaxPtPid;
428  fTPCflag = source.fTPCflag;
429  fCircRadius = source.fCircRadius;
434 
435  fFiducialYCut = source.fFiducialYCut;
440 
443  if (source.fIsCutUsed)
444  {
445  if (fIsCutUsed) {
446  delete [] fIsCutUsed;
447  fIsCutUsed = nullptr;
448  }
449  fIsCutUsed = new Bool_t[(source.GetNPtBins()) * (source.GetNVars())];
450 
451  for (Int_t i = 0; i < source.fnVars; ++i)
452  {
453  for (Int_t j = 0; j < source.fnPtBins; j++)
454  {
455  Bool_t bUse = source.GetIsCutUsed(i, j);
456  SetIsCutUsed(i, j, bUse);
457  }
458  }
459  }
460  if (source.fIsCutUsedDPlusforDPlusptbin)
461  {
465  }
467  for (Int_t i = 0; i < source.fnVarsDPlusforDPlusptbin; ++i)
468  {
469  for (Int_t j = 0; j < source.fnPtBinsDPlusforDPlusptbin; j++)
470  {
471  Bool_t bUse = source.GetIsCutUsedDPlusforDPlusptbin(i, j);
472  SetIsCutUsedDPlusforDPlusptbin(i, j, bUse);
473  }
474  }
475  }
478  {
482  }
484  for (Int_t i = 0; i < source.fnVariablesForCutOptimization; i++)
485  {
486  Bool_t bUpperCut = source.GetIsUpperCutForCutOptimization(i);
487  SetIsUpperCutForCutOptimization(i, bUpperCut);
488  }
489  }
490  if (source.fCutIndexForCutOptimization)
491  {
493  delete [] fCutIndexForCutOptimization;
494  fCutIndexForCutOptimization = nullptr;
495  }
497  for (Int_t i = 0; i < source.fnVariablesForCutOptimization; i++)
498  {
499  Int_t nCutIndex = source.GetCutIndexForCutOptimization(i);
500  SetCutIndexForCutOptimization(i, nCutIndex);
501  }
502  }
503  if (source.fSigmaForCutOptimization)
504  {
506  delete [] fSigmaForCutOptimization;
507  fSigmaForCutOptimization = nullptr;
508  }
510  for (Int_t i = 0; i < source.fnPtBins; i++)
511  {
512  Double_t binSigma = source.GetSigmaForCutOptimization(i);
513  SetSigmaForCutOptimization(binSigma, i);
514  }
515  }
518 
519  Int_t nDaughterTypes = 3;
520  for (int i = 0; i < nDaughterTypes; ++i)
521  {
533 
534  Bool_t bHardArray[7] = {0}; Bool_t bSoftArray[7] = {0};
535  source.GetHardSelectionArrayITSDaughterType(i, bHardArray);
536  source.GetSoftSelectionArrayITSDaughterType(i, bSoftArray);
539  }
540 
541  return *this;
542 }
543 //--------------------------------------------------------------------------
544 void AliRDHFCutsB0toDPi::GetCutVarsForOpt(AliAODRecoDecayHF* /*d*/, Float_t* /*vars*/, Int_t /*nvars*/, Int_t* /*pdgdaughters*/) {
545  // not used - alternative cut optimization method below
546 
547  return;
548 }
549 //--------------------------------------------------------------------------
550 Int_t AliRDHFCutsB0toDPi::IsSelected(TObject* obj, Int_t selectionLevel, AliAODEvent* aod, Bool_t bCutArray[78]) {
551  //
552  // In this function we apply the selection cuts on the B0 candidate and its daughters.
553  // The function returns 0 if the candidate is cut and is able to return information on which cuts the candidate passes.
554  //
555 
556  fIsSelectedCuts = 0;
557  fIsSelectedPID = 0;
558 
559  // The cuts used in this class have to be set in the maketfile.
560  if (!fCutsRD) {
561  cout << "Cut matrice not inizialized. Exit..." << endl;
562  return 0;
563  }
564 
566  if (!candidateB0) {
567  cout << "candidateB0 null" << endl;
568  return 0;
569  }
570 
571  AliAODRecoDecayHF3Prong* candidateDPlus = (AliAODRecoDecayHF3Prong*)candidateB0->GetDaughter(0);
572  if (!candidateDPlus) {
573  std::cout << "candidateDPlus null" << std::endl;
574  return 0;
575  }
576 
577  AliAODTrack *candidateB0Pion = (AliAODTrack*)candidateB0->GetDaughter(1);
578  if (!candidateB0Pion) {
579  std::cout << "candidateB0Pion null" << std::endl;
580  return 0;
581  }
582 
583  // AliAODTrack *candidateFirstDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(0);
584  // if (!candidateFirstDaughter) {
585  // std::cout << "candidatePion null" << std::endl;
586  // return 0;
587  // }
588 
589  // AliAODTrack *candidateSecondDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(1);
590  // if (!candidateSecondDaughter) {
591  // std::cout << "candidateKaon null" << std::endl;
592  // return 0;
593  // }
594 
595  // AliAODTrack *candidateThirdDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(2);
596  // if (!candidateSecondDaughter) {
597  // std::cout << "candidatePion null" << std::endl;
598  // return 0;
599  // }
600 
601  AliAODVertex * vertexB0 = candidateB0->GetSecondaryVtx();
602  if (!vertexB0) {
603  std::cout << "vertexB0 null" << std::endl;
604  return 0;
605  }
606 
607  // AliAODVertex * vertexDPlus = candidateDPlus->GetSecondaryVtx();
608  // if (!vertexDPlus) {
609  // std::cout << "vertexDPlus null" << std::endl;
610  // return 0;
611  // }
612 
613  AliAODVertex * primaryVertex = aod->GetPrimaryVertex();
614  if (!primaryVertex) {
615  std::cout << "primaryVertex null" << std::endl;
616  return 0;
617  }
618 
619  Int_t returnvalue = 1;
620  Bool_t bPassedCut = kFALSE;
621 
622  //get the magnetic field
623  Double_t bz = (Double_t)aod->GetMagneticField();
624 
625  // selection on candidate
626  if (selectionLevel == AliRDHFCuts::kAll ||
627  selectionLevel == AliRDHFCuts::kCandidate) {
628 
629  // We check to which pt bin the candidate belongs
630  Int_t ptbin = PtBin(candidateB0->Pt());
631  if (ptbin == -1) return -1;
632 
633  // We obtain the variable values in the section below
634  // DPlusMass and B0mass
635  Double_t mDPlusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
636  Double_t mB0PDG = TDatabasePDG::Instance()->GetParticle(511)->Mass();
637 
638  // delta mass PDG
639  Double_t deltaPDG = mB0PDG - mDPlusPDG;
640 
641  // Half width B0 mass
642  UInt_t prongs[2];
643  prongs[0] = 411; prongs[1] = 211;
644  Double_t invMassB0 = candidateB0->InvMass(2, prongs);
645  Double_t invMassDifference = TMath::Abs(mB0PDG - invMassB0);
646  Double_t invMassDelta = TMath::Abs(deltaPDG - (DeltaInvMassB0Kpipipi(candidateB0)));
647 
648  Double_t pointingAngle = candidateB0->CosPointingAngle();
649  Double_t dcaMother = candidateB0->GetDCA();
650  Double_t ptMother = candidateB0->Pt();
651  Double_t momentumMother = candidateB0->P();
652  Double_t ptDPlus = candidateDPlus->Pt();
653  Double_t ptPion = candidateB0Pion->Pt();
654 
655  AliExternalTrackParam motherTrack;
656  motherTrack.CopyFromVTrack(candidateB0);
657  Double_t d0z0[2], covd0z0[3], d0[2];
658  motherTrack.PropagateToDCA(primaryVertex, bz, 100., d0z0, covd0z0);
659  d0[0] = d0z0[0];
660  Double_t d0Mother = TMath::Abs(d0[0]);
661  Double_t d0firstTrack = TMath::Abs(candidateB0->Getd0Prong(0));
662  Double_t d0secondTrack = TMath::Abs(candidateB0->Getd0Prong(1));
663 
664  Double_t impactProduct = candidateB0->Getd0Prong(0) * candidateB0->Getd0Prong(1);
665  Double_t impactProductXY = TMath::Abs(candidateB0->ImpParXY());
666 
667  Double_t angleMotherFirstDaughter = (candidateB0->Px() * candidateDPlus->Px() + candidateB0->Py() * candidateDPlus->Py() + candidateB0->Pz() * candidateDPlus->Pz()) / (candidateB0->P() * candidateDPlus->P());
668  Double_t angleMotherSecondDaughter = (candidateB0->Px() * candidateB0Pion->Px() + candidateB0->Py() * candidateB0Pion->Py() + candidateB0->Pz() * candidateB0Pion->Pz()) / (candidateB0->P() * candidateB0Pion->P());
669 
670  Double_t angleBetweenBothDaughters = (candidateDPlus->Px() * candidateB0Pion->Px() + candidateDPlus->Py() * candidateB0Pion->Py() + candidateDPlus->Pz() * candidateB0Pion->Pz()) / (candidateDPlus->P() * candidateB0Pion->P());
671 
672  Double_t cosThetaStar = candidateB0->CosThetaStar(0, 511, 411, 211);
673 
674  Double_t vertexDistance = vertexB0->DistanceToVertex(primaryVertex);
675  Double_t normDecayLength = candidateB0->NormalizedDecayLength();
676  Double_t pdgMassMother = TDatabasePDG::Instance()->GetParticle(511)->Mass();
677  Double_t pseudoProperDecayLength = ((vertexB0->GetX() - primaryVertex->GetX()) * candidateB0->Px() / TMath::Abs(candidateB0->Pt())) + ((vertexB0->GetY() - primaryVertex->GetY()) * candidateB0->Py() / TMath::Abs(candidateB0->Pt()));
678  Double_t pseudoProperDecayTime = pseudoProperDecayLength * pdgMassMother / ptMother;
679  Double_t decayTime = vertexDistance / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother / (momentumMother * momentumMother)) + 1)));
680 
681  Double_t phi = candidateB0->Phi();
682  Double_t theta = candidateB0->Theta();
683  Double_t covMatrix[21];
684  candidateB0->GetCovarianceXYZPxPyPz(covMatrix);
685 
686  Double_t cp = TMath::Cos(phi);
687  Double_t sp = TMath::Sin(phi);
688  Double_t ct = TMath::Cos(theta);
689  Double_t st = TMath::Sin(theta);
690 
691  Double_t errorMomentum = covMatrix[9] * cp * cp * ct * ct // GetCovPxPx
692  + covMatrix[13] * 2.*cp * sp * ct * ct // GetCovPxPy
693  + covMatrix[18] * 2.*cp * ct * st // GetCovPxPz
694  + covMatrix[14] * sp * sp * ct * ct // GetCovPyPy
695  + covMatrix[19] * 2.*sp * ct * st // GetCovPyPz
696  + covMatrix[20] * st * st; // GetCovPzPz
697  Double_t normalizedDecayTime = candidateB0->NormalizedDecayLength() / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother * errorMomentum * errorMomentum / (momentumMother * momentumMother)) + 1)));
698 
699  Double_t cosPointingAngleXY = candidateB0->CosPointingAngleXY();
700  Double_t distanceXYToVertex = vertexB0->DistanceXYToVertex(primaryVertex);
701  Double_t normalizedDecayLengthXY = candidateB0->NormalizedDecayLengthXY();
702  Double_t chi2Vertex = vertexB0->GetChi2perNDF();
703 
704  Double_t Normalizedd0B0pion = TMath::Abs(candidateB0->Getd0Prong(1) / candidateB0->Getd0errProng(1));
705  Double_t Normalizedd0B0 = TMath::Abs(d0[0] / TMath::Sqrt(covd0z0[0]));
706  Double_t NormalizedimpactproductB0 = (candidateB0->Getd0Prong(0) / candidateB0->Getd0errProng(0)) * (candidateB0->Getd0Prong(1) / candidateB0->Getd0errProng(1));
707 
708  // We apply the cuts
709  Int_t nCutIndex = 0;
710  Double_t cutVariableValue = 0.0;
711 
712  // "inv. mass width [GeV]" --------------------------------------------
713  nCutIndex = 50;
714  cutVariableValue = invMassDifference;
715  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
716  //---------------------------------------------------------------------
717 
718  // "delta mass width [GeV]" -------------------------------------------
719  nCutIndex = 51;
720  cutVariableValue = invMassDelta;
721  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
722  //---------------------------------------------------------------------
723 
724  // "pointing angle [Cos(theta)]" --------------------------------------
725  nCutIndex = 52;
726  cutVariableValue = pointingAngle;
727  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
728  //---------------------------------------------------------------------
729 
730  // "pointing angle XY" ----------------------------------------------------
731  nCutIndex = 53;
732  cutVariableValue = cosPointingAngleXY;
733  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
734  //---------------------------------------------------------------------
735 
736  // "dca12 (cm)" ---------------------------------------------------------
737  nCutIndex = 54;
738  cutVariableValue = dcaMother;
739  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
740  //---------------------------------------------------------------------
741 
742  // "Pt B0 [GeV/c]" ----------------------------------------------------
743  nCutIndex = 55;
744  cutVariableValue = ptMother;
745  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
746  //---------------------------------------------------------------------
747 
748  // "Pt DPlus [GeV/c]" -------------------------------------------------
749  nCutIndex = 56;
750  cutVariableValue = ptDPlus;
751  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
752  //---------------------------------------------------------------------
753 
754  // "Pt Pion [GeV/c]" --------------------------------------------------
755  nCutIndex = 57;
756  cutVariableValue = ptPion;
757  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
758  //---------------------------------------------------------------------
759 
760  // "d0 B0 (cm)" -------------------------------------------------------
761  nCutIndex = 58;
762  cutVariableValue = d0Mother;
763  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
764  //---------------------------------------------------------------------
765 
766  // "d0 DPlus (cm)"-----------------------------------------------------
767  nCutIndex = 59;
768  cutVariableValue = d0firstTrack;
769  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
770  //---------------------------------------------------------------------
771 
772  // "d0 First Pion (cm)" -----------------------------------------------------
773  nCutIndex = 60;
774  cutVariableValue = d0secondTrack;
775  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
776  //---------------------------------------------------------------------
777 
778  // "d0d0d0 [cm^2]" ------------------------------------------------------
779  nCutIndex = 61;
780  cutVariableValue = impactProduct;
781  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
782  //---------------------------------------------------------------------
783 
784  // "d0 XY [cm^2]" ---------------------------------------------------
785  nCutIndex = 62;
786  cutVariableValue = impactProductXY;
787  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
788  //---------------------------------------------------------------------
789 
790  // "angleMotherFirstDaughter" -------------------------------------
791  nCutIndex = 63;
792  cutVariableValue = angleMotherFirstDaughter;
793  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
794  //---------------------------------------------------------------------
795 
796  // "angleMotherSecondDaughter" ---------------------------------
797  nCutIndex = 64;
798  cutVariableValue = angleMotherSecondDaughter;
799  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
800  //---------------------------------------------------------------------
801 
802  // "angleBetweenBothDaughters" --------------------------------
803  nCutIndex = 65;
804  cutVariableValue = angleBetweenBothDaughters;
805  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
806  //---------------------------------------------------------------------
807 
808  // "cosThetaStar" --------------------------------
809  nCutIndex = 66;
810  cutVariableValue = cosThetaStar;
811  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
812  //---------------------------------------------------------------------
813 
814  // "vertexDistance" ---------------------------------------------------
815  nCutIndex = 67;
816  cutVariableValue = vertexDistance;
817  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
818  //---------------------------------------------------------------------
819 
820  // "vertex distance XY" ----------------------------------------------------
821  nCutIndex = 68;
822  cutVariableValue = distanceXYToVertex;
823  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
824  //---------------------------------------------------------------------
825 
826  // "pseudoProperDecayTime" --------------------------------------------
827  nCutIndex = 69;
828  cutVariableValue = pseudoProperDecayTime;
829  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
830  //---------------------------------------------------------------------
831 
832  // "DecayTime" --------------------------------------------------------
833  nCutIndex = 70;
834  cutVariableValue = decayTime;
835  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
836  //---------------------------------------------------------------------
837 
838  // "normalizedDecayTime" ----------------------------------------------------
839  nCutIndex = 71;
840  cutVariableValue = normalizedDecayTime;
841  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
842  //---------------------------------------------------------------------
843 
844  // "normDecayLength" --------------------------------------------------
845  nCutIndex = 72;
846  cutVariableValue = normDecayLength;
847  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
848  //---------------------------------------------------------------------
849 
850  // "normalized decay length XY" ----------------------------------------------------
851  nCutIndex = 73;
852  cutVariableValue = normalizedDecayLengthXY;
853  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
854  //---------------------------------------------------------------------
855 
856  // "chi squared per NDF" ----------------------------------------------------
857  nCutIndex = 74;
858  cutVariableValue = chi2Vertex;
859  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
860 
861  // "Normalizedd0B0Pion" ----------------------------------------------------
862  nCutIndex = 75;
863  cutVariableValue = Normalizedd0B0pion;
864  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
865  //---------------------------------------------------------------------
866 
867  // "Normalizedd0B0" ----------------------------------------------------
868  nCutIndex = 76;
869  cutVariableValue = Normalizedd0B0;
870  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
871  //---------------------------------------------------------------------
872 
873  // "NormalizedimpactproductB0" ----------------------------------------------------
874  nCutIndex = 77;
875  cutVariableValue = NormalizedimpactproductB0;
876  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
877  //---------------------------------------------------------------------
878 
879 
880  // select DPlus
881  bPassedCut = IsDPlusFromB0Selected(ptMother, candidateB0, selectionLevel, aod, bCutArray);
882  }
883 
884  if (bPassedCut == kFALSE)
885  {
886  returnvalue = 0;
887  } else
888  {
889  for (Int_t i = 50; i < 78; ++i)
890  {
891  if (bCutArray[i] == kTRUE) {
892  returnvalue = 0;
893  break;
894  }
895  }
896  }
897 
898  fIsSelectedCuts = returnvalue;
899 
900  return returnvalue;
901 }
902 //_________________________________________________________________________________________________
903 Int_t AliRDHFCutsB0toDPi::IsDPlusFromB0Selected(Double_t ptB0, TObject* obj, Int_t selectionLevel, AliAODEvent* aod, Bool_t bCutArray[78]) {
904  //
905  // Apply selection on DPlus candidate from B0 candidate. We have to pass the B0 candidate to this function to get variables w.r.t. B0 vertex.
906  //
907 
908  if (!fCutsRD) {
909  cout << "Cut matrice not inizialized. Exit..." << endl;
910  return 0;
911  }
912 
914  if (!candidateB0) {
915  cout << "candidateB0 null" << endl;
916  return 0;
917  }
918 
919  AliAODRecoDecayHF3Prong* candidateDPlus = (AliAODRecoDecayHF3Prong*)candidateB0->GetDaughter(0);
920  if (!candidateDPlus) {
921  std::cout << "candidateDPlus null" << std::endl;
922  return 0;
923  }
924 
925  AliAODTrack *candidateB0Pion = (AliAODTrack*)candidateB0->GetDaughter(1);
926  if (!candidateB0Pion) {
927  std::cout << "candidateB0Pion null" << std::endl;
928  return 0;
929  }
930 
931  AliAODTrack *candidateFirstDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(0);
932  if (!candidateFirstDaughter) {
933  std::cout << "candidatePion null" << std::endl;
934  return 0;
935  }
936 
937  AliAODTrack *candidateSecondDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(1);
938  if (!candidateSecondDaughter) {
939  std::cout << "candidateKaon null" << std::endl;
940  return 0;
941  }
942 
943  AliAODTrack *candidateThirdDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(2);
944  if (!candidateSecondDaughter) {
945  std::cout << "candidatePion null" << std::endl;
946  return 0;
947  }
948 
949  AliAODVertex * vertexB0 = candidateB0->GetSecondaryVtx();
950  if (!vertexB0) {
951  std::cout << "vertexB0 null" << std::endl;
952  return 0;
953  }
954 
955  AliAODVertex * vertexDPlus = candidateDPlus->GetSecondaryVtx();
956  if (!vertexDPlus) {
957  std::cout << "vertexDPlus null" << std::endl;
958  return 0;
959  }
960 
961  AliAODVertex * primaryVertex = aod->GetPrimaryVertex();
962  if (!primaryVertex) {
963  std::cout << "primaryVertex null" << std::endl;
964  return 0;
965  }
966 
967  Int_t returnvalue = 1;
968  Bool_t bPassedCut = kFALSE;
969 
970  //get the magnetic field
971  Double_t bz = (Double_t)aod->GetMagneticField();
972 
973 
974  // selection on candidate
975  if (selectionLevel == AliRDHFCuts::kAll ||
976  selectionLevel == AliRDHFCuts::kCandidate) {
977 
978  Int_t ptbin = PtBin(ptB0);
979 
980  // DPlusmass
981  Double_t mDPlusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
982  Double_t mPionPDG = TDatabasePDG::Instance()->GetParticle(211)->Mass();
983 
984  // DPlus window - invariant mass
985  UInt_t prongs[3];
986  prongs[0] = 211;
987  prongs[1] = 321;
988  prongs[2] = 211;
989 
990  // delta mass PDG
991  Double_t deltaPDG = mDPlusPDG - 2 * mPionPDG;
992 
993  Double_t invMassDPlus = candidateDPlus->InvMass(3, prongs);
994  Double_t invMassDifference = TMath::Abs(mDPlusPDG - invMassDPlus);
995  Double_t eKaon1 = candidateDPlus->EProng(1, 321);
996  Double_t ePion2 = candidateDPlus->EProng(2, 211);
997  Double_t eSum = eKaon1 + ePion2;
998  Double_t pxPions = (candidateDPlus->PxProng(1) + candidateDPlus->PxProng(2)) * (candidateDPlus->PxProng(1) + candidateDPlus->PxProng(2));
999  Double_t pyPions = (candidateDPlus->PyProng(1) + candidateDPlus->PyProng(2)) * (candidateDPlus->PyProng(1) + candidateDPlus->PyProng(2));
1000  Double_t pzPions = (candidateDPlus->PzProng(1) + candidateDPlus->PzProng(2)) * (candidateDPlus->PzProng(1) + candidateDPlus->PzProng(2));
1001  Double_t pSum = pxPions + pyPions + pzPions;
1002  Double_t invMassPions = TMath::Sqrt(eSum * eSum - pSum);
1003  Double_t invMassDelta = invMassDPlus - invMassPions;
1004  Double_t invMassDeltaDifference = TMath::Abs(deltaPDG - invMassDelta);
1005 
1006  Double_t pointingAngle = candidateDPlus->CosPointingAngle();
1007  Double_t dcaMother12 = candidateDPlus->GetDCA(0);
1008  Double_t dcaMother13 = candidateDPlus->GetDCA(1);
1009  Double_t dcaMother23 = candidateDPlus->GetDCA(2);
1010  Double_t ptMother = candidateDPlus->Pt();
1011  Double_t momentumMother = candidateDPlus->P();
1012  Double_t ptKaon = candidateSecondDaughter->Pt();
1013  Double_t ptFirstPion = candidateFirstDaughter->Pt();
1014  Double_t ptSecondPion = candidateThirdDaughter->Pt();
1015 
1016  AliExternalTrackParam motherTrack;
1017  motherTrack.CopyFromVTrack(candidateDPlus);
1018  Double_t d0z0[2], covd0z0[3], d0[2];
1019  motherTrack.PropagateToDCA(primaryVertex, bz, 100., d0z0, covd0z0);
1020  d0[0] = d0z0[0];
1021  Double_t d0Mother = TMath::Abs(d0[0]);
1022  Double_t d0firstTrack = TMath::Abs(candidateDPlus->Getd0Prong(0));
1023  Double_t d0secondTrack = TMath::Abs(candidateDPlus->Getd0Prong(1));
1024  Double_t d0thirdTrack = TMath::Abs(candidateDPlus->Getd0Prong(2));
1025 
1026  Double_t impactProduct123 = candidateDPlus->Getd0Prong(0) * candidateDPlus->Getd0Prong(1) * candidateDPlus->Getd0Prong(2);
1027  Double_t impactProduct12 = candidateDPlus->Getd0Prong(0) * candidateDPlus->Getd0Prong(1);
1028  Double_t impactProduct13 = candidateDPlus->Getd0Prong(0) * candidateDPlus->Getd0Prong(2);
1029  Double_t impactProduct23 = candidateDPlus->Getd0Prong(1) * candidateDPlus->Getd0Prong(2);
1030  Double_t impactProductXY = TMath::Abs(candidateDPlus->ImpParXY());
1031 
1032  Double_t angleMotherFirstDaughter = (candidateDPlus->Px() * candidateFirstDaughter->Px() + candidateDPlus->Py() * candidateFirstDaughter->Py() + candidateDPlus->Pz() * candidateFirstDaughter->Pz()) / (candidateDPlus->P() * candidateFirstDaughter->P());
1033  Double_t angleMotherSecondDaughter = (candidateDPlus->Px() * candidateSecondDaughter->Px() + candidateDPlus->Py() * candidateSecondDaughter->Py() + candidateDPlus->Pz() * candidateSecondDaughter->Pz()) / (candidateDPlus->P() * candidateSecondDaughter->P());
1034  Double_t angleMotherThirdDaughter = (candidateDPlus->Px() * candidateThirdDaughter->Px() + candidateDPlus->Py() * candidateThirdDaughter->Py() + candidateDPlus->Pz() * candidateThirdDaughter->Pz()) / (candidateDPlus->P() * candidateThirdDaughter->P());
1035 
1036  Double_t smallestAngleMotherDaughter = 0.0;
1037  Double_t largestAngleMotherDaughter = 0.0;
1038 
1039  if(angleMotherFirstDaughter > angleMotherSecondDaughter) {smallestAngleMotherDaughter = angleMotherSecondDaughter;} else {smallestAngleMotherDaughter = angleMotherFirstDaughter;}
1040  if(angleMotherThirdDaughter < smallestAngleMotherDaughter) smallestAngleMotherDaughter = angleMotherThirdDaughter;
1041  if(angleMotherFirstDaughter > angleMotherSecondDaughter) {largestAngleMotherDaughter = angleMotherFirstDaughter;} else {largestAngleMotherDaughter = angleMotherSecondDaughter;}
1042  if(angleMotherThirdDaughter > largestAngleMotherDaughter) largestAngleMotherDaughter = angleMotherThirdDaughter;
1043 
1044  Double_t vertexDistance = vertexDPlus->DistanceToVertex(primaryVertex);
1045  Double_t normDecayLength = candidateDPlus->NormalizedDecayLength();
1046  Double_t pdgMassMother = TDatabasePDG::Instance()->GetParticle(411)->Mass();
1047  Double_t pseudoProperDecayLength = ((vertexDPlus->GetX() - primaryVertex->GetX()) * candidateDPlus->Px() / TMath::Abs(candidateDPlus->Pt())) + ((vertexDPlus->GetY() - primaryVertex->GetY()) * candidateDPlus->Py() / TMath::Abs(candidateDPlus->Pt()));
1048  Double_t pseudoProperDecayTime = pseudoProperDecayLength * pdgMassMother / ptMother;
1049  Double_t decayTime = vertexDistance / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother / (momentumMother * momentumMother)) + 1)));
1050 
1051  Double_t phi = candidateDPlus->Phi();
1052  Double_t theta = candidateDPlus->Theta();
1053  Double_t covMatrix[21];
1054  candidateDPlus->GetCovarianceXYZPxPyPz(covMatrix);
1055 
1056  Double_t cp = TMath::Cos(phi);
1057  Double_t sp = TMath::Sin(phi);
1058  Double_t ct = TMath::Cos(theta);
1059  Double_t st = TMath::Sin(theta);
1060 
1061  Double_t errorMomentum = covMatrix[9] * cp * cp * ct * ct // GetCovPxPx
1062  + covMatrix[13] * 2.*cp * sp * ct * ct // GetCovPxPy
1063  + covMatrix[18] * 2.*cp * ct * st // GetCovPxPz
1064  + covMatrix[14] * sp * sp * ct * ct // GetCovPyPy
1065  + covMatrix[19] * 2.*sp * ct * st // GetCovPyPz
1066  + covMatrix[20] * st * st; // GetCovPzPz
1067  Double_t normalizedDecayTime = candidateDPlus->NormalizedDecayLength() / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother * errorMomentum * errorMomentum / (momentumMother * momentumMother)) + 1)));
1068 
1069  Double_t cosPointingAngleXY = candidateDPlus->CosPointingAngleXY();
1070  Double_t distanceXYToVertex = vertexDPlus->DistanceXYToVertex(primaryVertex);
1071  Double_t normalizedDecayLengthXY = candidateDPlus->NormalizedDecayLengthXY();
1072  Double_t chi2Vertex = vertexDPlus->GetChi2perNDF();
1073 
1074 
1075  Double_t Normalizedd0DPlusfirstdaughter = TMath::Abs(candidateDPlus->Getd0Prong(0) / candidateDPlus->Getd0errProng(0));
1076  Double_t Normalizedd0DPlusseconddaughter = TMath::Abs(candidateDPlus->Getd0Prong(1) / candidateDPlus->Getd0errProng(1));
1077  Double_t Normalizedd0DPlusthirddaughter = TMath::Abs(candidateDPlus->Getd0Prong(2) / candidateDPlus->Getd0errProng(2));
1078  Double_t Normalizedd0DPlus = TMath::Abs(candidateB0->Getd0Prong(1) / candidateB0->Getd0errProng(1));
1079  Double_t NormalizedimpactproductDPlus = (candidateDPlus->Getd0Prong(0) / candidateDPlus->Getd0errProng(0)) * (candidateDPlus->Getd0Prong(1) / candidateDPlus->Getd0errProng(1))* (candidateDPlus->Getd0Prong(2) / candidateDPlus->Getd0errProng(2));
1080 
1081  Double_t Dist12 = candidateDPlus->GetDist12toPrim();
1082  Double_t Dist23 = candidateDPlus->GetDist23toPrim();
1083  Double_t SigmaVertex = candidateDPlus->GetSigmaVert();
1084 
1085 
1086  // We apply the cuts
1087  Int_t nCutIndex = 0;
1088  Double_t cutVariableValue = 0.0;
1089 
1090  // "inv. mass width [GeV]" --------------------------------------------
1091  nCutIndex = 0;
1092  cutVariableValue = invMassDifference;
1093  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1094  //---------------------------------------------------------------------
1095 
1096  // "delta mass width [GeV]" -------------------------------------------
1097  nCutIndex = 1;
1098  cutVariableValue = invMassDeltaDifference;
1099  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1100  //---------------------------------------------------------------------
1101 
1102  // "pointing angle [Cos(theta)]" --------------------------------------
1103  nCutIndex = 2;
1104  cutVariableValue = pointingAngle;
1105  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1106  //---------------------------------------------------------------------
1107 
1108  // "pointing angle XY" ----------------------------------------------------
1109  nCutIndex = 3;
1110  cutVariableValue = cosPointingAngleXY;
1111  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1112  //---------------------------------------------------------------------
1113 
1114  // "dca12 [cm]" ---------------------------------------------------------
1115  nCutIndex = 4;
1116  cutVariableValue = dcaMother12;
1117  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1118  //---------------------------------------------------------------------
1119 
1120  // "dca13 [cm]" ---------------------------------------------------------
1121  nCutIndex = 5;
1122  cutVariableValue = dcaMother13;
1123  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1124  //---------------------------------------------------------------------
1125 
1126  // "dca23 [cm]" ---------------------------------------------------------
1127  nCutIndex = 6;
1128  cutVariableValue = dcaMother23;
1129  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1130  //---------------------------------------------------------------------
1131 
1132  // "Pt DPlus [GeV/c]" ----------------------------------------------------
1133  nCutIndex = 7;
1134  cutVariableValue = ptMother;
1135  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1136  //---------------------------------------------------------------------
1137 
1138  // "Pt Kaon [GeV/c]" -------------------------------------------------
1139  nCutIndex = 8;
1140  cutVariableValue = ptKaon;
1141  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1142  //---------------------------------------------------------------------
1143 
1144  // "Pt First Pion [GeV/c]" --------------------------------------------------
1145  nCutIndex = 9;
1146  cutVariableValue = ptFirstPion;
1147  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1148  //---------------------------------------------------------------------
1149 
1150  // "Pt Second Pion [GeV/c]" --------------------------------------------------
1151  nCutIndex = 10;
1152  cutVariableValue = ptSecondPion;
1153  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1154  //---------------------------------------------------------------------
1155 
1156  // "d0 DPlus [cm]" -------------------------------------------------------
1157  nCutIndex = 11;
1158  cutVariableValue = d0Mother;
1159  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1160  //---------------------------------------------------------------------
1161 
1162  // "d0 Kaon [cm]"-----------------------------------------------------
1163  nCutIndex = 12;
1164  cutVariableValue = d0firstTrack;
1165  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1166  //---------------------------------------------------------------------
1167 
1168  // "d0 First Pion [cm]" -----------------------------------------------------
1169  nCutIndex = 13;
1170  cutVariableValue = d0secondTrack;
1171  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1172  //---------------------------------------------------------------------
1173 
1174  // "d0 Second Pion [cm]" -----------------------------------------------------
1175  nCutIndex = 14;
1176  cutVariableValue = d0thirdTrack;
1177  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1178  //---------------------------------------------------------------------
1179 
1180  // "d0d0d0 [cm^3]" ------------------------------------------------------
1181  nCutIndex = 15;
1182  cutVariableValue = impactProduct123;
1183  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1184  //---------------------------------------------------------------------
1185 
1186  // "d0d0 [cm^2]" ------------------------------------------------------
1187  nCutIndex = 16;
1188  cutVariableValue = impactProduct12;
1189  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1190  //---------------------------------------------------------------------
1191 
1192  // "d0d0 [cm^2]" ------------------------------------------------------
1193  nCutIndex = 17;
1194  cutVariableValue = impactProduct13;
1195  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1196  //---------------------------------------------------------------------
1197 
1198  // "d0d0 [cm^2]" ------------------------------------------------------
1199  nCutIndex = 18;
1200  cutVariableValue = impactProduct23;
1201  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1202  //---------------------------------------------------------------------
1203 
1204  // "d0 XY [cm^2]" ---------------------------------------------------
1205  nCutIndex = 19;
1206  cutVariableValue = impactProductXY;
1207  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1208  //---------------------------------------------------------------------
1209 
1210  // "smallestAngleMotherDaughter" -------------------------------------
1211  nCutIndex = 20;
1212  cutVariableValue = smallestAngleMotherDaughter;
1213  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1214  //---------------------------------------------------------------------
1215 
1216  // "largestAngleMotherDaughter" ---------------------------------
1217  nCutIndex = 21;
1218  cutVariableValue = largestAngleMotherDaughter;
1219  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1220  //---------------------------------------------------------------------
1221 
1222  // "angle difference" --------------------------------
1223  nCutIndex = 22;
1224  cutVariableValue = largestAngleMotherDaughter - smallestAngleMotherDaughter;
1225  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1226  //---------------------------------------------------------------------
1227 
1228  // "vertexDistance" ---------------------------------------------------
1229  nCutIndex = 23;
1230  cutVariableValue = vertexDistance;
1231  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1232  //---------------------------------------------------------------------
1233 
1234  // "vertex distance XY" ----------------------------------------------------
1235  nCutIndex = 24;
1236  cutVariableValue = distanceXYToVertex;
1237  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1238  //---------------------------------------------------------------------
1239 
1240  // "pseudoProperDecayTime" --------------------------------------------
1241  nCutIndex = 25;
1242  cutVariableValue = pseudoProperDecayTime;
1243  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1244  //---------------------------------------------------------------------
1245 
1246  // "DecayTime" --------------------------------------------------------
1247  nCutIndex = 26;
1248  cutVariableValue = decayTime;
1249  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1250  //---------------------------------------------------------------------
1251 
1252  // "normalizedDecayTime" ----------------------------------------------------
1253  nCutIndex = 27;
1254  cutVariableValue = normalizedDecayTime;
1255  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1256  //---------------------------------------------------------------------
1257 
1258  // "normDecayLength" --------------------------------------------------
1259  nCutIndex = 28;
1260  cutVariableValue = normDecayLength;
1261  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1262  //---------------------------------------------------------------------
1263 
1264  // "normalized decay length XY" ----------------------------------------------------
1265  nCutIndex = 29;
1266  cutVariableValue = normalizedDecayLengthXY;
1267  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1268  //---------------------------------------------------------------------
1269 
1270  // "chi squared per NDF" ----------------------------------------------------
1271  nCutIndex = 30;
1272  cutVariableValue = chi2Vertex;
1273  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1274  //---------------------------------------------------------------------
1275 
1276  // "Normalizedd0DPlusfirstdaughter" ----------------------------------------------------
1277  nCutIndex = 31;
1278  cutVariableValue = Normalizedd0DPlusfirstdaughter;
1279  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1280  //---------------------------------------------------------------------
1281 
1282  // "Normalizedd0DPlusseconddaughter" ----------------------------------------------------
1283  nCutIndex = 32;
1284  cutVariableValue = Normalizedd0DPlusseconddaughter;
1285  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1286  //---------------------------------------------------------------------
1287 
1288  // "Normalizedd0DPlusthirddaughter" ----------------------------------------------------
1289  nCutIndex = 33;
1290  cutVariableValue = Normalizedd0DPlusthirddaughter;
1291  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1292  //---------------------------------------------------------------------
1293 
1294  // "Normalizedd0DPlus" ----------------------------------------------------
1295  nCutIndex = 34;
1296  cutVariableValue = Normalizedd0DPlus;
1297  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1298  //---------------------------------------------------------------------
1299 
1300  // "NormalizedimpactproductDPlus" ----------------------------------------------------
1301  nCutIndex = 35;
1302  cutVariableValue = NormalizedimpactproductDPlus;
1303  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1304  //---------------------------------------------------------------------
1305 
1306  // "Dist12" ----------------------------------------------------
1307  nCutIndex = 36;
1308  cutVariableValue = Dist12;
1309  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1310  //---------------------------------------------------------------------
1311 
1312  // "Dist23" ----------------------------------------------------
1313  nCutIndex = 37;
1314  cutVariableValue = Dist23;
1315  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1316  //---------------------------------------------------------------------
1317 
1318  // "Sigma vertex" ----------------------------------------------------
1319  nCutIndex = 38;
1320  cutVariableValue = SigmaVertex;
1321  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1322  //---------------------------------------------------------------------
1323 
1324 
1325  AliAODRecoDecay* candidateDPlustoB0 = (AliAODRecoDecay*)candidateDPlus;
1326  AliExternalTrackParam firstDaughterDPlusTrack;
1327  AliExternalTrackParam secondDaughterDPlusTrack;
1328  AliExternalTrackParam thirdDaughterDPlusTrack;
1329 
1330  Double_t d0z0DSVert[2], covd0z0DSVert[3], d0DSVert[3];
1331 
1332  firstDaughterDPlusTrack.CopyFromVTrack(candidateFirstDaughter);
1333  firstDaughterDPlusTrack.PropagateToDCA(vertexB0, bz, 100., d0z0DSVert, covd0z0DSVert);
1334  d0DSVert[0] = d0z0DSVert[0];
1335 
1336  secondDaughterDPlusTrack.CopyFromVTrack(candidateSecondDaughter);
1337  secondDaughterDPlusTrack.PropagateToDCA(vertexB0, bz, 100., d0z0DSVert, covd0z0DSVert);
1338  d0DSVert[1] = d0z0DSVert[0];
1339 
1340  thirdDaughterDPlusTrack.CopyFromVTrack(candidateThirdDaughter);
1341  thirdDaughterDPlusTrack.PropagateToDCA(vertexB0, bz, 100., d0z0DSVert, covd0z0DSVert);
1342  d0DSVert[2] = d0z0DSVert[0];
1343 
1344  AliExternalTrackParam DPlusTrack;
1345  DPlusTrack.CopyFromVTrack(candidateDPlus);
1346  Double_t d0z0D0DSVert[2], covd0z0D0DSVert[3], d0d0DSVert;
1347  motherTrack.PropagateToDCA(vertexB0, bz, 100., d0z0D0DSVert, covd0z0D0DSVert);
1348  d0d0DSVert = TMath::Abs(d0z0D0DSVert[0]);
1349 
1350  Double_t impactProductToB0 = d0DSVert[0] * d0DSVert[1] * d0DSVert[2];
1351  Double_t impactProductXYToB0 = candidateDPlustoB0->ImpParXY(vertexB0);
1352 
1353  Double_t pointingAngleToB0 = candidateDPlustoB0->CosPointingAngle(vertexB0);
1354  Double_t d0FirstDaughterToB0 = TMath::Abs(d0DSVert[0]);
1355  Double_t d0SecondDaughterToB0 = TMath::Abs(d0DSVert[1]);
1356  Double_t d0ThirdDaughterToB0 = TMath::Abs(d0DSVert[2]);
1357  Double_t normDecayLengthToB0 = candidateDPlustoB0->NormalizedDecayLength(vertexB0);
1358 
1359  Double_t pseudoProperDecayLengthDSVert = ((vertexDPlus->GetX() - vertexB0->GetX()) * candidateDPlus->Px() / TMath::Abs(candidateDPlus->Pt())) + ((vertexDPlus->GetY() - vertexB0->GetY()) * candidateDPlus->Py() / TMath::Abs(candidateDPlus->Pt()));
1360  Double_t pseudoProperDecayTimeToB0 = pseudoProperDecayLengthDSVert * pdgMassMother / ptMother;
1361  Double_t DecayTimeToB0 = vertexDistance / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother / (momentumMother * momentumMother)) + 1)));
1362 
1363  Double_t phiDSVert = candidateDPlus->Phi();
1364  Double_t thetaDSVert = candidateDPlus->Theta();
1365  Double_t covMatrixDSVert[21];
1366  candidateDPlus->GetCovarianceXYZPxPyPz(covMatrixDSVert);
1367 
1368  cp = TMath::Cos(phiDSVert);
1369  sp = TMath::Sin(phiDSVert);
1370  ct = TMath::Cos(thetaDSVert);
1371  st = TMath::Sin(thetaDSVert);
1372 
1373  errorMomentum = covMatrix[9] * cp * cp * ct * ct // GetCovPxPx
1374  + covMatrix[13] * 2.*cp * sp * ct * ct // GetCovPxPy
1375  + covMatrix[18] * 2.*cp * ct * st // GetCovPxPz
1376  + covMatrix[14] * sp * sp * ct * ct // GetCovPyPy
1377  + covMatrix[19] * 2.*sp * ct * st // GetCovPyPz
1378  + covMatrix[20] * st * st; // GetCovPzPz
1379  Double_t normalizedDecayTimeToB0 = candidateDPlustoB0->NormalizedDecayLength(vertexB0) / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother * errorMomentum * errorMomentum / (momentumMother * momentumMother)) + 1)));
1380 
1381  // "pointingAngleToB0" ---------------------------------------------
1382  nCutIndex = 39;
1383  cutVariableValue = pointingAngleToB0;
1384  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1385  //---------------------------------------------------------------------
1386 
1387  // "d0MotherToB0" --------------------------------------------------
1388  nCutIndex = 40;
1389  cutVariableValue = d0d0DSVert;
1390  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1391  //---------------------------------------------------------------------
1392 
1393  // "d0FirstDaughterToB0" -------------------------------------------
1394  nCutIndex = 41;
1395  cutVariableValue = d0FirstDaughterToB0;
1396  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1397  //---------------------------------------------------------------------
1398 
1399  // "d0SecondDaughterToB0" ------------------------------------------
1400  nCutIndex = 42;
1401  cutVariableValue = d0SecondDaughterToB0;
1402  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1403  //---------------------------------------------------------------------
1404 
1405  // "d0ThirdDaughterToB0" ------------------------------------------
1406  nCutIndex = 43;
1407  cutVariableValue = d0ThirdDaughterToB0;
1408  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1409  //---------------------------------------------------------------------
1410 
1411  // "impactProductToB0" ---------------------------------------------
1412  nCutIndex = 44;
1413  cutVariableValue = impactProductToB0;
1414  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1415  //---------------------------------------------------------------------
1416 
1417  // "impactProductXYToB0" -------------------------------------------
1418  nCutIndex = 45;
1419  cutVariableValue = impactProductXYToB0;
1420  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1421  //---------------------------------------------------------------------
1422 
1423  // "normDecayLengthToB0" -------------------------------------------
1424  nCutIndex = 46;
1425  cutVariableValue = normDecayLengthToB0;
1426  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1427  //---------------------------------------------------------------------
1428 
1429  // "pseudoProperDecayTimeToB0" -------------------------------------
1430  nCutIndex = 47;
1431  cutVariableValue = pseudoProperDecayTimeToB0;
1432  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1433  //---------------------------------------------------------------------
1434 
1435  // "DecayTimeToB0" -------------------------------------------------
1436  nCutIndex = 48;
1437  cutVariableValue = DecayTimeToB0;
1438  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1439  //---------------------------------------------------------------------
1440 
1441  // "normalizedDecayTimeToB0" ---------------------------------------------
1442  nCutIndex = 49;
1443  cutVariableValue = normalizedDecayTimeToB0;
1444  bPassedCut = ApplyCutOnVariable(nCutIndex, ptbin, cutVariableValue, bCutArray);
1445  //---------------------------------------------------------------------
1446  }
1447 
1448  if (bPassedCut == kFALSE)
1449  {
1450  returnvalue = 0;
1451  } else
1452  for (Int_t i = 0; i < 50; ++i)
1453  {
1454  if (bCutArray[i] == kTRUE) {
1455  returnvalue = 0;
1456  break;
1457  }
1458  }
1459 
1460  return returnvalue;
1461 }
1462 //----------------------------------------------------------------------------------
1464 //
1465  // Apply selection on DPlus candidate.
1466  //
1467 
1469  cout << "Cut matrice not inizialized. Exit..." << endl;
1470  return 0;
1471  }
1472 
1473  AliAODRecoDecayHF3Prong* candidateDPlus = (AliAODRecoDecayHF3Prong*)obj;
1474  if (!candidateDPlus) {
1475  cout << "candidateDPlus null" << endl;
1476  return 0;
1477  }
1478 
1479  AliAODTrack *candidateFirstDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(0);
1480  if (!candidateFirstDaughter) {
1481  std::cout << "candidatePion null" << std::endl;
1482  return 0;
1483  }
1484 
1485  AliAODTrack *candidateSecondDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(1);
1486  if (!candidateSecondDaughter) {
1487  std::cout << "candidateKaon null" << std::endl;
1488  return 0;
1489  }
1490 
1491  AliAODTrack *candidateThirdDaughter = (AliAODTrack*)candidateDPlus->GetDaughter(2);
1492  if (!candidateSecondDaughter) {
1493  std::cout << "candidatePion null" << std::endl;
1494  return 0;
1495  }
1496 
1497  AliAODVertex * vertexDPlus = candidateDPlus->GetSecondaryVtx();
1498  if (!vertexDPlus) {
1499  std::cout << "vertexDPlus null" << std::endl;
1500  return 0;
1501  }
1502 
1503  AliAODVertex * primaryVertex = aod->GetPrimaryVertex();
1504  if (!primaryVertex) {
1505  std::cout << "primaryVertex null" << std::endl;
1506  return 0;
1507  }
1508  Int_t returnvalue = 1;
1509  Bool_t bPassedCut = kFALSE;
1510 
1511  //get the magnetic field
1512  Double_t bz = (Double_t)aod->GetMagneticField();
1513 
1514 
1515  // selection on candidate
1516  if (selectionLevel == AliRDHFCuts::kAll ||
1517  selectionLevel == AliRDHFCuts::kCandidate) {
1518 
1519  Int_t ptbin = PtBinDPlusforDPlusptbin(candidateDPlus->Pt());
1520  if (ptbin == -1) return -1;
1521 
1522  // DPlusmass
1523  Double_t mDPlusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
1524  Double_t mPionPDG = TDatabasePDG::Instance()->GetParticle(211)->Mass();
1525 
1526  // DPlus window - invariant mass
1527  UInt_t prongs[3];
1528  prongs[0] = 211;
1529  prongs[1] = 321;
1530  prongs[2] = 211;
1531 
1532  // delta mass PDG
1533  Double_t deltaPDG = mDPlusPDG - 2 * mPionPDG;
1534 
1535  Double_t invMassDPlus = candidateDPlus->InvMass(3, prongs);
1536  Double_t invMassDifference = TMath::Abs(mDPlusPDG - invMassDPlus);
1537  Double_t eKaon1 = candidateDPlus->EProng(1, 321);
1538  Double_t ePion2 = candidateDPlus->EProng(2, 211);
1539  Double_t eSum = eKaon1 + ePion2;
1540  Double_t pxPions = (candidateDPlus->PxProng(1) + candidateDPlus->PxProng(2)) * (candidateDPlus->PxProng(1) + candidateDPlus->PxProng(2));
1541  Double_t pyPions = (candidateDPlus->PyProng(1) + candidateDPlus->PyProng(2)) * (candidateDPlus->PyProng(1) + candidateDPlus->PyProng(2));
1542  Double_t pzPions = (candidateDPlus->PzProng(1) + candidateDPlus->PzProng(2)) * (candidateDPlus->PzProng(1) + candidateDPlus->PzProng(2));
1543  Double_t pSum = pxPions + pyPions + pzPions;
1544  Double_t invMassPions = TMath::Sqrt(eSum * eSum - pSum);
1545  Double_t invMassDelta = invMassDPlus - invMassPions;
1546  Double_t invMassDeltaDifference = TMath::Abs(deltaPDG - invMassDelta);
1547 
1548  Double_t pointingAngle = candidateDPlus->CosPointingAngle();
1549  Double_t dcaMother12 = candidateDPlus->GetDCA(0);
1550  Double_t dcaMother13 = candidateDPlus->GetDCA(1);
1551  Double_t dcaMother23 = candidateDPlus->GetDCA(2);
1552  Double_t ptMother = candidateDPlus->Pt();
1553  Double_t momentumMother = candidateDPlus->P();
1554  Double_t ptKaon = candidateSecondDaughter->Pt();
1555  Double_t ptFirstPion = candidateFirstDaughter->Pt();
1556  Double_t ptSecondPion = candidateThirdDaughter->Pt();
1557 
1558  AliExternalTrackParam motherTrack;
1559  motherTrack.CopyFromVTrack(candidateDPlus);
1560  Double_t d0z0[2], covd0z0[3], d0[2];
1561  motherTrack.PropagateToDCA(primaryVertex, bz, 100., d0z0, covd0z0);
1562  d0[0] = d0z0[0];
1563  Double_t d0Mother = TMath::Abs(d0[0]);
1564  Double_t d0firstTrack = TMath::Abs(candidateDPlus->Getd0Prong(0));
1565  Double_t d0secondTrack = TMath::Abs(candidateDPlus->Getd0Prong(1));
1566  Double_t d0thirdTrack = TMath::Abs(candidateDPlus->Getd0Prong(2));
1567 
1568  Double_t impactProduct123 = candidateDPlus->Getd0Prong(0) * candidateDPlus->Getd0Prong(1) * candidateDPlus->Getd0Prong(2);
1569  Double_t impactProduct12 = candidateDPlus->Getd0Prong(0) * candidateDPlus->Getd0Prong(1);
1570  Double_t impactProduct13 = candidateDPlus->Getd0Prong(0) * candidateDPlus->Getd0Prong(2);
1571  Double_t impactProduct23 = candidateDPlus->Getd0Prong(1) * candidateDPlus->Getd0Prong(2);
1572  Double_t impactProductXY = TMath::Abs(candidateDPlus->ImpParXY());
1573 
1574  Double_t angleMotherFirstDaughter = (candidateDPlus->Px() * candidateFirstDaughter->Px() + candidateDPlus->Py() * candidateFirstDaughter->Py() + candidateDPlus->Pz() * candidateFirstDaughter->Pz()) / (candidateDPlus->P() * candidateFirstDaughter->P());
1575  Double_t angleMotherSecondDaughter = (candidateDPlus->Px() * candidateSecondDaughter->Px() + candidateDPlus->Py() * candidateSecondDaughter->Py() + candidateDPlus->Pz() * candidateSecondDaughter->Pz()) / (candidateDPlus->P() * candidateSecondDaughter->P());
1576  Double_t angleMotherThirdDaughter = (candidateDPlus->Px() * candidateThirdDaughter->Px() + candidateDPlus->Py() * candidateThirdDaughter->Py() + candidateDPlus->Pz() * candidateThirdDaughter->Pz()) / (candidateDPlus->P() * candidateThirdDaughter->P());
1577 
1578  Double_t smallestAngleMotherDaughter = 0.0;
1579  Double_t largestAngleMotherDaughter = 0.0;
1580 
1581  if(angleMotherFirstDaughter > angleMotherSecondDaughter) {smallestAngleMotherDaughter = angleMotherSecondDaughter;} else {smallestAngleMotherDaughter = angleMotherFirstDaughter;}
1582  if(angleMotherThirdDaughter < smallestAngleMotherDaughter) smallestAngleMotherDaughter = angleMotherThirdDaughter;
1583  if(angleMotherFirstDaughter > angleMotherSecondDaughter) {largestAngleMotherDaughter = angleMotherFirstDaughter;} else {largestAngleMotherDaughter = angleMotherSecondDaughter;}
1584  if(angleMotherThirdDaughter > largestAngleMotherDaughter) largestAngleMotherDaughter = angleMotherThirdDaughter;
1585 
1586  Double_t vertexDistance = vertexDPlus->DistanceToVertex(primaryVertex);
1587  Double_t normDecayLength = candidateDPlus->NormalizedDecayLength();
1588  Double_t pdgMassMother = TDatabasePDG::Instance()->GetParticle(411)->Mass();
1589  Double_t pseudoProperDecayLength = ((vertexDPlus->GetX() - primaryVertex->GetX()) * candidateDPlus->Px() / TMath::Abs(candidateDPlus->Pt())) + ((vertexDPlus->GetY() - primaryVertex->GetY()) * candidateDPlus->Py() / TMath::Abs(candidateDPlus->Pt()));
1590  Double_t pseudoProperDecayTime = pseudoProperDecayLength * pdgMassMother / ptMother;
1591  Double_t decayTime = vertexDistance / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother / (momentumMother * momentumMother)) + 1)));
1592 
1593  Double_t phi = candidateDPlus->Phi();
1594  Double_t theta = candidateDPlus->Theta();
1595  Double_t covMatrix[21];
1596  candidateDPlus->GetCovarianceXYZPxPyPz(covMatrix);
1597 
1598  Double_t cp = TMath::Cos(phi);
1599  Double_t sp = TMath::Sin(phi);
1600  Double_t ct = TMath::Cos(theta);
1601  Double_t st = TMath::Sin(theta);
1602 
1603  Double_t errorMomentum = covMatrix[9] * cp * cp * ct * ct // GetCovPxPx
1604  + covMatrix[13] * 2.*cp * sp * ct * ct // GetCovPxPy
1605  + covMatrix[18] * 2.*cp * ct * st // GetCovPxPz
1606  + covMatrix[14] * sp * sp * ct * ct // GetCovPyPy
1607  + covMatrix[19] * 2.*sp * ct * st // GetCovPyPz
1608  + covMatrix[20] * st * st; // GetCovPzPz
1609  Double_t normalizedDecayTime = candidateDPlus->NormalizedDecayLength() / (299792458 * TMath::Sqrt(1 / ((pdgMassMother * pdgMassMother * errorMomentum * errorMomentum / (momentumMother * momentumMother)) + 1)));
1610 
1611  Double_t cosPointingAngleXY = candidateDPlus->CosPointingAngleXY();
1612  Double_t distanceXYToVertex = vertexDPlus->DistanceXYToVertex(primaryVertex);
1613  Double_t normalizedDecayLengthXY = candidateDPlus->NormalizedDecayLengthXY();
1614  Double_t chi2Vertex = vertexDPlus->GetChi2perNDF();
1615 
1616 
1617  Double_t Normalizedd0DPlusfirstdaughter = TMath::Abs(candidateDPlus->Getd0Prong(0) / candidateDPlus->Getd0errProng(0));
1618  Double_t Normalizedd0DPlusseconddaughter = TMath::Abs(candidateDPlus->Getd0Prong(1) / candidateDPlus->Getd0errProng(1));
1619  Double_t Normalizedd0DPlusthirddaughter = TMath::Abs(candidateDPlus->Getd0Prong(2) / candidateDPlus->Getd0errProng(2));
1620  Double_t Normalizedd0DPlus = TMath::Abs(candidateDPlus->Getd0Prong(1) / candidateDPlus->Getd0errProng(1));
1621  Double_t NormalizedimpactproductDPlus = (candidateDPlus->Getd0Prong(0) / candidateDPlus->Getd0errProng(0)) * (candidateDPlus->Getd0Prong(1) / candidateDPlus->Getd0errProng(1))* (candidateDPlus->Getd0Prong(2) / candidateDPlus->Getd0errProng(2));
1622 
1623  Double_t Dist12 = candidateDPlus->GetDist12toPrim();
1624  Double_t Dist23 = candidateDPlus->GetDist23toPrim();
1625  Double_t SigmaVertex = candidateDPlus->GetSigmaVert();
1626 
1627 
1628  // We apply the cuts
1629  Int_t nCutIndex = 0;
1630  Double_t cutVariableValue = 0.0;
1631 
1632  // "inv. mass width [GeV]" --------------------------------------------
1633  nCutIndex = 0;
1634  cutVariableValue = invMassDifference;
1635  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1636  //---------------------------------------------------------------------
1637 
1638  // "delta mass width [GeV]" -------------------------------------------
1639  nCutIndex = 1;
1640  cutVariableValue = invMassDeltaDifference;
1641  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1642  //---------------------------------------------------------------------
1643 
1644  // "pointing angle [Cos(theta)]" --------------------------------------
1645  nCutIndex = 2;
1646  cutVariableValue = pointingAngle;
1647  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1648  //---------------------------------------------------------------------
1649 
1650  // "pointing angle XY" ----------------------------------------------------
1651  nCutIndex = 3;
1652  cutVariableValue = cosPointingAngleXY;
1653  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1654  //---------------------------------------------------------------------
1655 
1656  // "dca12 [cm]" ---------------------------------------------------------
1657  nCutIndex = 4;
1658  cutVariableValue = dcaMother12;
1659  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1660  //---------------------------------------------------------------------
1661 
1662  // "dca13 [cm]" ---------------------------------------------------------
1663  nCutIndex = 5;
1664  cutVariableValue = dcaMother13;
1665  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1666  //---------------------------------------------------------------------
1667 
1668  // "dca23 [cm]" ---------------------------------------------------------
1669  nCutIndex = 6;
1670  cutVariableValue = dcaMother23;
1671  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1672  //---------------------------------------------------------------------
1673 
1674  // "Pt DPlus [GeV/c]" ----------------------------------------------------
1675  nCutIndex = 7;
1676  cutVariableValue = ptMother;
1677  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1678  //---------------------------------------------------------------------
1679 
1680  // "Pt Kaon [GeV/c]" -------------------------------------------------
1681  nCutIndex = 8;
1682  cutVariableValue = ptKaon;
1683  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1684  //---------------------------------------------------------------------
1685 
1686  // "Pt First Pion [GeV/c]" --------------------------------------------------
1687  nCutIndex = 9;
1688  cutVariableValue = ptFirstPion;
1689  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1690  //---------------------------------------------------------------------
1691 
1692  // "Pt Second Pion [GeV/c]" --------------------------------------------------
1693  nCutIndex = 10;
1694  cutVariableValue = ptSecondPion;
1695  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1696  //---------------------------------------------------------------------
1697 
1698  // "d0 DPlus [cm]" -------------------------------------------------------
1699  nCutIndex = 11;
1700  cutVariableValue = d0Mother;
1701  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1702  //---------------------------------------------------------------------
1703 
1704  // "d0 Kaon [cm]"-----------------------------------------------------
1705  nCutIndex = 12;
1706  cutVariableValue = d0firstTrack;
1707  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1708  //---------------------------------------------------------------------
1709 
1710  // "d0 First Pion [cm]" -----------------------------------------------------
1711  nCutIndex = 13;
1712  cutVariableValue = d0secondTrack;
1713  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1714  //---------------------------------------------------------------------
1715 
1716  // "d0 Second Pion [cm]" -----------------------------------------------------
1717  nCutIndex = 14;
1718  cutVariableValue = d0thirdTrack;
1719  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1720  //---------------------------------------------------------------------
1721 
1722  // "d0d0d0 [cm^3]" ------------------------------------------------------
1723  nCutIndex = 15;
1724  cutVariableValue = impactProduct123;
1725  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1726  //---------------------------------------------------------------------
1727 
1728  // "d0d0 [cm^2]" ------------------------------------------------------
1729  nCutIndex = 16;
1730  cutVariableValue = impactProduct12;
1731  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1732  //---------------------------------------------------------------------
1733 
1734  // "d0d0 [cm^2]" ------------------------------------------------------
1735  nCutIndex = 17;
1736  cutVariableValue = impactProduct13;
1737  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1738  //---------------------------------------------------------------------
1739 
1740  // "d0d0 [cm^2]" ------------------------------------------------------
1741  nCutIndex = 18;
1742  cutVariableValue = impactProduct23;
1743  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1744  //---------------------------------------------------------------------
1745 
1746  // "d0 XY [cm^2]" ---------------------------------------------------
1747  nCutIndex = 19;
1748  cutVariableValue = impactProductXY;
1749  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1750  //---------------------------------------------------------------------
1751 
1752  // "smallestAngleMotherDaughter" -------------------------------------
1753  nCutIndex = 20;
1754  cutVariableValue = smallestAngleMotherDaughter;
1755  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1756  //---------------------------------------------------------------------
1757 
1758  // "largestAngleMotherDaughter" ---------------------------------
1759  nCutIndex = 21;
1760  cutVariableValue = largestAngleMotherDaughter;
1761  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1762  //---------------------------------------------------------------------
1763 
1764  // "angle difference" --------------------------------
1765  nCutIndex = 22;
1766  cutVariableValue = largestAngleMotherDaughter - smallestAngleMotherDaughter;
1767  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1768  //---------------------------------------------------------------------
1769 
1770  // "vertexDistance" ---------------------------------------------------
1771  nCutIndex = 23;
1772  cutVariableValue = vertexDistance;
1773  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1774  //---------------------------------------------------------------------
1775 
1776  // "vertex distance XY" ----------------------------------------------------
1777  nCutIndex = 24;
1778  cutVariableValue = distanceXYToVertex;
1779  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1780  //---------------------------------------------------------------------
1781 
1782  // "pseudoProperDecayTime" --------------------------------------------
1783  nCutIndex = 25;
1784  cutVariableValue = pseudoProperDecayTime;
1785  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1786  //---------------------------------------------------------------------
1787 
1788  // "DecayTime" --------------------------------------------------------
1789  nCutIndex = 26;
1790  cutVariableValue = decayTime;
1791  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1792  //---------------------------------------------------------------------
1793 
1794  // "normalizedDecayTime" ----------------------------------------------------
1795  nCutIndex = 27;
1796  cutVariableValue = normalizedDecayTime;
1797  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1798  //---------------------------------------------------------------------
1799 
1800  // "normDecayLength" --------------------------------------------------
1801  nCutIndex = 28;
1802  cutVariableValue = normDecayLength;
1803  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1804  //---------------------------------------------------------------------
1805 
1806  // "normalized decay length XY" ----------------------------------------------------
1807  nCutIndex = 29;
1808  cutVariableValue = normalizedDecayLengthXY;
1809  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1810  //---------------------------------------------------------------------
1811 
1812  // "chi squared per NDF" ----------------------------------------------------
1813  nCutIndex = 30;
1814  cutVariableValue = chi2Vertex;
1815  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1816  //---------------------------------------------------------------------
1817 
1818  // "Normalizedd0DPlusfirstdaughter" ----------------------------------------------------
1819  nCutIndex = 31;
1820  cutVariableValue = Normalizedd0DPlusfirstdaughter;
1821  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1822  //---------------------------------------------------------------------
1823 
1824  // "Normalizedd0DPlusseconddaughter" ----------------------------------------------------
1825  nCutIndex = 32;
1826  cutVariableValue = Normalizedd0DPlusseconddaughter;
1827  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1828  //---------------------------------------------------------------------
1829 
1830  // "Normalizedd0DPlusthirddaughter" ----------------------------------------------------
1831  nCutIndex = 33;
1832  cutVariableValue = Normalizedd0DPlusthirddaughter;
1833  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1834  //---------------------------------------------------------------------
1835 
1836  // "Normalizedd0DPlus" ----------------------------------------------------
1837  nCutIndex = 34;
1838  cutVariableValue = Normalizedd0DPlus;
1839  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1840  //---------------------------------------------------------------------
1841 
1842  // "NormalizedimpactproductDPlus" ----------------------------------------------------
1843  nCutIndex = 35;
1844  cutVariableValue = NormalizedimpactproductDPlus;
1845  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1846  //---------------------------------------------------------------------
1847 
1848  // "Dist12" ----------------------------------------------------
1849  nCutIndex = 36;
1850  cutVariableValue = Dist12;
1851  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1852  //---------------------------------------------------------------------
1853 
1854  // "Dist23" ----------------------------------------------------
1855  nCutIndex = 37;
1856  cutVariableValue = Dist23;
1857  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1858  //---------------------------------------------------------------------
1859 
1860  // "Sigma vertex" ----------------------------------------------------
1861  nCutIndex = 38;
1862  cutVariableValue = SigmaVertex;
1863  bPassedCut = ApplyCutOnVariableDPlusforDPlusptbin(nCutIndex, ptbin, cutVariableValue, bCutArray);
1864  //---------------------------------------------------------------------
1865 
1866  }
1867 
1868  if (bPassedCut == kFALSE)
1869  {
1870  returnvalue = 0;
1871  } else
1872  for (Int_t i = 0; i < 39; ++i)
1873  {
1874  if (bCutArray[i] == kTRUE) {
1875  returnvalue = 0;
1876  break;
1877  }
1878  }
1879 
1880  return returnvalue;
1881 }
1882 //--------------------------------------------------------------------------
1884 {
1885  //
1886  // Chould be improved (for example pT dependence)
1887  //
1888 
1889  if (y > GetFiducialYCut()) return kFALSE;
1890 
1891  return kTRUE;
1892 }
1893 //_______________________________________________________________________________-
1895 {
1896  //
1897  // PID method, n sigma approach default // not used for B0, done seperately for each daughter
1898  //
1899 
1900  // AliAODRecoDecayHF2Prong* dstar = (AliAODRecoDecayHF2Prong*)obj;
1901  // if(!dstar){
1902  // cout<<"AliAODRecoDecayHF2Prong null"<<endl;
1903  // return 0;
1904  // }
1905 
1906  // if(!fUsePID || dstar->Pt() > fMaxPtPid) return 3;
1907 
1908  // AliAODRecoDecayHF2Prong* dPlus = (AliAODRecoDecayHF2Prong*)dstar->Get2Prong();
1909  // if(!dPlus){
1910  // cout<<"AliAODRecoDecayHF2Prong null"<<endl;
1911  // return 0;
1912  // }
1913 
1914  // // here the PID
1915  // AliAODTrack *pos = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(0);
1916  // AliAODTrack *neg = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(1);
1917 
1918  // if (dstar->Charge()>0){
1919  // if(!SelectPID(pos,2)) return 0;//pion+
1920  // if(!SelectPID(neg,3)) return 0;//kaon-
1921  // }else{
1922  // if(!SelectPID(pos,3)) return 0;//kaon+
1923  // if(!SelectPID(neg,2)) return 0;//pion-
1924  // }
1925 
1926  // if ((fPidHF->GetMatch() == 10 || fPidHF->GetMatch() == 11) && fPidHF->GetITS()) { //ITS n sigma band
1927  // AliAODTrack *softPion = (AliAODTrack*) dstar->GetBachelor();
1928 
1929  // if (fPidHF->CheckBands(AliPID::kPion, AliPIDResponse::kITS, softPion) == -1) {
1930  // return 0;
1931  // }
1932  // }
1933 
1934  return 3;
1935 }
1936 //_______________________________________________________________________________-
1937 Int_t AliRDHFCutsB0toDPi::SelectPID(AliAODTrack *track, Int_t type)
1938 {
1939  //
1940  // here the PID
1941 
1942  Bool_t isParticle = kTRUE;
1943  if (!fUsePID) return isParticle;
1944  Int_t match = fPidHF->GetMatch();
1945 
1946  if (match == 1) { //n-sigma
1947  Bool_t TPCon = TMath::Abs(2) > 1e-4 ? kTRUE : kFALSE;
1948  Bool_t TOFon = TMath::Abs(3) > 1e-4 ? kTRUE : kFALSE;
1949 
1950  Bool_t isTPC = kTRUE;
1951  Bool_t isTOF = kTRUE;
1952 
1953  if (TPCon) { //TPC
1954  if (fPidHF->CheckStatus(track, "TPC")) {
1955  if (type == 2) isTPC = fPidHF->IsPionRaw(track, "TPC");
1956  if (type == 3) isTPC = fPidHF->IsKaonRaw(track, "TPC");
1957  }
1958  }
1959  if (TOFon) { //TOF
1960  if (fPidHF->CheckStatus(track, "TOF")) {
1961  if (type == 2) isTOF = fPidHF->IsPionRaw(track, "TOF");
1962  if (type == 3) isTOF = fPidHF->IsKaonRaw(track, "TOF");
1963  }
1964  }
1965 
1966  //--------------------------------
1967  // cut on high momentum in the TPC
1968  //--------------------------------
1969  Double_t pPIDcut = track->P();
1970  if (pPIDcut > fTPCflag) isTPC = 1;
1971 
1972  isParticle = isTPC && isTOF;
1973  }
1974 
1975  if (match == 2) { //bayesian
1976  //Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
1977  Double_t prob[5] = {1., 1., 1., 1., 1.};
1978 
1979  //fPidHF->SetPriors(priors,5);
1980  // fPidHF->BayesianProbability(track,prob);
1981 
1982  Double_t max = 0.;
1983  Int_t k = -1;
1984  for (Int_t i = 0; i < 5; i++) {
1985  if (prob[i] > max) {k = i; max = prob[i];}
1986  }
1987  isParticle = Bool_t(k == type);
1988  }
1989 
1990  if (match == 10 || match == 11) { //Assymetric PID using histograms
1991  Int_t checkTPC = fPidHF->CheckBands((AliPID::EParticleType) type, AliPIDResponse::kTPC, track);
1992  Int_t checkTOF = fPidHF->CheckBands((AliPID::EParticleType) type, AliPIDResponse::kTOF, track);
1993 
1994  isParticle = checkTPC >= 0 && checkTOF >= 0 ? kTRUE : kFALSE; //Standard: both at least compatible
1995  if (match == 11) { //Extra requirement: at least one identified
1996  isParticle = isParticle && checkTPC + checkTOF >= 1 ? kTRUE : kFALSE;
1997  }
1998  }
1999 
2000  if (match == 12) { //Circular cut
2001  Double_t nSigmaTOF = 0;
2002  Double_t nSigmaTPC = 0;
2003 
2004  Double_t radius = fCircRadius;
2005 
2006  isParticle = kTRUE;
2007  if (radius > 0) {
2008  Int_t TPCok = fPidHF->GetnSigmaTPC(track, type, nSigmaTPC);
2009  Int_t TOFok = fPidHF->GetnSigmaTOF(track, type, nSigmaTOF);
2010  if (TPCok != -1 && TOFok != -1) {
2011  //Both detectors gave PID information
2012  isParticle = TMath::Sqrt(nSigmaTPC * nSigmaTPC + nSigmaTOF * nSigmaTOF) <= radius ? kTRUE : kFALSE;
2013  }
2014  else {
2015  //Maximum one detector gave PID information
2016  if (TPCok != -1) {
2017  isParticle = nSigmaTPC <= radius ? kTRUE : kFALSE;
2018  }
2019  if (TOFok != -1) {
2020  isParticle = nSigmaTOF <= radius ? kTRUE : kFALSE;
2021  }
2022  }
2023  }
2024  }
2025 
2026  return isParticle;
2027 
2028 }
2029 //-------------------------------------------------------------------------------------
2031 {
2035 
2036  AliAODRecoDecayHF3Prong * DPlus = (AliAODRecoDecayHF3Prong*)Bzero->GetDaughter(0);
2037 
2038  Double_t e[4] = {0};
2039  e[0] = DPlus->EProng(0, 211); // to be done: Check effect of taking energies of DPlus daughters at B vertex by propagating D to B first ////////////////////////////////////////////////////////////////////////////////////////////////////////
2040  e[1] = DPlus->EProng(1, 321);
2041  e[2] = DPlus->EProng(2, 211);
2042  e[3] = Bzero->EProng(1, 211);
2043 
2044  Double_t esum = e[0] + e[1] + e[2] + e[3];
2045  Double_t invMassB0 = TMath::Sqrt(esum * esum - Bzero->P2());
2046 
2047  Double_t eD[3] = {0};
2048  eD[0] = DPlus->EProng(0, 211);
2049  eD[1] = DPlus->EProng(1, 321);
2050  eD[2] = DPlus->EProng(2, 211);
2051 
2052  Double_t esumD = eD[0] + eD[1] + eD[2];
2053  Double_t invMassDPlus = TMath::Sqrt(esumD * esumD - DPlus->P2());
2054 
2055  return invMassB0 - invMassDPlus;
2056 }
2057 
2058 
2059 //---------------------------------------------------------------------------
2060 //
2061 // DO for DPlus pt bin functions
2062 //
2063 //---------------------------------------------------------------------------
2064 
2066  //
2067  // store the cuts
2068  //
2069 
2070  if (nVars != fnVarsDPlusforDPlusptbin) {
2071  printf("Wrong number of variables: it has to be %d\n", fnVarsDPlusforDPlusptbin);
2072  AliFatal("exiting");
2073  }
2074  if (nPtBins != fnPtBinsDPlusforDPlusptbin) {
2075  printf("Wrong number of pt bins: it has to be %d\n", fnPtBinsDPlusforDPlusptbin);
2076  AliFatal("exiting");
2077  }
2078 
2080 
2081 
2082  for (Int_t iv = 0; iv < fnVarsDPlusforDPlusptbin; iv++)
2083  {
2084  for (Int_t ib = 0; ib < fnPtBinsDPlusforDPlusptbin; ib++)
2085  {
2086  //check
2087 
2089  {
2090  cout << "Overflow, exit..." << endl;
2091  return;
2092  }
2093 
2094  fCutsRDDPlusforDPlusptbin[GetGlobalIndexDPlusforDPlusptbin(iv, ib)] = cutsRDDPlusforDPlusptbin[iv][ib];
2095 
2096  }
2097  }
2098 
2099  return;
2100 }
2101 //---------------------------------------------------------------------------
2102 void AliRDHFCutsB0toDPi::SetCutsDPlusforDPlusptbin(Int_t glIndex, Float_t *cutsRDDPlusforDPlusptbin) {
2103  //
2104  // store the cuts
2105  //
2106  if (glIndex != fGlobalIndexDPlusforDPlusptbin) {
2107  cout << "Wrong array size: it has to be " << fGlobalIndexDPlusforDPlusptbin << endl;
2108  AliFatal("exiting");
2109  }
2111 
2112  for (Int_t iGl = 0; iGl < fGlobalIndexDPlusforDPlusptbin; iGl++) {
2113  fCutsRDDPlusforDPlusptbin[iGl] = cutsRDDPlusforDPlusptbin[iGl];
2114  }
2115  return;
2116 }
2117 //---------------------------------------------------------------------------
2119  //
2120  //give the pt bin where the pt lies.
2121  //
2122  Int_t ptbin = -1;
2123  if (pt < fPtBinLimitsDPlusforDPlusptbin[0])return ptbin;
2124  for (Int_t i = 0; i < fnPtBinsDPlusforDPlusptbin; i++) {
2125  if (pt < fPtBinLimitsDPlusforDPlusptbin[i + 1]) {
2126  ptbin = i;
2127  break;
2128  }
2129  }
2130  return ptbin;
2131 }
2132 //---------------------------------------------------------------------------
2134  // Set the pt bins
2135 
2139  printf("Changing the pt bins\n");
2140  }
2141 
2142  if (nPtBinLimits != fnPtBinsDPlusforDPlusptbin + 1) {
2143  cout << "Warning: ptBinLimits dimension " << nPtBinLimits << " != nPtBins+1 (" << fnPtBinsDPlusforDPlusptbin + 1 << ")\nSetting nPtBins to " << nPtBinLimits - 1 << endl;
2144  SetNPtBinsDPlusforDPlusptbin(nPtBinLimits - 1);
2145  }
2146 
2147  fnPtBinLimitsDPlusforDPlusptbin = nPtBinLimits;
2149  //cout<<"Changing also Global Index -> "<<fGlobalIndex<<endl;
2151  for (Int_t ib = 0; ib < nPtBinLimits; ib++) fPtBinLimitsDPlusforDPlusptbin[ib] = ptBinLimits[ib];
2152 
2153  return;
2154 }
2155 //---------------------------------------------------------------------------
2156 Int_t AliRDHFCutsB0toDPi::ApplyCutOnVariable(Int_t nCutIndex, Int_t ptbin, Float_t cutVariableValue, Bool_t bCutArray[78]) {
2157 
2158  if (GetIsCutUsed(nCutIndex, ptbin) == kTRUE)
2159  {
2160  Bool_t bCut = kFALSE;
2161  if (GetIsUpperCut(nCutIndex) == kTRUE)
2162  {
2163  if (cutVariableValue > fCutsRD[GetGlobalIndex(nCutIndex, ptbin)]) bCut = kTRUE;
2164  } else
2165  {
2166  if (cutVariableValue < fCutsRD[GetGlobalIndex(nCutIndex, ptbin)]) bCut = kTRUE;
2167  }
2168  if (bCut == kTRUE) {bCutArray[nCutIndex] = 1; return 0;}
2169  }
2170  return 1;
2171 }
2172 //---------------------------------------------------------------------------
2173 Int_t AliRDHFCutsB0toDPi::ApplyCutOnVariableDPlusforDPlusptbin(Int_t nCutIndex, Int_t ptbin, Float_t cutVariableValue, Bool_t bCutArray[39]) {
2174 
2175  // std::cout << "index: " << nCutIndex << ", ptbin: " << ptbin << ", used: " << GetIsCutUsedDPlusforDPlusptbin(nCutIndex,ptbin) << ", upper: " << GetIsUpperCutDPlusforDPlusptbin(nCutIndex) << ", value: " << cutVariableValue << ", cutvalue: " << fCutsRDDPlusforDPlusptbin[GetGlobalIndexDPlusforDPlusptbin(nCutIndex,ptbin)] << std::endl;
2176  if (GetIsCutUsedDPlusforDPlusptbin(nCutIndex, ptbin) == kTRUE)
2177  {
2178  Bool_t bCut = kFALSE;
2179  if (GetIsUpperCutDPlusforDPlusptbin(nCutIndex) == kTRUE)
2180  {
2181  if (cutVariableValue > fCutsRDDPlusforDPlusptbin[GetGlobalIndexDPlusforDPlusptbin(nCutIndex, ptbin)]) bCut = kTRUE;
2182  } else
2183  {
2184  if (cutVariableValue < fCutsRDDPlusforDPlusptbin[GetGlobalIndexDPlusforDPlusptbin(nCutIndex, ptbin)]) bCut = kTRUE;
2185  }
2186  if (bCut == kTRUE) {bCutArray[nCutIndex] = 1; return 0;}
2187  }
2188  return 1;
2189 }
2190 //---------------------------------------------------------------------------
2192  // Set the variable names
2193 
2195  delete [] fVarNamesDPlusforDPlusptbin;
2197  //printf("Changing the variable names\n");
2198  }
2199  if (nVars != fnVarsDPlusforDPlusptbin) {
2200  printf("Wrong number of variables: it has to be %d\n", fnVarsDPlusforDPlusptbin);
2201  return;
2202  }
2203  //fnVars=nVars;
2204  fVarNamesDPlusforDPlusptbin = new TString[nVars];
2206  for (Int_t iv = 0; iv < nVars; iv++) {
2207  fVarNamesDPlusforDPlusptbin[iv] = varNames[iv];
2208  fIsUpperCutDPlusforDPlusptbin[iv] = isUpperCut[iv];
2209  }
2210 
2211  return;
2212 }
2213 //---------------------------------------------------------------------------
2215  // Set the use of all cuts to kFALSE and the cut value to zero. This function has to be called after setting the pt bins.
2216 
2217  if (fIsCutUsed) {
2218  delete [] fIsCutUsed;
2219  fIsCutUsed = NULL;
2220  }
2221 
2222  fIsCutUsed = new Bool_t[(GetNPtBins()) * (GetNVars())];
2223  for (Int_t iv = 0; iv < (GetNPtBins()) * (GetNVars()); iv++) {
2224  fIsCutUsed[iv] = kFALSE;
2225  }
2226 
2227  if (!fCutsRD) fCutsRD = new Float_t[fGlobalIndex];
2228 
2229 
2230  for (Int_t iv = 0; iv < fnVars; iv++) {
2231 
2232  for (Int_t ib = 0; ib < fnPtBins; ib++) {
2233 
2234  //check
2235  if (GetGlobalIndex(iv, ib) >= fGlobalIndex) {
2236  cout << "Overflow, exit..." << endl;
2237  return;
2238  }
2239 
2240  fCutsRD[GetGlobalIndex(iv, ib)] = 0;
2241 
2242  }
2243  }
2244 
2245  // DPlus for DPlus pt bin
2246 
2248  delete [] fIsCutUsedDPlusforDPlusptbin;
2250  }
2251 
2253  for (Int_t iv = 0; iv < (GetNPtBinsDPlusforDPlusptbin()) * (GetNVarsDPlusforDPlusptbin()); iv++) {
2254  fIsCutUsedDPlusforDPlusptbin[iv] = kFALSE;
2255 
2256  }
2257 
2259 
2260  for (Int_t iv = 0; iv < fnVarsDPlusforDPlusptbin; iv++)
2261  {
2262  for (Int_t ib = 0; ib < fnPtBinsDPlusforDPlusptbin; ib++)
2263  {
2264  //check
2265 
2267  {
2268  cout << "Overflow, exit..." << endl;
2269  return;
2270  }
2271 
2273  }
2274  }
2275 
2276  return;
2277 }
2278 //---------------------------------------------------------------------------
2279 void AliRDHFCutsB0toDPi::SetCut(Int_t nCutIndex, Int_t ptBin, AliRDHFCutsB0toDPi::EUpperCut cutDirection, Float_t cutValue) {
2280  // Set the cut value and direction
2281 
2282  fIsCutUsed[GetGlobalIndex(nCutIndex, ptBin)] = kTRUE;
2283  fIsUpperCut[nCutIndex] = cutDirection;
2284  fCutsRD[GetGlobalIndex(nCutIndex, ptBin)] = cutValue;
2285 
2286  return;
2287 }
2288 //---------------------------------------------------------------------------
2290  // Set the cut value and direction
2291 
2293  fIsUpperCutDPlusforDPlusptbin[nCutIndex] = cutDirection;
2294  fCutsRDDPlusforDPlusptbin[GetGlobalIndexDPlusforDPlusptbin(nCutIndex, ptBin)] = cutValue;
2295 
2296  return;
2297 }
2298 //---------------------------------------------------------------------------
2299 void AliRDHFCutsB0toDPi::InitializeCutsForCutOptimization(Int_t nCutsForOptimization, Int_t nVariables) {
2300  //
2301  // Initialize the cuts for optimization
2302  //
2303 
2304  fnVariablesForCutOptimization = nVariables;
2305  fnCutsForOptimization = nCutsForOptimization;
2307 
2308 
2310  {
2313  }
2315 
2317  {
2318  delete [] fCutIndexForCutOptimization;
2319  fCutIndexForCutOptimization = nullptr;
2320  }
2322 
2324  {
2325  delete [] fSigmaForCutOptimization;
2326  fSigmaForCutOptimization = nullptr;
2327  }
2329 
2331 
2332 
2333  for (Int_t iv = 0; iv < fnVariablesForCutOptimization; iv++)
2334  {
2335  for (Int_t ib = 0; ib < fnPtBins; ib++)
2336  {
2337  for (Int_t ic = 0; ic < fnCutsForOptimization; ++ic)
2338  {
2340  {
2341  cout << "Overflow, exit..." << endl;
2342  return;
2343  }
2344 
2346  }
2347  }
2348  }
2349 
2350  return;
2351 }
2352 //---------------------------------------------------------------------------
2353 void AliRDHFCutsB0toDPi::SetCutsForCutOptimization(Int_t glIndex, Float_t *cutsRDForCutOptimization) {
2354  //
2355  // store the cuts
2356  //
2357  if (glIndex != fGlobalIndexCutOptimization) {
2358  cout << "Wrong array size: it has to be " << fGlobalIndexCutOptimization << endl;
2359  AliFatal("exiting");
2360  }
2362 
2363  for (Int_t iGl = 0; iGl < fGlobalIndexCutOptimization; iGl++) {
2364  fCutsRDForCutOptimization[iGl] = cutsRDForCutOptimization[iGl];
2365  }
2366  return;
2367 }
2368 //---------------------------------------------------------------------------
2369 void AliRDHFCutsB0toDPi::SetCutForCutOptimization(Int_t nCutIndex, Int_t nVariable, Int_t ptBin, AliRDHFCutsB0toDPi::EUpperCut cutDirection, Float_t * cutValues) {
2370  // Set the cut value and direction
2371  if (nVariable > GetnVariablesForCutOptimization() || nVariable < 0) cout << "wrong variable number for GetNCutsForOptimization" << endl;
2372 
2373  fIsUpperCutForCutOptimization[nVariable] = cutDirection;
2374  fCutIndexForCutOptimization[nVariable] = nCutIndex;
2375 
2376  for (Int_t iCut = 0; iCut < fnCutsForOptimization; ++iCut)
2377  {
2378  fCutsRDForCutOptimization[GetGlobalIndexForCutOptimization(iCut, nVariable, ptBin)] = cutValues[iCut];
2379  }
2380 
2381  return;
2382 }
Double_t NormalizedDecayLengthXY() const
Int_t fIsSelectedCuts
fix the daughter track references
Definition: AliRDHFCuts.h:497
Double_t NormalizedDecayLength() const
Int_t GetNVars() const
Definition: AliRDHFCuts.h:267
Int_t PtBin(Float_t pt) const
Definition: AliRDHFCuts.h:330
double Double_t
Definition: External.C:58
void SetCut(Int_t nCutIndex, Int_t ptBin, AliRDHFCutsB0toDPi::EUpperCut cutDirection, Float_t cutValue)
Double_t GetFiducialYCut() const
Int_t GetnSigmaTOF(AliAODTrack *track, Int_t species, Double_t &sigma) const
Bool_t * fIsUpperCutDPlusforDPlusptbin
void SetNVarsDPlusforDPlusptbin(Int_t nVars)
Float_t * fPtBinLimitsDPlusforDPlusptbin
Int_t GetMinITSNclsDaughterType(Int_t nDaughterType) const
AliRDHFCutsB0toDPi(const char *name="B0toDPiCuts")
Bool_t * fIsUpperCut
Definition: AliRDHFCuts.h:475
Bool_t IsKaonRaw(AliAODTrack *track, TString detector) const
Bool_t UseFilterBitDaughterType(Int_t nDaughterType) const
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Int_t GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const
void SetFilterBitDaughterType(Int_t nDaughterType, Int_t value)
Double_t bz
Double_t ImpParXY() const
void InitializeCutsForCutOptimization(Int_t nCutsForOptimization, Int_t nVariables)
Int_t GetCutIndexForCutOptimization(Int_t nVariable) const
Bool_t UseITSRefitDaughterType(Int_t nDaughterType) const
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:445
Int_t IsDPlusforDPlusptbinSelected(TObject *obj, Int_t selectionLevel, AliAODEvent *aod, Bool_t *bCutArray)
Int_t IsDPlusFromB0Selected(Double_t ptB0, TObject *obj, Int_t selectionLevel, AliAODEvent *aod, Bool_t bCutArray[78])
void SetCutForCutOptimization(Int_t nCutIndex, Int_t nVariable, Int_t ptBin, AliRDHFCutsB0toDPi::EUpperCut cutDirection, Float_t *cutValues)
void SetMinTPCNclsDaughterType(Int_t nDaughterType, Int_t value)
Int_t GetFilterBitDaughterType(Int_t nDaughterType) const
Double_t CosPointingAngleXY() const
void SetUseITSRefitDaughterType(Int_t nDaughterType, Bool_t option)
Bool_t GetIsCutUsedDPlusforDPlusptbin(Int_t nCutIndex, Int_t ptbin) const
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Double_t DeltaInvMassB0Kpipipi(AliAODRecoDecayHF2Prong *Bzero) const
void SetHardSelectionArrayITSDaughterType(Int_t nDaughterType, const Bool_t array[7]=0)
Bool_t fUsePID
Definition: AliRDHFCuts.h:476
void SetIsCutUsed(Int_t nCutIndex, Int_t ptbin, Bool_t isCutUsed)
Bool_t GetIsUpperCutForCutOptimization(Int_t nVariable) const
Bool_t UseTPCRefitDaughterType(Int_t nDaughterType) const
void SetUseFilterBitDaughterType(Int_t nDaughterType, Bool_t option)
void SetGlobalIndexForCutOptimization()
void SetUseTPCRefitDaughterType(Int_t nDaughterType, Bool_t option)
Int_t GetGlobalIndexDPlusforDPlusptbin(Int_t iVar, Int_t iPtBin) const
Bool_t * fIsUpperCutForCutOptimization
virtual Int_t SelectPID(AliAODTrack *track, Int_t type)
Double_t GetMaxAbsEtaDaughterType(Int_t nDaughterType) const
Int_t CheckBands(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, AliAODTrack *track)
Int_t GetNSoftITSCutDaughterType(Int_t nDaughterType) const
Int_t GetNPtBinsDPlusforDPlusptbin() const
int Int_t
Definition: External.C:63
Bool_t * GetIsUpperCut() const
Definition: AliRDHFCuts.h:278
Int_t GetnVariablesForCutOptimization()
unsigned int UInt_t
Definition: External.C:33
Double_t GetSigmaForCutOptimization(Int_t iPtBin) const
void GetSoftSelectionArrayITSDaughterType(Int_t nDaughterType, Bool_t array[7]=0) const
float Float_t
Definition: External.C:68
void SetNSoftITSCutDaughterType(Int_t nDaughterType, Int_t value)
Int_t fNumberOfSigmaBinsForCutOptimization
void SetMinPtDaughterType(Int_t nDaughterType, Double_t value)
Bool_t CheckStatus(AliAODTrack *track, TString detectors) const
void SetNPtBinsDPlusforDPlusptbin(Int_t nptBins)
void SetSoftSelectionArrayITSDaughterType(Int_t nDaughterType, const Bool_t array[7]=0)
Double_t GetSigmaVert(const AliAODEvent *aod=0x0)
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Double_t Getd0errProng(Int_t ip) const
prongs
Int_t fIsSelectedPID
outcome of cuts selection
Definition: AliRDHFCuts.h:498
Double_t GetMinPtDaughterType(Int_t nDaughterType) const
Int_t GetMinTPCNclsDaughterType(Int_t nDaughterType) const
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:474
Double_t GetMind0DaughterType(Int_t nDaughterType) const
AliRDHFCutsB0toDPi & operator=(const AliRDHFCutsB0toDPi &source)
void SetPtBinsDPlusforDPlusptbin(Int_t nPtBinLimits, Float_t *ptBinLimits)
void SetMaxAbsEtaDaughterType(Int_t nDaughterType, Double_t value)
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
void SetCutDPlusforDPlusptbin(Int_t nCutIndex, Int_t ptBin, AliRDHFCutsB0toDPi::EUpperCut cutDirection, Float_t cutValue)
Bool_t * fIsCutUsed
Radius for circular PID nsigma cut.
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Bool_t IsPionRaw(AliAODTrack *track, TString detector) const
void SetCutsForCutOptimization(Int_t glIndex, Float_t *cutsRDForCutOptimization)
Int_t GetGlobalIndexForCutOptimization(Int_t iCut, Int_t iVar, Int_t iPtBin)
void SetIsUpperCutForCutOptimization(Int_t nVariable, Bool_t isUpperCut)
void SetCutsDPlusforDPlusptbin(Int_t nVars, Int_t nPtBins, Float_t **cutsRDDPlusforDPlusptbin)
void SetMinITSNclsDaughterType(Int_t nDaughterType, Int_t value)
Bool_t GetIsCutUsed(Int_t nCutIndex, Int_t ptbin) const
Int_t ApplyCutOnVariableDPlusforDPlusptbin(Int_t nCutIndex, Int_t ptbin, Float_t cutVariableValue, Bool_t bCutArray[39])
void SetMind0DaughterType(Int_t nDaughterType, Double_t value)
void GetHardSelectionArrayITSDaughterType(Int_t nDaughterType, Bool_t array[7]=0) const
Float_t * fCutsRDForCutOptimization
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
void SetVarNamesDPlusforDPlusptbin(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Float_t * fSigmaForCutOptimization
Int_t GetMatch() const
Definition: AliAODPidHF.h:158
TString * fVarNamesDPlusforDPlusptbin
void SetSigmaForCutOptimization(Double_t value, Int_t iPtBin)
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:266
void SetGlobalIndexDPlusforDPlusptbin()
Int_t ApplyCutOnVariable(Int_t nCutIndex, Int_t ptbin, Float_t cutVariableValue, Bool_t bCutArray[78])
bool Bool_t
Definition: External.C:53
Bool_t * fIsCutUsedDPlusforDPlusptbin
Double_t CosPointingAngle() const
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:466
void SetMinNormd0DaughterType(Int_t nDaughterType, Double_t value)
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:478
Int_t fGlobalIndex
Definition: AliRDHFCuts.h:473
Double_t GetMinNormd0DaughterType(Int_t nDaughterType) const
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
Float_t * fCutsRDDPlusforDPlusptbin
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *rd)
void SetCutIndexForCutOptimization(Int_t nVariable, Int_t nCutIndex)
void SetIsCutUsedDPlusforDPlusptbin(Int_t nCutIndex, Int_t ptbin, Bool_t isCutUsed)
Int_t GetNVarsDPlusforDPlusptbin() const
Int_t PtBinDPlusforDPlusptbin(Double_t pt) const
Bool_t GetIsUpperCutDPlusforDPlusptbin(Int_t nCutIndex)
Int_t fnVars
Definition: AliRDHFCuts.h:469