AliPhysics  95775ff (95775ff)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliRDHFCutsD0toKpipipi.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
19 //
20 // Class for cuts on AOD reconstructed D0->Kpipipi
21 //
22 // Author: r.romita@gsi.de, andrea.dainese@pd.infn.it,
23 // fabio.colamaria@ba.infn.it
25 
26 #include <TDatabasePDG.h>
27 #include <Riostream.h>
28 
29 #include "AliRDHFCutsD0toKpipipi.h"
31 #include "AliAODTrack.h"
32 #include "AliESDtrack.h"
33 #include "AliAODPidHF.h"
34 
35 using std::cout;
36 using std::endl;
37 
41 
42 
43 //--------------------------------------------------------------------------
45 AliRDHFCuts(name)
46 {
47  //
48  // Default Constructor
49  //
50  Int_t nvars=9;
51  SetNVars(nvars);
52  TString varNames[9]={"inv. mass [GeV]",
53  "dca [cm]",
54  "Dist 2-trk Vtx to PrimVtx [cm]",
55  "Dist 3-trk Vtx to PrimVtx [cm]",
56  "Dist 4-trk Vtx to PrimVtx [cm]",
57  "cosThetaPoint",
58  "pt [GeV/c]",
59  "rho mass [GeV]",
60  "PID cut"};
61  Bool_t isUpperCut[9]={kTRUE,
62  kTRUE,
63  kFALSE,
64  kFALSE,
65  kFALSE,
66  kFALSE,
67  kFALSE,
68  kTRUE,
69  kFALSE};
70  SetVarNames(nvars,varNames,isUpperCut);
71  Bool_t forOpt[9]={kFALSE,
72  kTRUE,
73  kTRUE,
74  kTRUE,
75  kTRUE,
76  kTRUE,
77  kFALSE,
78  kFALSE,
79  kFALSE};
80  SetVarsForOpt(5,forOpt);
81  Float_t limits[2]={0,999999999.};
82  SetPtBins(2,limits);
83 }
84 //--------------------------------------------------------------------------
86  AliRDHFCuts(source)
87 {
88  //
89  // Copy constructor
90  //
91 
92 }
93 //--------------------------------------------------------------------------
95 {
96  //
97  // assignment operator
98  //
99  if(&source == this) return *this;
100 
101  AliRDHFCuts::operator=(source);
102 
103  return *this;
104 }
105 
106 
107 //---------------------------------------------------------------------------
109  //
110  // Fills in vars the values of the variables
111  //
112 
113  if(nvars!=fnVarsForOpt) {
114  printf("AliRDHFCutsD0toKpipipi::GetCutsVarsForOpt: wrong number of variables\n");
115  return;
116  }
117 
119 
120  //recalculate vertex w/o daughters
121  Bool_t cleanvtx=kFALSE;
122  AliAODVertex *origownvtx=0x0;
124  if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
125  cleanvtx=kTRUE;
126  if(!RecalcOwnPrimaryVtx(dd,aod)) {
127  CleanOwnPrimaryVtx(dd,aod,origownvtx);
128  cleanvtx=kFALSE;
129  }
130  }
131 
132  Int_t iter=-1;
133 
134  if(fVarsForOpt[0]) {
135  iter++;
136  Double_t mD0[2],mD0bar[2];
137  if(TMath::Abs(pdgdaughters[1])==321 || TMath::Abs(pdgdaughters[3])==321) {
138  dd->InvMassD0(mD0);
139  if(TMath::Abs(pdgdaughters[1])==321) {
140  vars[iter]=mD0[0];
141  }else{
142  vars[iter]=mD0[1];
143  }
144  } else {
145  dd->InvMassD0bar(mD0bar);
146  if(TMath::Abs(pdgdaughters[0])==321) {
147  vars[iter]=mD0bar[0];
148  }else{
149  vars[iter]=mD0bar[1];
150  }
151  }
152  }
153 
154  if(fVarsForOpt[1]){
155  iter++;
156  vars[iter]=dd->GetDCA();
157  }
158 
159  if(fVarsForOpt[2]){
160  iter++;
161  vars[iter]=dd->GetDist12toPrim();
162  }
163  if(fVarsForOpt[3]){
164  iter++;
165  vars[iter]=dd->GetDist3toPrim();
166  }
167  if(fVarsForOpt[4]){
168  iter++;
169  vars[iter]=dd->GetDist4toPrim();
170  }
171  if(fVarsForOpt[5]){
172  iter++;
173  vars[iter]=dd->CosPointingAngle();
174  }
175  if(fVarsForOpt[6]){
176  iter++;
177  vars[iter]=dd->Pt();
178  }
179  if(fVarsForOpt[7]){
180  iter++;
181  vars[iter]=999999999.;
182  printf("ERROR: optmization for rho mass cut not implemented\n");
183  }
184  if(fVarsForOpt[8]){
185  iter++;
186  vars[iter]=999999999.;
187  printf("ERROR: optmization for PID cut not implemented\n");
188  }
189 
190  if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
191  return;
192 }
193 //---------------------------------------------------------------------------
195  //
196  // Apply selection
197  //
198 
199  if(!fCutsRD){
200  cout<<"Cut matrix not inizialized. Exit..."<<endl;
201  return 0;
202  }
203  //PrintAll();
205 
206  if(!d){
207  cout<<"AliAODRecoDecayHF4Prong null"<<endl;
208  return 0;
209  }
210 
211  Double_t ptD=d->Pt();
212  if(ptD<fMinPtCand) return 0;
213  if(ptD>fMaxPtCand) return 0;
214 
216 
217  // selection on daughter tracks
218  if(selectionLevel==AliRDHFCuts::kAll ||
219  selectionLevel==AliRDHFCuts::kTracks) {
220  if(!AreDaughtersSelected(d,aod)) return 0;
221  }
222 
223 
224  Int_t returnvalue=1;
225 
226  // selection on candidate
227  if(selectionLevel==AliRDHFCuts::kAll ||
228  selectionLevel==AliRDHFCuts::kCandidate) {
229 
230  Int_t ptbin=PtBin(d->Pt());
231 
232  Int_t okD0=1,okD0bar=1;
233  Double_t mD0[2],mD0bar[2];
234  Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
235 
236  d->InvMassD0(mD0);
237  if(TMath::Abs(mD0[0]-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)] &&
238  TMath::Abs(mD0[1]-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
239  d->InvMassD0bar(mD0bar);
240  if(TMath::Abs(mD0bar[0]-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)] &&
241  TMath::Abs(mD0bar[1]-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
242  if(!okD0 && !okD0bar) return 0;
243 
244  if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]
245  || d->GetDCA(3) > fCutsRD[GetGlobalIndex(1,ptbin)]
246  || d->GetDCA(2) > fCutsRD[GetGlobalIndex(1,ptbin)]
247  || d->GetDCA(5) > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
248  if(d->GetDist12toPrim() < fCutsRD[GetGlobalIndex(2,ptbin)]) return 0;
249  if(d->GetDist3toPrim() < fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;
250  if(d->GetDist4toPrim() < fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;
251  if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
252  if(d->Pt() < fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
253  if(!d->CutRhoMass(mD0,mD0bar,fCutsRD[GetGlobalIndex(0,ptbin)],fCutsRD[GetGlobalIndex(7,ptbin)])) return 0;
254 
255  if (okD0) returnvalue=1; //cuts passed as D0
256  if (okD0bar) returnvalue=2; //cuts passed as D0bar
257  if (okD0 && okD0bar) returnvalue=3; //cuts passed as D0 and D0bar
258  }
259 
260  // selection on PID (from AliAODPidHF)
261  if(selectionLevel==AliRDHFCuts::kAll ||
262  selectionLevel==AliRDHFCuts::kPID) {
263 
268 
269  Int_t d01PID = 0, d02PID = 0, d0bar1PID = 0, d0bar2PID = 0;
270  returnvalue = IsSelectedFromPID(d, &d01PID, &d02PID, &d0bar1PID, &d0bar2PID); //This returnvalue is dummy! Now it's modified as it must be!
271 
272 returnvalue = 0;
273 
274  if((selD01 == 1 && d01PID == 1)||(selD02 == 1 && d02PID == 1)||(selD0bar1 == 1 && d0bar1PID == 1)||(selD0bar2 == 1 && d0bar2PID == 1)) returnvalue = 1;
275  }
276 
277  return returnvalue;
278 }
279 
280 //---------------------------------------------------------------------------
282  //
283  // Apply selection (using AliAODPidHF methods)
284  // Mass hypothesis true if each particle is at least compatible with specie of hypothesis
285  //
286 
287  Int_t output=0;
288 
289  Int_t matchK[4], matchPi[4];
290  Double_t ptlimit[2] = {0.6,0.8};
291  AliAODTrack* trk[4];
292  trk[0] = (AliAODTrack*)d->GetDaughter(0);
293  trk[1] = (AliAODTrack*)d->GetDaughter(1);
294  trk[2] = (AliAODTrack*)d->GetDaughter(2);
295  trk[3] = (AliAODTrack*)d->GetDaughter(3);
296 // if(!trk[0] || !trk[1] || !trk[2] || !trk[3]) { //REMOVED (needs also AliAODEvent to be passed, here and in IsSelected method)
297 // trk[0]=aodIn->GetTrack(trkIDtoEntry[d->GetProngID(0)]);
298 // trk[1]=aodIn->GetTrack(trkIDtoEntry[d->GetProngID(1)]);
299 // trk[2]=aodIn->GetTrack(trkIDtoEntry[d->GetProngID(2)]);
300 // trk[3]=aodIn->GetTrack(trkIDtoEntry[d->GetProngID(3)]);}
301 
302  AliAODPidHF* pidObj = new AliAODPidHF();
303  pidObj->SetAsym(kTRUE);
304  pidObj->SetPLimit(ptlimit,2);
305  pidObj->SetSigma(0,2.); //TPC sigma, in three pT ranges
306  pidObj->SetSigma(1,1.);
307  pidObj->SetSigma(2,0.);
308  pidObj->SetSigma(3,2.); //TOF sigma, whole pT range
309  pidObj->SetTPC(kTRUE);
310  pidObj->SetTOF(kTRUE);
311  pidObj->SetMatch(1);
312  pidObj->SetCompat(kTRUE);
313  for(Int_t ii=0; ii<4; ii++) {
314  pidObj->SetSigma(0,2.);
315  matchK[ii] = pidObj->MatchTPCTOF(trk[ii],3); //arguments: track, mode, particle#, compatibility allowed
316  pidObj->SetSigma(0,2.);
317  matchPi[ii] = pidObj->MatchTPCTOF(trk[ii],2);
318  }
319 
320  //Rho invariant mass under various hypotheses (to be matched with PID infos in order to accet the candidate)
321  Int_t d01rho03 = 0, d01rho23 = 0, d02rho01 = 0, d02rho12 = 0, d0bar1rho12 = 0, d0bar1rho23 = 0, d0bar2rho01 = 0, d0bar2rho03 = 0;
322  if(TMath::Abs(0.775 - d->InvMassRho(0,3))<0.1) {d01rho03 = 1; d0bar2rho03 = 1;}
323  if(TMath::Abs(0.775 - d->InvMassRho(2,3))<0.1) {d01rho23 = 1; d0bar1rho23 = 1;}
324  if(TMath::Abs(0.775 - d->InvMassRho(0,1))<0.1) {d02rho01 = 1; d0bar2rho01 = 1;}
325  if(TMath::Abs(0.775 - d->InvMassRho(1,2))<0.1) {d02rho12 = 1; d0bar1rho12 = 1;}
326  Int_t d01rho = 0, d02rho = 0, d0bar1rho = 0, d0bar2rho = 0;
327  if(d01rho03==1||d01rho23==1) d01rho = 1;
328  if(d02rho01==1||d02rho12==1) d02rho = 1;
329  if(d0bar1rho12==1||d0bar1rho23==1) d0bar1rho = 1;
330  if(d0bar2rho01==1||d0bar2rho03==1) d0bar2rho = 1;
331 
332  //This way because there could be multiple hypotheses accepted
333  if(d01rho==1 && (matchK[1]>=0 && matchPi[0]>=0 && matchPi[2]>=0 && matchPi[3]>=0)) {*hyp1 = 1; output = 1;} //d01 hyp
334  if(d02rho==1 && (matchK[3]>=0 && matchPi[0]>=0 && matchPi[1]>=0 && matchPi[2]>=0)) {*hyp2 = 1; output = 1;} //d02 hyp
335  if(d0bar1rho==1 && (matchK[0]>=0 && matchPi[1]>=0 && matchPi[2]>=0 && matchPi[3]>=0)) {*hyp3 = 1; output = 1;} //d0bar1 hyp
336  if(d0bar2rho==1 && (matchK[2]>=0 && matchPi[0]>=0 && matchPi[1]>=0 && matchPi[3]>=0)) {*hyp4 = 1; output = 1;} //d0bar2 hyp
337 
338  return output;
339 }
340 //---------------------------------------------------------------------------
342  //
343  // Apply selection
344  //
345 
346  if(!fCutsRD){
347  cout<<"Cut matrix not inizialized. Exit..."<<endl;
348  return 0;
349  }
350  //PrintAll();
352 
353  if(!d){
354  cout<<"AliAODRecoDecayHF4Prong null"<<endl;
355  return 0;
356  }
357 
358  Int_t returnvalue=0;
359 
360  // selection on candidate
361  if(selectionLevel==AliRDHFCuts::kAll ||
362  selectionLevel==AliRDHFCuts::kCandidate) {
363 
364  Int_t ptbin=PtBin(d->Pt());
365 
366  Double_t mD0[2];
367  Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
368 
369  d->InvMassD0(mD0);
370  if(TMath::Abs(mD0[0]-mD0PDG) < fCutsRD[GetGlobalIndex(0,ptbin)]) returnvalue = 1;
371  }
372 
373  return returnvalue;
374 }
375 //---------------------------------------------------------------------------
377  //
378  // Apply selection
379  //
380 
381  if(!fCutsRD){
382  cout<<"Cut matrix not inizialized. Exit..."<<endl;
383  return 0;
384  }
385  //PrintAll();
387 
388  if(!d){
389  cout<<"AliAODRecoDecayHF4Prong null"<<endl;
390  return 0;
391  }
392 
393  Int_t returnvalue=0;
394 
395  // selection on candidate
396  if(selectionLevel==AliRDHFCuts::kAll ||
397  selectionLevel==AliRDHFCuts::kCandidate) {
398 
399  Int_t ptbin=PtBin(d->Pt());
400 
401  Double_t mD0[2];
402  Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
403 
404  d->InvMassD0(mD0);
405  if(TMath::Abs(mD0[1]-mD0PDG) < fCutsRD[GetGlobalIndex(0,ptbin)]) returnvalue = 1;
406  }
407 
408  return returnvalue;
409 }//---------------------------------------------------------------------------
411  //
412  // Apply selection
413  //
414 
415  if(!fCutsRD){
416  cout<<"Cut matrix not inizialized. Exit..."<<endl;
417  return 0;
418  }
419  //PrintAll();
421 
422  if(!d){
423  cout<<"AliAODRecoDecayHF4Prong null"<<endl;
424  return 0;
425  }
426 
427  Int_t returnvalue=0;
428 
429  // selection on candidate
430  if(selectionLevel==AliRDHFCuts::kAll ||
431  selectionLevel==AliRDHFCuts::kCandidate) {
432 
433  Int_t ptbin=PtBin(d->Pt());
434 
435  Double_t mD0bar[2];
436  Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
437 
438  d->InvMassD0bar(mD0bar);
439  if(TMath::Abs(mD0bar[0]-mD0PDG) < fCutsRD[GetGlobalIndex(0,ptbin)]) returnvalue = 1;
440  }
441 
442  return returnvalue;
443 }
444 //---------------------------------------------------------------------------
446  //
447  // Apply selection
448  //
449 
450  if(!fCutsRD){
451  cout<<"Cut matrix not inizialized. Exit..."<<endl;
452  return 0;
453  }
454  //PrintAll();
456 
457  if(!d){
458  cout<<"AliAODRecoDecayHF4Prong null"<<endl;
459  return 0;
460  }
461 
462  Int_t returnvalue=0;
463 
464  // selection on candidate
465  if(selectionLevel==AliRDHFCuts::kAll ||
466  selectionLevel==AliRDHFCuts::kCandidate) {
467 
468  Int_t ptbin=PtBin(d->Pt());
469 
470  Double_t mD0bar[2];
471  Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
472 
473  d->InvMassD0bar(mD0bar);
474  if(TMath::Abs(mD0bar[1]-mD0PDG) < fCutsRD[GetGlobalIndex(0,ptbin)]) returnvalue = 1;
475  }
476 
477  return returnvalue;
478 }
479 //---------------------------------------------------------------------------
481 {
482  //
483  // Checking if D0 is in fiducial acceptance region
484  //
485 
486  if(fMaxRapidityCand>-998.){
487  if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
488  else return kTRUE;
489  }
490 
491  if(pt > 5.) {
492  // applying cut for pt > 5 GeV
493  AliDebug(4,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
494  if (TMath::Abs(y) > 0.8){
495  return kFALSE;
496  }
497  } else {
498  // appliying smooth cut for pt < 5 GeV
499  Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
500  Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
501  AliDebug(4,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
502  if (y < minFiducialY || y > maxFiducialY){
503  return kFALSE;
504  }
505  }
506 
507  return kTRUE;
508 }
509 
void SetAsym(Bool_t asym)
Definition: AliAODPidHF.h:88
double Double_t
Definition: External.C:58
virtual Int_t D01Selected(TObject *obj, Int_t selectionLevel)
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:408
virtual Int_t IsSelectedFromPID(AliAODRecoDecayHF4Prong *d, Int_t *hyp1, Int_t *hyp2, Int_t *hyp3, Int_t *hyp4)
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:376
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:427
virtual Int_t D0bar1Selected(TObject *obj, Int_t selectionLevel)
AliRDHFCuts & operator=(const AliRDHFCuts &source)
AliRDHFCutsD0toKpipipi & operator=(const AliRDHFCutsD0toKpipipi &source)
Double_t InvMassRho(Int_t i, Int_t j) const
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:95
Bool_t HasBadDaughters() const
void InvMassD0(Double_t mD0[2]) const
Bool_t CutRhoMass(Double_t massD0[2], Double_t massD0bar[2], Double_t CutMass, Double_t CutRho) const
virtual Int_t D02Selected(TObject *obj, Int_t selectionLevel)
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:437
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:398
float Float_t
Definition: External.C:68
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:426
AliAODVertex * GetOwnPrimaryVtx() const
void InvMassD0bar(Double_t mD0bar[2]) const
Int_t MatchTPCTOF(AliAODTrack *track, Int_t specie)
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:39
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:401
virtual Int_t D0bar2Selected(TObject *obj, Int_t selectionLevel)
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Bool_t * fVarsForOpt
number of cut vars to be optimized for candidates
Definition: AliRDHFCuts.h:399
Bool_t AreDaughtersSelected(AliAODRecoDecayHF *rd, const AliAODEvent *aod=0x0) const
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
void CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const
AliRDHFCutsD0toKpipipi(const char *name="CutsD0toKpipipi")
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
void SetMatch(Int_t match)
Definition: AliAODPidHF.h:98
void SetPLimit(Double_t *plim, Int_t npLim)
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:94
bool Bool_t
Definition: External.C:53
Double_t CosPointingAngle() const
void SetCompat(Bool_t comp)
Definition: AliAODPidHF.h:100
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Int_t PtBin(Double_t pt) const
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:425
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)