]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliRDHFCutsDstoKKpi.cxx
New class for PID of HF candidates (R. Romita)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsDstoKKpi.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 /////////////////////////////////////////////////////////////
17 //
18 // Class for cuts on AOD reconstructed Ds->KKpi
19 //
20 // Author: A.Dainese, andrea.dainese@pd.infn.it
21 /////////////////////////////////////////////////////////////
22
23 #include <TDatabasePDG.h>
24 #include <Riostream.h>
25
26 #include "AliRDHFCutsDstoKKpi.h"
27 #include "AliAODRecoDecayHF3Prong.h"
28 #include "AliAODTrack.h"
29 #include "AliESDtrack.h"
30
31 ClassImp(AliRDHFCutsDstoKKpi)
32
33 //--------------------------------------------------------------------------
34 AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const char* name) : 
35 AliRDHFCuts(name)
36 {
37   //
38   // Default Constructor
39   //
40   Int_t nvars=14;
41   SetNVars(nvars);
42   TString varNames[14]={"inv. mass [GeV]",   
43                         "pTK [GeV/c]",
44                         "pTPi [GeV/c]",
45                         "d0K [cm]",
46                         "d0Pi [cm]",
47                         "dist12 [cm]",
48                         "sigmavert [cm]",
49                         "decLen [cm]",
50                         "ptMax [GeV/c]",
51                         "cosThetaPoint",
52                         "Sum d0^2 (cm^2)",
53                         "dca [cm]",
54                         "inv. mass (Mphi-MKK) [GeV]",
55                         "inv. mass (MKo*-MKpi) [GeV]"};
56   Bool_t isUpperCut[14]={kTRUE,
57                          kFALSE,
58                          kFALSE,
59                          kFALSE,
60                          kFALSE,
61                          kFALSE,
62                          kTRUE,
63                          kFALSE,
64                          kFALSE,
65                          kFALSE,
66                          kFALSE,
67                          kTRUE,
68                          kTRUE,
69                          kTRUE};
70   SetVarNames(14,varNames,isUpperCut);
71   Bool_t forOpt[14]={kFALSE,
72                     kFALSE,
73                     kFALSE,
74                     kFALSE,
75                     kFALSE,
76                     kFALSE,
77                     kTRUE,
78                     kTRUE,
79                     kTRUE,
80                     kTRUE,
81                     kTRUE,
82                     kFALSE,
83                     kTRUE,
84                     kTRUE};
85   SetVarsForOpt(7,forOpt);
86   Float_t limits[2]={0,999999999.};
87   SetPtBins(2,limits);
88 }
89 //--------------------------------------------------------------------------
90 AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const AliRDHFCutsDstoKKpi &source) :
91   AliRDHFCuts(source)
92 {
93   //
94   // Copy constructor
95   //
96
97 }
98 //--------------------------------------------------------------------------
99 AliRDHFCutsDstoKKpi &AliRDHFCutsDstoKKpi::operator=(const AliRDHFCutsDstoKKpi &source)
100 {
101   //
102   // assignment operator
103   //
104   if(&source == this) return *this;
105
106   AliRDHFCuts::operator=(source);
107
108   return *this;
109 }
110
111
112 //---------------------------------------------------------------------------
113 void AliRDHFCutsDstoKKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
114   // 
115   // Fills in vars the values of the variables 
116   //
117
118   if(nvars!=fnVarsForOpt) {
119     printf("AliRDHFCutsDstoKKpi::GetCutsVarsForOpt: wrong number of variables\n");
120     return;
121   }
122
123   AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
124  
125   Int_t iter=-1;
126   if(fVarsForOpt[0]){
127     iter++;
128     if(TMath::Abs(pdgdaughters[0]==321)){
129       vars[iter]=dd->InvMassDsKKpi();
130     }else{
131       vars[iter]=dd->InvMassDspiKK();
132     }
133   }
134   if(fVarsForOpt[1]){
135     iter++;
136     Float_t minPtDau=99999.;
137     for(Int_t iprong=0;iprong<3;iprong++){
138       if(TMath::Abs(pdgdaughters[iprong])==321 && 
139          dd->PtProng(iprong)<minPtDau) minPtDau=dd->PtProng(iprong);
140     }
141     vars[iter]=minPtDau;
142   }
143   if(fVarsForOpt[2]){
144     iter++;
145     for(Int_t iprong=0;iprong<3;iprong++){
146       if(TMath::Abs(pdgdaughters[iprong])==211) {
147         vars[iter]=dd->PtProng(iprong);
148       }
149     }
150   }
151   if(fVarsForOpt[3]){
152     iter++;
153     Float_t minImpParDau=99999.;
154     for(Int_t iprong=0;iprong<3;iprong++){
155       if(TMath::Abs(pdgdaughters[iprong])==321 &&
156          dd->Getd0Prong(iprong)<minImpParDau) minImpParDau=dd->Getd0Prong(iprong);
157     }
158     vars[iter]=minImpParDau;
159   }
160   if(fVarsForOpt[4]){
161     iter++;
162     for(Int_t iprong=0;iprong<3;iprong++){
163       if(TMath::Abs(pdgdaughters[iprong])==211) {
164         vars[iter]=dd->Getd0Prong(iprong);
165       }
166     }
167   }
168   if(fVarsForOpt[5]){
169     iter++;
170     Float_t minDistPair=TMath::Min(dd->GetDist12toPrim(),dd->GetDist23toPrim());
171     vars[iter]=minDistPair;
172   }
173   if(fVarsForOpt[6]){
174     iter++;
175     vars[iter]=dd->GetSigmaVert();
176   }
177   if(fVarsForOpt[7]){
178     iter++;
179     vars[iter] = dd->DecayLength();
180   }
181   if(fVarsForOpt[8]){
182     iter++;
183     Float_t ptmax=0;
184     for(Int_t i=0;i<3;i++){
185       if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
186     }
187     vars[iter]=ptmax;
188   }
189   if(fVarsForOpt[9]){
190     iter++;
191     vars[iter]=dd->CosPointingAngle();
192   }
193   if(fVarsForOpt[10]){
194     iter++;
195     vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
196   }
197   if(fVarsForOpt[11]){
198     iter++;
199     Float_t maxDCA=0.;
200     for(Int_t i=0;i<3;i++){ 
201       if(d->GetDCA(i)>maxDCA) maxDCA=d->GetDCA(i);
202     }
203     vars[iter]=maxDCA;
204   }
205   if(fVarsForOpt[12]){
206     iter++;
207     if(TMath::Abs(pdgdaughters[0]==321)){
208       vars[iter]=dd->InvMass2Prongs(0,1,321,321);
209     }else{
210       vars[iter]=dd->InvMass2Prongs(1,2,321,321);      
211     }
212   }
213   if(fVarsForOpt[13]){
214     iter++;
215     if(TMath::Abs(pdgdaughters[0]==321)){
216       vars[iter]=dd->InvMass2Prongs(1,2,321,211);
217     }else{
218       vars[iter]=dd->InvMass2Prongs(0,1,211,321);      
219     }
220   }
221
222   
223   return;
224 }
225 //---------------------------------------------------------------------------
226 Int_t AliRDHFCutsDstoKKpi::IsSelected(TObject* obj,Int_t selectionLevel) {
227   //
228   // Apply selection
229   //
230
231   if(!fCutsRD){
232     cout<<"Cut matrice not inizialized. Exit..."<<endl;
233     return 0;
234   }
235   //PrintAll();
236   AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
237
238   if(!d){
239     cout<<"AliAODRecoDecayHF3Prong null"<<endl;
240     return 0;
241   }
242
243
244   // selection on daughter tracks 
245   if(selectionLevel==AliRDHFCuts::kAll || 
246      selectionLevel==AliRDHFCuts::kTracks) {
247     if(!AreDaughtersSelected(d)) return 0;
248   }
249
250
251
252   Int_t returnvalue=1;
253   // selection on candidate
254   if(selectionLevel==AliRDHFCuts::kAll || 
255      selectionLevel==AliRDHFCuts::kCandidate) {
256     
257
258     Int_t okDsKKpi=1;
259     Int_t okDspiKK=1;
260     Int_t okMassPhi=0;
261     Int_t okMassK0star=0;
262
263     Double_t pt=d->Pt();
264     Int_t ptbin=PtBin(pt);
265
266     Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
267     Double_t mDsKKpi=d->InvMassDsKKpi();
268     Double_t mDspiKK=d->InvMassDspiKK();
269     if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
270     if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
271     if(!okDsKKpi && !okDspiKK) return 0;
272
273     //single track
274     if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || 
275        TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;
276     if(okDsKKpi){
277       if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(1,ptbin)] || 
278          TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
279       if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] || 
280          TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
281     }
282     if(okDspiKK){
283       if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] || 
284          TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
285       if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(1,ptbin)] || 
286          TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
287     }
288     if(!okDsKKpi && !okDspiKK) return 0;
289
290     // cuts on resonant decays (via Phi or K0*)
291     Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
292     Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
293     if(okDsKKpi){
294       Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
295       Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
296       if(TMath::Abs(mass01phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
297       if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
298       if(!okMassPhi && !okMassK0star) okDsKKpi=0;
299     }
300     if(okDspiKK){
301       Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
302       Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
303       if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
304       if(TMath::Abs(mass12phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
305       if(!okMassPhi && !okMassK0star) okDspiKK=0;
306     }
307     if(!okDsKKpi && !okDspiKK) return 0;
308
309     // Cuts on track pairs
310     for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)])  return 0;
311     if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] || 
312        d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
313
314
315     // Cuts on candidate triplet
316     if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
317     if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
318     if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && 
319        TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && 
320        TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
321     if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])return 0;
322     Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
323     if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])return 0;
324
325     returnvalue=0;
326     if(okDsKKpi) returnvalue+=1;
327     if(okDspiKK) returnvalue+=2;
328     if(okMassPhi) returnvalue+=4;
329     if(okMassK0star) returnvalue+=8;
330
331   }
332   return returnvalue;
333
334 }
335 //---------------------------------------------------------------------------