]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliRDHFCutsLctopKpi.cxx
Update of task for D0 analysis (AndreaR)
[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 /////////////////////////////////////////////////////////////
17 //
18 // Class for cuts on AOD reconstructed Lc->pKpi
19 //
20 // Author: A.Dainese, andrea.dainese@pd.infn.it
21 /////////////////////////////////////////////////////////////
22
23 #include <TDatabasePDG.h>
24 #include <Riostream.h>
25
26 #include "AliRDHFCutsLctopKpi.h"
27 #include "AliAODRecoDecayHF3Prong.h"
28 #include "AliAODTrack.h"
29 #include "AliESDtrack.h"
30
31 ClassImp(AliRDHFCutsLctopKpi)
32
33 //--------------------------------------------------------------------------
34 AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const char* name) : 
35 AliRDHFCuts(name)
36 {
37   //
38   // Default Constructor
39   //
40   Int_t nvars=12;
41   SetNVars(nvars);
42   TString varNames[12]={"inv. mass [GeV]",
43                         "pTP [GeV/c]",
44                         "pTPi [GeV/c]",
45                         "d0P [cm]   lower limit!",
46                         "d0Pi [cm]  lower limit!",
47                         "dist12 (cm)",
48                         "sigmavert (cm)",
49                         "dist prim-sec (cm)",
50                         "pM=Max{pT1,pT2,pT3} (GeV/c)",
51                         "cosThetaPoint",
52                         "Sum d0^2 (cm^2)",
53                         "dca cut (cm)"};
54   Bool_t isUpperCut[12]={kTRUE,
55                          kFALSE,
56                          kFALSE,
57                          kFALSE,
58                          kFALSE,
59                          kFALSE,
60                          kTRUE,
61                          kFALSE,
62                          kFALSE,
63                          kFALSE,
64                          kFALSE,
65                          kTRUE};
66   SetVarNames(nvars,varNames,isUpperCut);
67   Bool_t forOpt[12]={kFALSE,
68                      kFALSE,
69                      kFALSE,
70                      kFALSE,
71                      kFALSE,
72                      kFALSE,
73                      kTRUE,
74                      kTRUE,
75                      kTRUE,
76                      kTRUE,
77                      kTRUE,
78                      kFALSE};
79   SetVarsForOpt(5,forOpt);
80   Float_t limits[2]={0,999999999.};
81   SetPtBins(2,limits);
82 }
83 //--------------------------------------------------------------------------
84 AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const AliRDHFCutsLctopKpi &source) :
85   AliRDHFCuts(source)
86 {
87   //
88   // Copy constructor
89   //
90
91 }
92 //--------------------------------------------------------------------------
93 AliRDHFCutsLctopKpi &AliRDHFCutsLctopKpi::operator=(const AliRDHFCutsLctopKpi &source)
94 {
95   //
96   // assignment operator
97   //
98   if(&source == this) return *this;
99
100   AliRDHFCuts::operator=(source);
101
102   return *this;
103 }
104
105
106 //---------------------------------------------------------------------------
107 void AliRDHFCutsLctopKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
108   // 
109   // Fills in vars the values of the variables 
110   //
111
112   if(nvars!=fnVarsForOpt) {
113     printf("AliRDHFCutsLctopKpi::GetCutsVarsForOpt: wrong number of variables\n");
114     return;
115   }
116
117   AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
118
119     Int_t iter=-1;
120   if(fVarsForOpt[0]){
121     iter++;
122     vars[iter]=dd->InvMassLcpKpi();
123   }
124   if(fVarsForOpt[1]){
125     iter++;
126     for(Int_t iprong=0;iprong<3;iprong++){
127       if(TMath::Abs(pdgdaughters[iprong])==2212) {
128         vars[iter]=dd->PtProng(iprong);
129       }
130     }
131   }
132   if(fVarsForOpt[2]){
133     iter++;
134     for(Int_t iprong=0;iprong<3;iprong++){
135       if(TMath::Abs(pdgdaughters[iprong])==211) {
136         vars[iter]=dd->PtProng(iprong);
137       }
138     }
139   }
140   if(fVarsForOpt[3]){
141     iter++;
142     for(Int_t iprong=0;iprong<3;iprong++){
143       if(TMath::Abs(pdgdaughters[iprong])==2212) {
144         vars[iter]=dd->Getd0Prong(iprong);
145       }
146     }
147   }
148   if(fVarsForOpt[4]){
149     iter++;
150     for(Int_t iprong=0;iprong<3;iprong++){
151       if(TMath::Abs(pdgdaughters[iprong])==211) {
152         vars[iter]=dd->Getd0Prong(iprong);
153       }
154     }
155   }
156   if(fVarsForOpt[5]){
157     iter++;
158     vars[iter]=dd->GetDist12toPrim();
159   }
160   if(fVarsForOpt[6]){
161     iter++;
162     vars[iter]=dd->GetSigmaVert();
163   }
164   if(fVarsForOpt[7]){
165     iter++;
166     vars[iter] = dd->DecayLength();
167   }
168   if(fVarsForOpt[8]){
169     iter++;
170     Float_t ptmax=0;
171     for(Int_t i=0;i<3;i++){
172       if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
173     }
174     vars[iter]=ptmax;
175   }
176   if(fVarsForOpt[9]){
177     iter++;
178     vars[iter]=dd->CosPointingAngle();
179   }
180   if(fVarsForOpt[10]){
181     iter++;
182     vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
183   }
184   if(fVarsForOpt[11]){
185     iter++;
186     vars[iter]=dd->GetDCA();
187   }
188
189   return;
190 }
191 //---------------------------------------------------------------------------
192 Int_t AliRDHFCutsLctopKpi::IsSelected(TObject* obj,Int_t selectionLevel) {
193   //
194   // Apply selection
195   //
196
197   if(!fCutsRD){
198     cout<<"Cut matrice not inizialized. Exit..."<<endl;
199     return 0;
200   }
201   //PrintAll();
202   AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
203
204   if(!d){
205     cout<<"AliAODRecoDecayHF3Prong null"<<endl;
206     return 0;
207   }
208
209
210   // selection on daughter tracks 
211   if(selectionLevel==AliRDHFCuts::kAll || 
212      selectionLevel==AliRDHFCuts::kTracks) {
213     if(!AreDaughtersSelected(d)) return 0;
214   }
215
216
217   Int_t returnvalue=1;
218
219   // selection on candidate
220   if(selectionLevel==AliRDHFCuts::kAll || 
221      selectionLevel==AliRDHFCuts::kCandidate) {
222
223     Double_t pt=d->Pt();
224     
225     Int_t ptbin=PtBin(pt);
226     
227     Double_t mLcpKpi,mLcpiKp;
228     Int_t okLcpKpi=1,okLcpiKp=1;
229
230     Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
231
232     mLcpKpi=d->InvMassLcpKpi();
233     mLcpiKp=d->InvMassLcpiKp();
234
235     if(TMath::Abs(mLcpKpi-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpKpi = 0;
236     if(TMath::Abs(mLcpiKp-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpiKp = 0;
237     if(!okLcpKpi && !okLcpiKp) return 0;
238
239     if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;//Kaon
240     if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;//Proton
241     if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;//Pion
242
243     
244
245     //2track cuts
246     if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
247     if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.) return 0;
248     
249     //sec vert
250     if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
251
252     if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
253     
254     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;
255     if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
256     Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
257     if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
258     
259     //DCA
260     for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
261
262
263     if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
264     if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
265     if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
266     
267   }
268
269   return returnvalue;
270 }
271 //---------------------------------------------------------------------------