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