]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliRDHFCutsLctopKpi.cxx
Flow afterburner for D mesons (Giacomo)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsLctopKpi.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 /////////////////////////////////////////////////////////////
19 //
20 // Class for cuts on AOD reconstructed Lc->pKpi
21 //
22 // Author: A.Dainese, andrea.dainese@pd.infn.it
23 /////////////////////////////////////////////////////////////
24
25 #include <TDatabasePDG.h>
26 #include <Riostream.h>
27
28 #include "AliRDHFCutsLctopKpi.h"
29 #include "AliAODRecoDecayHF3Prong.h"
30 #include "AliRDHFCuts.h"
31 #include "AliAODTrack.h"
32 #include "AliESDtrack.h"
33 #include "AliKFParticle.h"
34 #include "AliESDVertex.h"
35
36 ClassImp(AliRDHFCutsLctopKpi)
37
38 //--------------------------------------------------------------------------
39 AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const char* name) : 
40 AliRDHFCuts(name),
41 fPidObjprot(0),
42 fPidObjpion(0),
43 fRecoKF(kFALSE)
44 {
45   //
46   // Default Constructor
47   //
48   Int_t nvars=13;
49   SetNVars(nvars);
50   TString varNames[13]={"inv. mass [GeV]",
51                         "pTK [GeV/c]",
52                         "pTP [GeV/c]",
53                         "d0K [cm]   lower limit!",
54                         "d0Pi [cm]  lower limit!",
55                         "dist12 (cm)",
56                         "sigmavert (cm)",
57                         "dist prim-sec (cm)",
58                         "pM=Max{pT1,pT2,pT3} (GeV/c)",
59                         "cosThetaPoint",
60                         "Sum d0^2 (cm^2)",
61                         "dca cut (cm)",
62                         "cut on pTpion [GeV/c]"};
63   Bool_t isUpperCut[13]={kTRUE,
64                          kFALSE,
65                          kFALSE,
66                          kFALSE,
67                          kFALSE,
68                          kFALSE,
69                          kTRUE,
70                          kFALSE,
71                          kFALSE,
72                          kFALSE,
73                          kFALSE,
74                          kTRUE,
75                          kFALSE
76                          };
77   SetVarNames(nvars,varNames,isUpperCut);
78   Bool_t forOpt[13]={kFALSE,
79                      kTRUE,
80                      kTRUE,
81                      kFALSE,
82                      kFALSE,
83                      kFALSE,
84                      kFALSE,
85                      kTRUE,
86                      kFALSE,
87                      kFALSE,
88                      kFALSE,
89                      kFALSE,
90                      kTRUE};
91   SetVarsForOpt(4,forOpt);
92   Float_t limits[2]={0,999999999.};
93   SetPtBins(2,limits);
94 }
95 //--------------------------------------------------------------------------
96 AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const AliRDHFCutsLctopKpi &source) :
97   AliRDHFCuts(source),
98   fPidObjprot(0),
99   fPidObjpion(0),
100   fRecoKF(kFALSE)
101 {
102   //
103   // Copy constructor
104   //
105   if(source.fPidObjprot) SetPidprot(source.fPidObjprot);
106   if(source.fPidObjpion) SetPidpion(source.fPidObjpion);
107 }
108 //--------------------------------------------------------------------------
109 AliRDHFCutsLctopKpi &AliRDHFCutsLctopKpi::operator=(const AliRDHFCutsLctopKpi &source)
110 {
111   //
112   // assignment operator
113   //
114   if(&source == this) return *this;
115
116   AliRDHFCuts::operator=(source);
117   SetPidprot(source.GetPidprot());
118   SetPidpion(source.GetPidpion());
119
120   return *this;
121 }
122 //---------------------------------------------------------------------------
123 AliRDHFCutsLctopKpi::~AliRDHFCutsLctopKpi() {
124  //
125  //  // Default Destructor
126  //   
127  if(fPidObjpion){
128   delete fPidObjpion;
129   fPidObjpion=0;
130  }
131  if(fPidObjprot){
132   delete fPidObjprot;
133   fPidObjprot=0;
134  }
135
136 }
137
138 //---------------------------------------------------------------------------
139 void AliRDHFCutsLctopKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
140   // 
141   // Fills in vars the values of the variables 
142   //
143
144   if(nvars!=fnVarsForOpt) {
145     printf("AliRDHFCutsLctopKpi::GetCutsVarsForOpt: wrong number of variables\n");
146     return;
147   }
148
149   AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
150
151     Int_t iter=-1;
152   if(fVarsForOpt[0]){
153     iter++;
154     vars[iter]=dd->InvMassLcpKpi();
155   }
156   if(fVarsForOpt[1]){
157     iter++;
158     for(Int_t iprong=0;iprong<3;iprong++){
159       if(TMath::Abs(pdgdaughters[iprong])==321) {
160         vars[iter]=dd->PtProng(iprong);
161       }
162     }
163   }
164   if(fVarsForOpt[2]){
165     iter++;
166     for(Int_t iprong=0;iprong<3;iprong++){
167       if(TMath::Abs(pdgdaughters[iprong])==2212) {
168         vars[iter]=dd->PtProng(iprong);
169       }
170     }
171   }
172   if(fVarsForOpt[3]){
173     iter++;
174     for(Int_t iprong=0;iprong<3;iprong++){
175       if(TMath::Abs(pdgdaughters[iprong])==2212) {
176         vars[iter]=dd->Getd0Prong(iprong);
177       }
178     }
179   }
180   if(fVarsForOpt[4]){
181     iter++;
182     for(Int_t iprong=0;iprong<3;iprong++){
183       if(TMath::Abs(pdgdaughters[iprong])==211) {
184         vars[iter]=dd->Getd0Prong(iprong);
185       }
186     }
187   }
188   if(fVarsForOpt[5]){
189     iter++;
190     vars[iter]=dd->GetDist12toPrim();
191   }
192   if(fVarsForOpt[6]){
193     iter++;
194     vars[iter]=dd->GetSigmaVert();
195   }
196   if(fVarsForOpt[7]){
197     iter++;
198     vars[iter] = dd->DecayLength();
199   }
200   if(fVarsForOpt[8]){
201     iter++;
202     Float_t ptmax=0;
203     for(Int_t i=0;i<3;i++){
204       if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
205     }
206     vars[iter]=ptmax;
207   }
208   if(fVarsForOpt[9]){
209     iter++;
210     vars[iter]=dd->CosPointingAngle();
211   }
212   if(fVarsForOpt[10]){
213     iter++;
214     vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
215   }
216   if(fVarsForOpt[11]){
217     iter++;
218     vars[iter]=dd->GetDCA();
219   }
220   if(fVarsForOpt[12]){
221     iter++;
222     for(Int_t iprong=0;iprong<3;iprong++){
223       if(TMath::Abs(pdgdaughters[iprong])==211) {
224         vars[iter]=dd->PtProng(iprong);
225       }
226     }
227   }
228
229   return;
230 }
231 //---------------------------------------------------------------------------
232 Int_t AliRDHFCutsLctopKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent *aod) {
233   //
234   // Apply selection
235   //
236
237   if(!fCutsRD){
238     cout<<"Cut matrice not inizialized. Exit..."<<endl;
239     return 0;
240   }
241   //PrintAll();
242   AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
243
244   if(!d){
245     cout<<"AliAODRecoDecayHF3Prong null"<<endl;
246     return 0;
247   }
248
249
250   if(fKeepSignalMC) if(IsSignalMC(d,aod,4122)) return 3;
251
252   Int_t returnvalue=3;
253   Int_t returnvaluePID=3;
254
255   if(d->Pt()<fMinPtCand) return 0;
256   if(d->Pt()>fMaxPtCand) return 0;
257
258   // selection on candidate
259   if(selectionLevel==AliRDHFCuts::kAll || 
260      selectionLevel==AliRDHFCuts::kCandidate) {
261
262     Double_t pt=d->Pt();
263     
264     Int_t ptbin=PtBin(pt);
265     
266     Double_t mLcpKpi,mLcpiKp;
267     Int_t okLcpKpi=1,okLcpiKp=1;
268
269     Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
270
271     mLcpKpi=d->InvMassLcpKpi();
272     mLcpiKp=d->InvMassLcpiKp();
273
274     if(TMath::Abs(mLcpKpi-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpKpi = 0;
275     if(TMath::Abs(mLcpiKp-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpiKp = 0;
276     if(!okLcpKpi && !okLcpiKp) return 0;
277
278     if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;//Kaon
279     if((TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(12,ptbin)])) okLcpKpi=0;
280     if((TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(12,ptbin)]))okLcpiKp=0;
281     if(!okLcpKpi && !okLcpiKp) return 0;
282
283     
284     if(fRecoKF){
285      Int_t valueTmp=3;
286      if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
287      if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
288      if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
289
290      Int_t valueTotTmp=CombinePIDCuts(valueTmp,returnvaluePID);
291      Int_t pdgs[3]={2212,321,211};
292      if(valueTotTmp>=2) {
293       pdgs[0]=211;
294       pdgs[2]=2212;
295      }
296      if(!d->GetOwnPrimaryVtx()){
297       AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); 
298       d->SetOwnPrimaryVtx(vtx1);
299      }
300      Double_t field=aod->GetMagneticField(); 
301      ReconstructKF(d,pdgs,field);
302     }
303     //2track cuts
304     if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
305     if(d->GetDist12toPrim()>1.) return 0;
306     if(d->GetDist23toPrim()>1.) return 0;
307     if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.) return 0;
308     
309     //sec vert
310     if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
311
312     if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
313     if(d->DecayLength()>0.5) return 0;
314     
315     if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
316     if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
317     Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
318     if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
319     
320     //DCA
321     for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
322
323
324     if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
325     if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
326     if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
327    
328   }
329
330   if(selectionLevel==AliRDHFCuts::kAll ||
331      selectionLevel==AliRDHFCuts::kCandidate|| 
332      selectionLevel==AliRDHFCuts::kPID) {
333      returnvaluePID = IsSelectedPID(d);
334      fIsSelectedPID=returnvaluePID;
335      }
336   //  if(fUsePID || selectionLevel==AliRDHFCuts::kPID) returnvaluePID = IsSelectedCombinedPID(d);   // to test!!
337   if(returnvaluePID==0) return 0;
338
339   // selection on daughter tracks 
340   if(selectionLevel==AliRDHFCuts::kAll || 
341      selectionLevel==AliRDHFCuts::kTracks) {
342     if(!AreDaughtersSelected(d)) return 0;
343   }
344
345
346   Int_t returnvalueTot=CombinePIDCuts(returnvalue,returnvaluePID);
347   return returnvalueTot;
348 }
349 //---------------------------------------------------------------------------
350 Int_t AliRDHFCutsLctopKpi::IsSelectedPID(AliAODRecoDecayHF* obj) {
351
352
353     if(!fUsePID || !obj) return 3;
354     Int_t okLcpKpi=0,okLcpiKp=0;
355     Int_t returnvalue=0;
356     Bool_t isPeriodd=fPidHF->GetOnePad();
357     Bool_t isMC=fPidHF->GetMC();
358     Bool_t ispion0=kTRUE,ispion2=kTRUE;
359     Bool_t isproton0=kFALSE,isproton2=kFALSE;
360     Bool_t iskaon1=kFALSE;
361     if(isPeriodd) {
362      fPidObjprot->SetOnePad(kTRUE);
363      fPidObjpion->SetOnePad(kTRUE);
364     }
365     if(isMC) {
366      fPidObjprot->SetMC(kTRUE);
367      fPidObjpion->SetMC(kTRUE);
368     }
369
370     for(Int_t i=0;i<3;i++){
371      AliAODTrack *track=(AliAODTrack*)obj->GetDaughter(i);
372      if(!track) return 0;
373      // identify kaon
374      if(i==1) {
375       Int_t isKaon=fPidHF->MakeRawPid(track,3); 
376       if(isKaon>=1) {
377        iskaon1=kTRUE;
378       if(fPidHF->MakeRawPid(track,2)>=1) iskaon1=kFALSE;
379       }
380       if(!iskaon1) return 0;
381      
382      }else{
383      //pion or proton
384       
385      Int_t isProton=fPidObjprot->MakeRawPid(track,4);
386      if(isProton>=1){
387       if(fPidHF->MakeRawPid(track,2)>=1) isProton=-1;
388       if(fPidHF->MakeRawPid(track,3)>=1) isProton=-1;
389      }
390
391      Int_t isPion=fPidObjpion->MakeRawPid(track,2);
392      if(fPidHF->MakeRawPid(track,3)>=1) isPion=-1;
393      if(fPidObjprot->MakeRawPid(track,4)>=1) isPion=-1;
394
395
396      if(i==0) {
397       if(isPion<0) ispion0=kFALSE;
398       if(isProton>=1) isproton0=kTRUE;
399
400      }
401       if(!ispion0 && !isproton0) return 0;
402      if(i==2) {
403       if(isPion<0) ispion2=kFALSE;
404       if(isProton>=1) isproton2=kTRUE;
405      }
406
407     }
408    }
409
410     if(ispion2 && isproton0 && iskaon1) okLcpKpi=1;
411     if(ispion0 && isproton2 && iskaon1) okLcpiKp=1;
412     if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
413     if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
414     if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
415
416  return returnvalue;
417 }
418 //---------------------------------------------------------------------------
419 Int_t AliRDHFCutsLctopKpi::IsSelectedCombinedPID(AliAODRecoDecayHF* obj) {
420
421   //  Printf(" -------- IsSelectedCombinedPID --------------");
422
423     if(!obj) {return 3;}
424     Int_t okLcpKpi=0,okLcpiKp=0;
425     Int_t returnvalue=0;
426     Bool_t isPeriodd=fPidHF->GetOnePad();
427     Bool_t isMC=fPidHF->GetMC();
428     Bool_t isKaon = kFALSE;
429     Bool_t isPion = kFALSE;
430     Bool_t isProton = kFALSE;
431
432     if(isPeriodd) {
433             fPidObjprot->SetOnePad(kTRUE);
434             fPidObjpion->SetOnePad(kTRUE);
435     }
436     if(isMC) {
437             fPidObjprot->SetMC(kTRUE);
438             fPidObjpion->SetMC(kTRUE);
439     }
440
441     Double_t probComb[AliPID::kSPECIES]={0.};  // array to store the info for the combined ITS|TPC|TOF probabilities
442     fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetITS|AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC);  // the mask could become a member of the cut object
443
444     for(Int_t i=0;i<3;i++){
445             AliAODTrack *track=(AliAODTrack*)obj->GetDaughter(i);
446             if(!track) return 0;
447             // identify kaon
448             /*UInt_t detUsed =*/ fPidHF->GetPidCombined()->ComputeProbabilities(track, fPidHF->GetPidResponse(), probComb); // for the moment we don't check detUsed...
449             //      Printf("[%d] %x %f %f %f %f %f",i,detUsed,probComb[0],probComb[1],probComb[2],probComb[3],probComb[4]);
450             if(i==1) {
451                     if(TMath::MaxElement(AliPID::kSPECIES,probComb) == probComb[3]) {  // the probability to be a Kaon is the highest
452                       isKaon=kTRUE;
453                       //                      if ( probComb[3] > 0.8 ) isKaon=kTRUE;
454                       //                      else return 0;
455                     }
456                     else return 0; // prong at position 1 is not a Kaon, returning 0                
457             }
458             else {
459                     //pion or proton
460                     
461                     if(TMath::MaxElement(AliPID::kSPECIES,probComb) == probComb[4]) {  // the probability to be a proton is the highest
462                             isProton=kTRUE;
463                             if (isPion) okLcpiKp = 1;  // the pion was already identified, so here we must be at i == 2 --> Lc --> pi K p (K already found)
464                     }
465                     if(TMath::MaxElement(AliPID::kSPECIES,probComb) == probComb[2]) {  // the probability to be a pion is the highest
466                             isPion=kTRUE;
467                             if (isProton) okLcpKpi = 1;  // the proton was already identified, so here we must be at i == 2 --> Lc --> p K pi (K already found)
468                     }
469                     
470             }
471     }
472     
473     if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
474     if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
475     if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
476     
477     return returnvalue;
478 }
479 //-----------------------
480 Int_t AliRDHFCutsLctopKpi::CombinePIDCuts(Int_t returnvalue, Int_t returnvaluePID) const {
481
482  Int_t returnvalueTot=0;
483  Int_t okLcpKpi=0,okLcpiKp=0;
484  if(returnvaluePID==1){
485    if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
486  }
487  if(returnvaluePID==2){
488    if(returnvalue>=2) okLcpiKp=1;
489  }
490  if(returnvaluePID==3 && returnvalue>0){
491   if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
492   if(returnvalue>=2) okLcpiKp=1;
493  } 
494
495  if(okLcpKpi) returnvalueTot=1; //cuts passed as Lc->pKpi
496  if(okLcpiKp) returnvalueTot=2; //cuts passed as Lc->piKp
497  if(okLcpKpi && okLcpiKp) returnvalueTot=3; //cuts passed as both pKpi and piKp
498  return returnvalueTot;
499 }
500 //----------------------------------
501 void AliRDHFCutsLctopKpi::SetStandardCutsPP2010() {
502
503  SetName("LctopKpiProdCuts");
504  SetTitle("Production cuts for Lc analysis");
505
506  AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
507  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
508  esdTrackCuts->SetRequireTPCRefit(kTRUE);
509  esdTrackCuts->SetMinNClustersTPC(70);
510  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
511                                           AliESDtrackCuts::kAny);
512  esdTrackCuts->SetRequireITSRefit(kTRUE);
513  esdTrackCuts->SetMinNClustersITS(4);
514  esdTrackCuts->SetMinDCAToVertexXY(0.);
515  esdTrackCuts->SetEtaRange(-0.8,0.8);
516  esdTrackCuts->SetPtRange(0.3,1.e10);
517  AddTrackCuts(esdTrackCuts);
518
519  const Int_t nptbins=4;
520  const Int_t nvars=13;
521  Float_t* ptbins;
522  ptbins=new Float_t[nptbins+1];
523  
524  ptbins[0]=0.;
525  ptbins[1]=2.;
526  ptbins[2]=3.;
527  ptbins[3]=4.;
528  ptbins[4]=9999.;
529
530  SetGlobalIndex(nvars,nptbins);
531  SetPtBins(nptbins+1,ptbins);
532
533  Float_t** prodcutsval;
534  prodcutsval=new Float_t*[nvars];
535  for(Int_t iv=0;iv<nvars;iv++){
536   prodcutsval[iv]=new Float_t[nptbins];
537  }
538
539  for(Int_t ipt=0;ipt<nptbins;ipt++){
540   prodcutsval[0][ipt]=0.18;
541   prodcutsval[1][ipt]=0.4;
542   prodcutsval[2][ipt]=0.5;
543   prodcutsval[3][ipt]=0.;
544   prodcutsval[4][ipt]=0.;
545   prodcutsval[5][ipt]=0.01;
546   prodcutsval[6][ipt]=0.06;
547   prodcutsval[7][ipt]=0.005;
548   prodcutsval[8][ipt]=0.;
549   prodcutsval[9][ipt]=0.;
550   prodcutsval[10][ipt]=0.;
551   prodcutsval[11][ipt]=0.05;
552   prodcutsval[12][ipt]=0.4;
553  }
554  SetCuts(nvars,nptbins,prodcutsval);
555
556  AliAODPidHF* pidObjK=new AliAODPidHF();
557  Double_t sigmasK[5]={3.,1.,1.,3.,2.};
558  pidObjK->SetSigma(sigmasK);
559  pidObjK->SetAsym(kTRUE);
560  pidObjK->SetMatch(1);
561  pidObjK->SetTPC(kTRUE);
562  pidObjK->SetTOF(kTRUE);
563  pidObjK->SetITS(kTRUE);
564  Double_t plimK[2]={0.5,0.8};
565  pidObjK->SetPLimit(plimK,2);
566  pidObjK->SetTOFdecide(kTRUE);
567
568  SetPidHF(pidObjK);
569
570  AliAODPidHF* pidObjpi=new AliAODPidHF();
571  pidObjpi->SetTPC(kTRUE);
572  Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
573  pidObjpi->SetSigma(sigmaspi);
574  pidObjpi->SetTOFdecide(kTRUE);
575  SetPidpion(pidObjpi);
576
577  AliAODPidHF* pidObjp=new AliAODPidHF();
578  Double_t sigmasp[5]={3.,1.,1.,3.,2.};
579  pidObjp->SetSigma(sigmasp);
580  pidObjp->SetAsym(kTRUE);
581  pidObjp->SetMatch(1);
582  pidObjp->SetTPC(kTRUE);
583  pidObjp->SetTOF(kTRUE);
584  pidObjp->SetITS(kTRUE);
585  Double_t plimp[2]={1.,2.};
586  pidObjp->SetPLimit(plimp,2);
587  pidObjp->SetTOFdecide(kTRUE);
588
589  SetPidprot(pidObjp);
590
591  SetUsePID(kTRUE);
592
593  PrintAll();
594
595  for(Int_t iiv=0;iiv<nvars;iiv++){
596   delete [] prodcutsval[iiv];
597  }
598  delete [] prodcutsval;
599  prodcutsval=NULL;
600  delete [] ptbins;
601  ptbins=NULL;
602
603  delete pidObjp;
604  pidObjp=NULL;
605
606  return;
607 }
608 //------------------
609 void AliRDHFCutsLctopKpi::SetStandardCutsPbPb2010() {
610
611  SetName("LctopKpiProdCuts");
612  SetTitle("Production cuts for Lc analysis");
613
614  AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
615
616  esdTrackCuts->SetRequireTPCRefit(kTRUE);
617  esdTrackCuts->SetMinNClustersTPC(70);
618  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
619                                           AliESDtrackCuts::kAny);
620  esdTrackCuts->SetRequireITSRefit(kTRUE);
621  esdTrackCuts->SetMinNClustersITS(4);
622  esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0100*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
623  esdTrackCuts->SetEtaRange(-0.8,0.8);
624  esdTrackCuts->SetMaxDCAToVertexXY(1.);
625  esdTrackCuts->SetMaxDCAToVertexZ(1.);
626  esdTrackCuts->SetPtRange(0.8,1.e10);
627  AddTrackCuts(esdTrackCuts);
628
629  const Int_t nptbins=4;
630  const Int_t nvars=13;
631  Float_t* ptbins;
632  ptbins=new Float_t[nptbins+1];
633  
634  ptbins[0]=0.;
635  ptbins[1]=2.;
636  ptbins[2]=3.;
637  ptbins[3]=4.;
638  ptbins[4]=9999.;
639
640  SetGlobalIndex(nvars,nptbins);
641  SetPtBins(nptbins+1,ptbins);
642
643  Float_t** prodcutsval;
644  prodcutsval=new Float_t*[nvars];
645  for(Int_t iv=0;iv<nvars;iv++){
646   prodcutsval[iv]=new Float_t[nptbins];
647  }
648
649  for(Int_t ipt=0;ipt<nptbins;ipt++){
650   prodcutsval[0][ipt]=0.13;
651   prodcutsval[1][ipt]=0.5;
652   prodcutsval[2][ipt]=0.6;
653   prodcutsval[3][ipt]=0.;
654   prodcutsval[4][ipt]=0.;
655   prodcutsval[5][ipt]=0.01;
656   prodcutsval[6][ipt]=0.04;
657   prodcutsval[7][ipt]=0.006;
658   prodcutsval[8][ipt]=0.8;
659   prodcutsval[9][ipt]=0.3;
660   prodcutsval[10][ipt]=0.;
661   prodcutsval[11][ipt]=0.05;
662   prodcutsval[12][ipt]=0.4;
663  }
664  SetCuts(nvars,nptbins,prodcutsval);
665
666  AliAODPidHF* pidObjK=new AliAODPidHF();
667  Double_t sigmasK[5]={3.,1.,1.,3.,2.};
668  pidObjK->SetSigma(sigmasK);
669  pidObjK->SetAsym(kTRUE);
670  pidObjK->SetMatch(1);
671  pidObjK->SetTPC(kTRUE);
672  pidObjK->SetTOF(kTRUE);
673  pidObjK->SetITS(kTRUE);
674  Double_t plimK[2]={0.5,0.8};
675  pidObjK->SetPLimit(plimK,2);
676
677  SetPidHF(pidObjK);
678
679  AliAODPidHF* pidObjpi=new AliAODPidHF();
680  pidObjpi->SetTPC(kTRUE);
681  Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
682  pidObjpi->SetSigma(sigmaspi);
683  SetPidpion(pidObjpi);
684
685  AliAODPidHF* pidObjp=new AliAODPidHF();
686  Double_t sigmasp[5]={3.,1.,1.,3.,2.};
687  pidObjp->SetSigma(sigmasp);
688  pidObjp->SetAsym(kTRUE);
689  pidObjp->SetMatch(1);
690  pidObjp->SetTPC(kTRUE);
691  pidObjp->SetTOF(kTRUE);
692  pidObjp->SetITS(kTRUE);
693  Double_t plimp[2]={1.,2.};
694  pidObjp->SetPLimit(plimp,2);
695
696  SetPidprot(pidObjp);
697
698  SetUsePID(kTRUE);
699
700  PrintAll();
701
702  for(Int_t iiv=0;iiv<nvars;iiv++){
703   delete [] prodcutsval[iiv];
704  }
705  delete [] prodcutsval;
706  prodcutsval=NULL;
707  delete [] ptbins;
708  ptbins=NULL;
709
710  delete pidObjp;
711  pidObjp=NULL;
712
713  return;
714 }
715 //------------------
716 Bool_t AliRDHFCutsLctopKpi::ReconstructKF(AliAODRecoDecayHF3Prong *d,Int_t *pdgs,Double_t field) const{
717
718  Int_t nprongs=d->GetNProngs();
719  Int_t iprongs[nprongs];
720  for(Int_t i=0;i<nprongs;i++) iprongs[i]=i;
721
722  Double_t mass[2]={0.,0.};
723
724  AliKFParticle *decay=d->ApplyVertexingKF(iprongs,nprongs,pdgs,kTRUE,field,mass);
725  if(!decay) return kTRUE;
726  AliESDVertex *vertexESD = new AliESDVertex(decay->Parameters(),
727                                             decay->CovarianceMatrix(),
728                                             decay->GetChi2(),
729                                             nprongs);
730  Double_t pos[3],cov[6],chi2perNDF;
731  vertexESD->GetXYZ(pos);
732  vertexESD->GetCovMatrix(cov);
733  chi2perNDF = vertexESD->GetChi2toNDF();
734  delete vertexESD; vertexESD=NULL;
735  AliAODVertex *vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
736  d->SetSecondaryVtx(vertexAOD);
737  return kTRUE;
738 }
739