]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliRDHFCutsDplustoKpipi.cxx
Merged tasks DStar and DStarSpectra (Alessandro, Yifei)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsDplustoKpipi.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
16/////////////////////////////////////////////////////////////
17//
18// Class for cuts on AOD reconstructed D+->Kpipi
19//
20// Author: R. Bala, bala@to.infn.it
21// G. Ortona, ortona@to.infn.it
22/////////////////////////////////////////////////////////////
23
24#include <TDatabasePDG.h>
25#include <Riostream.h>
26
27#include "AliRDHFCutsDplustoKpipi.h"
28#include "AliAODRecoDecayHF3Prong.h"
29#include "AliAODTrack.h"
30#include "AliESDtrack.h"
31
32ClassImp(AliRDHFCutsDplustoKpipi)
33
34//--------------------------------------------------------------------------
a9b75906 35AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const char* name) :
36 AliRDHFCuts(name)
e3d40058 37{
38 //
39 // Default Constructor
40 //
41 Int_t nvars=12;
42 SetNVars(nvars);
43 TString varNames[12]={"inv. mass [GeV]",
44 "pTK [GeV/c]",
45 "pTPi [GeV/c]",
46 "d0K [cm] lower limit!",
47 "d0Pi [cm] lower limit!",
48 "dist12 (cm)",
49 "sigmavert (cm)",
50 "dist prim-sec (cm)",
51 "pM=Max{pT1,pT2,pT3} (GeV/c)",
52 "cosThetaPoint",
53 "Sum d0^2 (cm^2)",
54 "dca cut (cm)"};
55 Bool_t isUpperCut[12]={kTRUE,
56 kFALSE,
57 kFALSE,
58 kFALSE,
59 kFALSE,
60 kFALSE,
61 kTRUE,
62 kFALSE,
63 kFALSE,
64 kFALSE,
65 kFALSE,
66 kTRUE};
67 SetVarNames(nvars,varNames,isUpperCut);
4755453e 68 Bool_t forOpt[12]={kFALSE,
e3d40058 69 kFALSE,
70 kFALSE,
71 kFALSE,
72 kFALSE,
73 kFALSE,
74 kTRUE,
75 kTRUE,
76 kTRUE,
77 kTRUE,
78 kTRUE,
79 kFALSE};
4755453e 80 SetVarsForOpt(5,forOpt);
e3d40058 81 Float_t limits[2]={0,999999999.};
82 SetPtBins(2,limits);
83}
84//--------------------------------------------------------------------------
85AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const AliRDHFCutsDplustoKpipi &source) :
86 AliRDHFCuts(source)
87{
88 //
89 // Copy constructor
90 //
91
92}
93//--------------------------------------------------------------------------
94AliRDHFCutsDplustoKpipi &AliRDHFCutsDplustoKpipi::operator=(const AliRDHFCutsDplustoKpipi &source)
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//---------------------------------------------------------------------------
108void AliRDHFCutsDplustoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
109 //
110 // Fills in vars the values of the variables
111 //
112
113
114 if(nvars!=fnVarsForOpt) {
115 printf("AliRDHFCutsDplustoKpipi::GetCutsVarsForOpt: wrong number of variables\n");
116 return;
117 }
118
119 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
e3d40058 120
e3d40058 121 Int_t iter=-1;
122 if(fVarsForOpt[0]){
123 iter++;
124 vars[iter]=dd->InvMassDplus();
125 }
126 if(fVarsForOpt[1]){
127 iter++;
128 for(Int_t iprong=0;iprong<3;iprong++){
129 if(TMath::Abs(pdgdaughters[iprong])==321) {
130 vars[iter]=dd->PtProng(iprong);
131 }
132 }
133 }
134 if(fVarsForOpt[2]){
135 iter++;
4755453e 136 Float_t minPtDau=1000000.0;
e3d40058 137 for(Int_t iprong=0;iprong<3;iprong++){
138 if(TMath::Abs(pdgdaughters[iprong])==211) {
4755453e 139 if(dd->PtProng(iprong)<minPtDau){
140 minPtDau=dd->PtProng(iprong);
141 }
e3d40058 142 }
143 }
4755453e 144 vars[iter]=minPtDau;
e3d40058 145 }
146 if(fVarsForOpt[3]){
147 iter++;
148 for(Int_t iprong=0;iprong<3;iprong++){
149 if(TMath::Abs(pdgdaughters[iprong])==321) {
150 vars[iter]=dd->Getd0Prong(iprong);
151 }
152 }
153 }
154 if(fVarsForOpt[4]){
155 iter++;
4755453e 156 Float_t minImpParDau=1000000.0;
e3d40058 157 for(Int_t iprong=0;iprong<3;iprong++){
158 if(TMath::Abs(pdgdaughters[iprong])==211) {
4755453e 159 if(dd->Getd0Prong(iprong)<minImpParDau){
160 minImpParDau=dd->Getd0Prong(iprong);
161 }
e3d40058 162 }
163 }
4755453e 164 vars[iter]=minImpParDau;
e3d40058 165 }
166 if(fVarsForOpt[5]){
167 iter++;
4755453e 168 Float_t dist12 = dd->GetDist12toPrim();
169 Float_t dist23 = dd->GetDist23toPrim();
170 if(dist12<dist23)vars[iter]=dist12;
171 else vars[iter]=dist23;
e3d40058 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++;
4755453e 199 Float_t maxDCA=0;
200 for(Int_t iprong=0;iprong<3;iprong++){
201 if(dd->GetDCA(iprong)<maxDCA){
202 maxDCA=dd->GetDCA(iprong);
203 }
204 }
205 vars[iter]=maxDCA;
e3d40058 206 }
207 return;
208}
209//---------------------------------------------------------------------------
210Int_t AliRDHFCutsDplustoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
211 //
212 // Apply selection
213 //
214
215 if(!fCutsRD){
4755453e 216 cout<<"Cut matrix not inizialized. Exit..."<<endl;
e3d40058 217 return 0;
218 }
219 //PrintAll();
220 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
221
222
223 if(!d){
224 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
225 return 0;
226 }
227
228
229
230 // selection on daughter tracks
231 if(selectionLevel==AliRDHFCuts::kAll ||
232 selectionLevel==AliRDHFCuts::kTracks) {
233 if(!AreDaughtersSelected(d)) return 0;
234 }
235
236 // selection on candidate
237 if(selectionLevel==AliRDHFCuts::kAll ||
238 selectionLevel==AliRDHFCuts::kCandidate) {
239
240 Double_t pt=d->Pt();
4755453e 241
e3d40058 242 Int_t ptbin=PtBin(pt);
4755453e 243
e3d40058 244 Double_t mDplusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
245 Double_t mDplus=d->InvMassDplus();
246 if(TMath::Abs(mDplus-mDplusPDG)>fCutsRD[GetGlobalIndex(0,ptbin)])return 0;
247 // if(d->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
248 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)])return 0;//Kaon
249 if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)])return 0;//Pion1
250 if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)])return 0;//Pion2
251
252
253
4755453e 254 //2track cuts
255 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)])return 0;
256 if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.)return 0;
e3d40058 257
4755453e 258 //sec vert
259 if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)])return 0;
260
261 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)])return 0;
262
263 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;
264 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])return 0;
265 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
266 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])return 0;
267
268 //DCA
269 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
270
271 return 1;
e3d40058 272 }
273 return 1;
274}
275//---------------------------------------------------------------------------