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