New classes for the cuts on charm candidates
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsJpsitoee.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 Jpsi->ee
19//
20// Author: A.Dainese, andrea.dainese@pd.infn.it
21/////////////////////////////////////////////////////////////
22
23#include <TDatabasePDG.h>
24#include <Riostream.h>
25
26#include "AliRDHFCutsJpsitoee.h"
27#include "AliAODRecoDecayHF2Prong.h"
28#include "AliAODTrack.h"
29#include "AliESDtrack.h"
30
31ClassImp(AliRDHFCutsJpsitoee)
32
33//--------------------------------------------------------------------------
34AliRDHFCutsJpsitoee::AliRDHFCutsJpsitoee() :
35AliRDHFCuts()
36{
37 //
38 // Default Constructor
39 //
40 Int_t nvars=9;
41 SetNVars(nvars);
42 TString varNames[9]={"inv. mass [GeV]",
43 "dca [cm]",
44 "cosThetaStar", // negative electron
45 "pTP [GeV/c]",
46 "pTN [GeV/c]",
47 "d0P [cm]",
48 "d0N [cm]",
49 "d0d0 [cm^2]",
50 "cosThetaPoint"};
51 Bool_t isUpperCut[9]={kTRUE,
52 kTRUE,
53 kTRUE,
54 kFALSE,
55 kFALSE,
56 kTRUE,
57 kTRUE,
58 kTRUE,
59 kFALSE};
60 SetVarNames(nvars,varNames,isUpperCut);
61 Bool_t forOpt[9]={kFALSE,
62 kTRUE,
63 kTRUE,
64 kFALSE,
65 kFALSE,
66 kFALSE,
67 kFALSE,
68 kTRUE,
69 kTRUE};
70 SetVarsForOpt(4,forOpt);
71 Float_t limits[2]={0,999999999.};
72 SetPtBins(2,limits);
73}
74//--------------------------------------------------------------------------
75AliRDHFCutsJpsitoee::AliRDHFCutsJpsitoee(const AliRDHFCutsJpsitoee &source) :
76 AliRDHFCuts(source)
77{
78 //
79 // Copy constructor
80 //
81
82}
83//--------------------------------------------------------------------------
84AliRDHFCutsJpsitoee &AliRDHFCutsJpsitoee::operator=(const AliRDHFCutsJpsitoee &source)
85{
86 //
87 // assignment operator
88 //
89 if(&source == this) return *this;
90
91 AliRDHFCuts::operator=(source);
92
93 return *this;
94}
95
96
97//---------------------------------------------------------------------------
98void AliRDHFCutsJpsitoee::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
99 //
100 // Fills in vars the values of the variables
101 //
102
103 if(nvars!=fnVarsForOpt) {
104 printf("AliRDHFCutsJpsitoee::GetCutsVarsForOpt: wrong number of variables\n");
105 return;
106 }
107
108 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
109 /*
110 vars[0] = dd->GetDCA();
111 if(TMath::Abs(pdgdaughters[0])==211) {
112 vars[1] = dd->CosThetaStarD0();
113 } else {
114 vars[1] = dd->CosThetaStarD0bar();
115 }
116 vars[2] = dd->Prodd0d0();
117 vars[3] = dd->CosPointingAngle();
118
119 return;
120*/
121
122 Int_t iter=-1;
123 if(fVarsForOpt[0]){
124 iter++;
125 vars[iter]=dd->InvMassJPSIee();
126 }
127 if(fVarsForOpt[1]){
128 iter++;
129 vars[iter]=dd->GetDCA();
130 }
131 if(fVarsForOpt[2]){
132 iter++;
133 vars[iter] = dd->CosThetaStarJPSI();
134 }
135 if(fVarsForOpt[3]){
136 iter++;
137 vars[iter]=dd->PtProng(0);
138 }
139 if(fVarsForOpt[4]){
140 iter++;
141 vars[iter]=dd->PtProng(1);
142 }
143 if(fVarsForOpt[5]){
144 iter++;
145 vars[iter]=dd->Getd0Prong(0);
146 }
147 if(fVarsForOpt[6]){
148 iter++;
149 vars[iter]=dd->Getd0Prong(1);
150 }
151 if(fVarsForOpt[7]){
152 iter++;
153 vars[iter]= dd->Prodd0d0();
154 }
155 if(fVarsForOpt[8]){
156 iter++;
157 vars[iter]=dd->CosPointingAngle();
158 }
159
160 return;
161}
162//---------------------------------------------------------------------------
163Int_t AliRDHFCutsJpsitoee::IsSelected(TObject* obj,Int_t selectionLevel) {
164 //
165 // Apply selection
166 //
167
168 if(!fCutsRD){
169 cout<<"Cut matrice not inizialized. Exit..."<<endl;
170 return 0;
171 }
172 //PrintAll();
173 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
174
175 if(!d){
176 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
177 return 0;
178 }
179
180
181 // selection on daughter tracks
182 if(selectionLevel==AliRDHFCuts::kAll ||
183 selectionLevel==AliRDHFCuts::kTracks) {
184 if(!AreDaughtersSelected(d)) return 0;
185 }
186
187
188 // selection on candidate
189 if(selectionLevel==AliRDHFCuts::kAll ||
190 selectionLevel==AliRDHFCuts::kCandidate) {
191
192 Double_t pt=d->Pt();
193 Double_t mJPsi,ctsJPsi;
194
195 Double_t mJPSIPDG = TDatabasePDG::Instance()->GetParticle(443)->Mass();
196
197 Int_t ptbin=PtBin(pt);
198
199 if(d->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;
200
201 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
202 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
203
204
205 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
206
207 mJPsi=d->InvMassJPSIee();
208 if(TMath::Abs(mJPsi-mJPSIPDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) return 0;
209
210 ctsJPsi=d->CosThetaStarJPSI();
211 if(TMath::Abs(ctsJPsi) > fCutsRD[GetGlobalIndex(2,ptbin)]) return 0;
212
213 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
214
215 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
216
217 }
218
219
220 return 1;
221}
222//---------------------------------------------------------------------------