]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliRDHFCutsDstoKKpi.cxx
Added method to recalculate the primary vertex without the daughter tracks
[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     Double_t mPDGPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
208     if(TMath::Abs(pdgdaughters[0]==321)){
209       
210       Double_t phimass01=d->InvMass2Prongs(0,1,321,321);
211        vars[iter]=TMath::Abs(phimass01-mPDGPhi);
212        // vars[iter]=dd->InvMass2Prongs(0,1,321,321);
213     }else{
214       Double_t phimass12=d->InvMass2Prongs(1,2,321,321);
215        vars[iter]=TMath::Abs(phimass12-mPDGPhi);
216        // vars[iter]=dd->InvMass2Prongs(1,2,321,321);      
217     }
218   }
219   if(fVarsForOpt[13]){
220     iter++;
221     Double_t mPDGK0star = TDatabasePDG::Instance()->GetParticle(313)->Mass();
222     if(TMath::Abs(pdgdaughters[0]==321)){
223       
224       Double_t mass12kpi=d->InvMass2Prongs(1,2,321,211);
225       vars[iter]=TMath::Abs(mass12kpi-mPDGK0star);
226       //              vars[iter]=dd->InvMass2Prongs(1,2,321,211);
227     }else{
228       Double_t mass01pik=d->InvMass2Prongs(0,1,211,321);
229       vars[iter]=TMath::Abs(mass01pik-mPDGK0star);
230       //        vars[iter]=dd->InvMass2Prongs(0,1,211,321);      
231     }
232   }
233
234   
235   return;
236 }
237 //---------------------------------------------------------------------------
238 Int_t AliRDHFCutsDstoKKpi::IsSelected(TObject* obj,Int_t selectionLevel) {
239   //
240   // Apply selection
241   //
242
243   if(!fCutsRD){
244     cout<<"Cut matrice not inizialized. Exit..."<<endl;
245     return 0;
246   }
247   //PrintAll();
248   AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
249
250   if(!d){
251     cout<<"AliAODRecoDecayHF3Prong null"<<endl;
252     return 0;
253   }
254
255
256   // selection on daughter tracks 
257   if(selectionLevel==AliRDHFCuts::kAll || 
258      selectionLevel==AliRDHFCuts::kTracks) {
259     if(!AreDaughtersSelected(d)) return 0;
260   }
261
262
263
264   Int_t returnvalue=1;
265   // selection on candidate
266   if(selectionLevel==AliRDHFCuts::kAll || 
267      selectionLevel==AliRDHFCuts::kCandidate) {
268     
269
270     Int_t okDsKKpi=1;
271     Int_t okDspiKK=1;
272     Int_t okMassPhi=0;
273     Int_t okMassK0star=0;
274
275     Double_t pt=d->Pt();
276     Int_t ptbin=PtBin(pt);
277
278     Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
279     Double_t mDsKKpi=d->InvMassDsKKpi();
280     Double_t mDspiKK=d->InvMassDspiKK();
281     if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
282     if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
283     if(!okDsKKpi && !okDspiKK) return 0;
284
285     //single track
286     if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || 
287        TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;
288     if(okDsKKpi){
289       if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(1,ptbin)] || 
290          TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
291       if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] || 
292          TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
293     }
294     if(okDspiKK){
295       if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] || 
296          TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
297       if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(1,ptbin)] || 
298          TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
299     }
300     if(!okDsKKpi && !okDspiKK) return 0;
301
302     // cuts on resonant decays (via Phi or K0*)
303     Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
304     Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
305     if(okDsKKpi){
306       Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
307       Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
308       if(TMath::Abs(mass01phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
309       if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
310       if(!okMassPhi && !okMassK0star) okDsKKpi=0;
311     }
312     if(okDspiKK){
313       Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
314       Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
315       if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
316       if(TMath::Abs(mass12phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
317       if(!okMassPhi && !okMassK0star) okDspiKK=0;
318     }
319     if(!okDsKKpi && !okDspiKK) return 0;
320
321     // Cuts on track pairs
322     for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)])  return 0;
323     if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] || 
324        d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
325
326
327     // Cuts on candidate triplet
328     if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
329     if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
330     if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && 
331        TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && 
332        TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
333     if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])return 0;
334     Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
335     if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])return 0;
336
337     returnvalue=0;
338     if(okDsKKpi) returnvalue+=1;
339     if(okDspiKK) returnvalue+=2;
340     if(okMassPhi) returnvalue+=4;
341     if(okMassK0star) returnvalue+=8;
342
343   }
344   return returnvalue;
345
346 }
347 //---------------------------------------------------------------------------