]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliRDHFCutsJpsitoee.cxx
Added IsInFiducualAcceptance() (Alessandro)
[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 /////////////////////////////////////////////////////////////
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
31 ClassImp(AliRDHFCutsJpsitoee)
32
33 //--------------------------------------------------------------------------
34 AliRDHFCutsJpsitoee::AliRDHFCutsJpsitoee(const char* name) : 
35 AliRDHFCuts(name)
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 //--------------------------------------------------------------------------
75 AliRDHFCutsJpsitoee::AliRDHFCutsJpsitoee(const AliRDHFCutsJpsitoee &source) :
76   AliRDHFCuts(source)
77 {
78   //
79   // Copy constructor
80   //
81
82 }
83 //--------------------------------------------------------------------------
84 AliRDHFCutsJpsitoee &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 //---------------------------------------------------------------------------
98 void 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   Int_t iter=-1;
111   if(fVarsForOpt[0]){
112     iter++;
113     vars[iter]=dd->InvMassJPSIee();
114   }
115   if(fVarsForOpt[1]){
116     iter++;
117     vars[iter]=dd->GetDCA();
118   }
119   if(fVarsForOpt[2]){
120     iter++;
121     vars[iter] = dd->CosThetaStarJPSI();
122   }
123   if(fVarsForOpt[3]){
124     iter++;
125     if(pdgdaughters[0]==11) vars[iter]=dd->PtProng(0);
126   }
127   if(fVarsForOpt[4]){
128     iter++;
129     if(pdgdaughters[1]==11) vars[iter]=dd->PtProng(1);
130   }
131   if(fVarsForOpt[5]){
132     iter++;
133     vars[iter]=dd->Getd0Prong(0);
134   }
135   if(fVarsForOpt[6]){
136     iter++;
137     vars[iter]=dd->Getd0Prong(1);
138   }
139   if(fVarsForOpt[7]){
140     iter++;
141     vars[iter]= dd->Prodd0d0();
142   }
143   if(fVarsForOpt[8]){
144     iter++;
145     vars[iter]=dd->CosPointingAngle();
146   }
147   
148   return;
149 }
150 //---------------------------------------------------------------------------
151 Int_t AliRDHFCutsJpsitoee::IsSelected(TObject* obj,Int_t selectionLevel) {
152   //
153   // Apply selection
154   //
155
156   if(!fCutsRD){
157     cout<<"Cut matrix not inizialized. Exit..."<<endl;
158     return 0;
159   }
160   //PrintAll();
161   AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
162
163   if(!d){
164     cout<<"AliAODRecoDecayHF2Prong null"<<endl;
165     return 0;
166   }
167
168
169   // selection on daughter tracks 
170   if(selectionLevel==AliRDHFCuts::kAll || 
171      selectionLevel==AliRDHFCuts::kTracks) {
172     if(!AreDaughtersSelected(d)) return 0;
173   }
174
175
176   // selection on candidate
177   if(selectionLevel==AliRDHFCuts::kAll || 
178      selectionLevel==AliRDHFCuts::kCandidate) {
179     
180     Double_t pt=d->Pt();
181     Double_t mJPsi,ctsJPsi;
182
183     Double_t mJPSIPDG = TDatabasePDG::Instance()->GetParticle(443)->Mass();
184     
185     Int_t ptbin=PtBin(pt);
186
187     if(d->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;
188
189     if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
190        TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
191
192   
193     if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
194
195     mJPsi=d->InvMassJPSIee();
196     if(TMath::Abs(mJPsi-mJPSIPDG)    > fCutsRD[GetGlobalIndex(0,ptbin)]) return 0;
197
198     ctsJPsi=d->CosThetaStarJPSI();
199     if(TMath::Abs(ctsJPsi)    > fCutsRD[GetGlobalIndex(2,ptbin)]) return 0;
200
201     if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
202     
203     if(d->CosPointingAngle()   < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
204   }
205
206   return 1;
207 }
208 //---------------------------------------------------------------------------