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