]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/GammaConv/AliConversionMesonCuts.cxx
changed AddTasks
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliConversionMesonCuts.cxx
CommitLineData
2bb2434e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Authors: Svein Lindal, Daniel Lohner *
5 * Version 1.0 *
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////////////////////////////////////////////////
4803eb1f 17//---------------------------------------------
2bb2434e 18// Class handling all kinds of selection cuts for
19// Gamma Conversion analysis
20//---------------------------------------------
21////////////////////////////////////////////////
22
23#include "AliConversionMesonCuts.h"
24
25#include "AliKFVertex.h"
26#include "AliAODTrack.h"
27#include "AliESDtrack.h"
28#include "AliAnalysisManager.h"
29#include "AliInputEventHandler.h"
30#include "AliMCEventHandler.h"
31#include "AliAODHandler.h"
32#include "AliPIDResponse.h"
33#include "TH1.h"
34#include "TH2.h"
35#include "AliStack.h"
36#include "AliAODConversionMother.h"
37#include "TObjString.h"
38#include "AliAODEvent.h"
39#include "AliESDEvent.h"
40#include "AliCentrality.h"
41#include "TList.h"
ae947965 42#include "TPDGCode.h"
43#include "TDatabasePDG.h"
44#include "AliAODMCParticle.h"
45
2bb2434e 46class iostream;
47
48using namespace std;
49
50ClassImp(AliConversionMesonCuts)
51
52
53const char* AliConversionMesonCuts::fgkCutNames[AliConversionMesonCuts::kNCuts] = {
0a2b2b4b 54 "MesonKind", //0
55 "BackgroundScheme", //1
56 "NumberOfBGEvents", //2
57 "DegreesForRotationMethod", //3
58 "RapidityMesonCut", //4
59 "RCut", //5
60 "AlphaMesonCut", //6
61 "Chi2MesonCut", //7
62 "SharedElectronCuts", //8
63 "RejectToCloseV0s", //9
64 "UseMCPSmearing", //10
4803eb1f 65 "DcaGammaGamma", //11
66 "DcaRPrimVtx", //12
67 "DcaZPrimVtx" //13
2bb2434e 68};
69
70
71//________________________________________________________________________
e5b6e8a6 72AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *title) :
73 AliAnalysisCuts(name,title),
74 fHistograms(NULL),
75 fMesonKind(0),
76 fMaxR(200),
77 fChi2CutMeson(1000),
78 fAlphaMinCutMeson(0),
79 fAlphaCutMeson(1),
80 fRapidityCutMeson(1),
81 fUseRotationMethodInBG(kFALSE),
82 fDoBG(kTRUE),
83 fdoBGProbability(kFALSE),
84 fUseTrackMultiplicityForBG(kFALSE),
85 fnDegreeRotationPMForBG(0),
86 fNumberOfBGEvents(0),
87 fOpeningAngle(0.005),
88 fDoToCloseV0sCut(kFALSE),
89 fminV0Dist(200.),
90 fDoSharedElecCut(kFALSE),
91 fUseMCPSmearing(kFALSE),
92 fPBremSmearing(0),
93 fPSigSmearing(0),
94 fPSigSmearingCte(0),
95 fBrem(NULL),
96 fRandom(0),
976b1f89 97 fFAlphaCut(0),
98 fAlphaPtDepCut(kFALSE),
a280ac15 99 fElectronLabelArraySize(500),
e5b6e8a6 100 fElectronLabelArray(NULL),
4803eb1f 101 fDCAGammaGammaCut(1000),
102 fDCAZMesonPrimVtxCut(1000),
103 fDCARMesonPrimVtxCut(1000),
e5b6e8a6 104 fBackgroundHandler(0),
105 fCutString(NULL),
106 hMesonCuts(NULL),
4803eb1f 107 hMesonBGCuts(NULL),
108 hDCAGammaGammaMesonBefore(NULL),
109 hDCAZMesonPrimVtxBefore(NULL),
110 hDCARMesonPrimVtxBefore(NULL),
111 hDCAGammaGammaMesonAfter(NULL),
112 hDCAZMesonPrimVtxAfter(NULL),
113 hDCARMesonPrimVtxAfter(NULL)
114
2bb2434e 115{
e5b6e8a6 116 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
117 fCutString=new TObjString((GetCutNumber()).Data());
a280ac15 118 fElectronLabelArray = new Int_t[fElectronLabelArraySize];
e5b6e8a6 119 if (fBrem == NULL){
120 fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
121 // tests done with 1.0e-14
122 fBrem->SetParameter(0,fPBremSmearing);
123 fBrem->SetNpx(100000);
124 }
ca91a3e1 125
2bb2434e 126}
127
1d9e6011 128//________________________________________________________________________
129AliConversionMesonCuts::AliConversionMesonCuts(const AliConversionMesonCuts &ref) :
130 AliAnalysisCuts(ref),
131 fHistograms(NULL),
132 fMesonKind(ref.fMesonKind),
133 fMaxR(ref.fMaxR),
134 fChi2CutMeson(ref.fChi2CutMeson),
135 fAlphaMinCutMeson(ref.fAlphaMinCutMeson),
136 fAlphaCutMeson(ref.fAlphaCutMeson),
137 fRapidityCutMeson(ref.fRapidityCutMeson),
138 fUseRotationMethodInBG(ref.fUseRotationMethodInBG),
139 fDoBG(ref.fDoBG),
140 fdoBGProbability(ref.fdoBGProbability),
141 fUseTrackMultiplicityForBG(ref.fUseTrackMultiplicityForBG),
142 fnDegreeRotationPMForBG(ref.fnDegreeRotationPMForBG),
143 fNumberOfBGEvents(ref. fNumberOfBGEvents),
144 fOpeningAngle(ref.fOpeningAngle),
145 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
146 fminV0Dist(ref.fminV0Dist),
147 fDoSharedElecCut(ref.fDoSharedElecCut),
148 fUseMCPSmearing(ref.fUseMCPSmearing),
149 fPBremSmearing(ref.fPBremSmearing),
150 fPSigSmearing(ref.fPSigSmearing),
151 fPSigSmearingCte(ref.fPSigSmearingCte),
152 fBrem(NULL),
153 fRandom(ref.fRandom),
976b1f89 154 fFAlphaCut(NULL),
155 fAlphaPtDepCut(ref.fAlphaPtDepCut),
a280ac15 156 fElectronLabelArraySize(ref.fElectronLabelArraySize),
1d9e6011 157 fElectronLabelArray(NULL),
4803eb1f 158 fDCAGammaGammaCut(ref.fDCAGammaGammaCut),
159 fDCAZMesonPrimVtxCut(ref.fDCAZMesonPrimVtxCut),
160 fDCARMesonPrimVtxCut(ref.fDCARMesonPrimVtxCut),
1d9e6011 161 fBackgroundHandler(ref.fBackgroundHandler),
162 fCutString(NULL),
163 hMesonCuts(NULL),
4803eb1f 164 hMesonBGCuts(NULL),
165 hDCAGammaGammaMesonBefore(NULL),
166 hDCAZMesonPrimVtxBefore(NULL),
167 hDCARMesonPrimVtxBefore(NULL),
168 hDCAGammaGammaMesonAfter(NULL),
169 hDCAZMesonPrimVtxAfter(NULL),
170 hDCARMesonPrimVtxAfter(NULL)
1d9e6011 171{
a280ac15 172 // Copy Constructor
173 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
174 fCutString=new TObjString((GetCutNumber()).Data());
175 fElectronLabelArray = new Int_t[fElectronLabelArraySize];
176 if (fBrem == NULL)fBrem = (TF1*)ref.fBrem->Clone("fBrem");
177 // Histograms are not copied, if you need them, call InitCutHistograms
1d9e6011 178}
179
a280ac15 180
2bb2434e 181//________________________________________________________________________
182AliConversionMesonCuts::~AliConversionMesonCuts() {
e5b6e8a6 183 // Destructor
184 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
185 // if(fHistograms)
186 // delete fHistograms;
187 // fHistograms = NULL;
2bb2434e 188 if(fCutString != NULL){
189 delete fCutString;
190 fCutString = NULL;
191 }
192 if(fElectronLabelArray){
193 delete fElectronLabelArray;
194 fElectronLabelArray = NULL;
195 }
196
197}
198
199//________________________________________________________________________
4803eb1f 200void AliConversionMesonCuts::InitCutHistograms(TString name, Bool_t additionalHists){
e5b6e8a6 201
202 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
ccfa8c0d 203 TH1::AddDirectory(kFALSE);
4803eb1f 204
e5b6e8a6 205 if(fHistograms != NULL){
206 delete fHistograms;
207 fHistograms=NULL;
208 }
209 if(fHistograms==NULL){
210 fHistograms=new TList();
ccfa8c0d 211 fHistograms->SetOwner(kTRUE);
e5b6e8a6 212 if(name=="")fHistograms->SetName(Form("ConvMesonCuts_%s",GetCutNumber().Data()));
213 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
214 }
215
216 // Meson Cuts
4803eb1f 217 hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",13,-0.5,12.5);
e5b6e8a6 218 hMesonCuts->GetXaxis()->SetBinLabel(1,"in");
219 hMesonCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
220 hMesonCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
221 hMesonCuts->GetXaxis()->SetBinLabel(4,"opening angle");
222 hMesonCuts->GetXaxis()->SetBinLabel(5,"alpha max");
223 hMesonCuts->GetXaxis()->SetBinLabel(6,"alpha min");
4803eb1f 224 hMesonCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
225 hMesonCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
226 hMesonCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
227 hMesonCuts->GetXaxis()->SetBinLabel(10,"out");
e5b6e8a6 228 fHistograms->Add(hMesonCuts);
229
4803eb1f 230 hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",13,-0.5,12.5);
e5b6e8a6 231 hMesonBGCuts->GetXaxis()->SetBinLabel(1,"in");
232 hMesonBGCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
233 hMesonBGCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
234 hMesonBGCuts->GetXaxis()->SetBinLabel(4,"opening angle");
235 hMesonBGCuts->GetXaxis()->SetBinLabel(5,"alpha max");
236 hMesonBGCuts->GetXaxis()->SetBinLabel(6,"alpha min");
4803eb1f 237 hMesonBGCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
238 hMesonBGCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
239 hMesonBGCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
240 hMesonBGCuts->GetXaxis()->SetBinLabel(10,"out");
241
e5b6e8a6 242 fHistograms->Add(hMesonBGCuts);
4803eb1f 243
244 if (additionalHists){
245 hDCAGammaGammaMesonBefore=new TH1F(Form("DCAGammaGammaMeson Before %s",GetCutNumber().Data()),"DCAGammaGammaMeson Before",200,0,10);
246 fHistograms->Add(hDCAGammaGammaMesonBefore);
247
248 hDCARMesonPrimVtxBefore=new TH1F(Form("DCARMesonPrimVtx Before %s",GetCutNumber().Data()),"DCARMesonPrimVtx Before",200,0,10);
249 fHistograms->Add(hDCARMesonPrimVtxBefore);
250
251 hDCAZMesonPrimVtxBefore=new TH1F(Form("DCAZMesonPrimVtx Before %s",GetCutNumber().Data()),"DCAZMesonPrimVtx Before",401,-10,10);
252 fHistograms->Add(hDCAZMesonPrimVtxBefore);
253
254 }
255
256 hDCAGammaGammaMesonAfter=new TH1F(Form("DCAGammaGammaMeson After %s",GetCutNumber().Data()),"DCAGammaGammaMeson After",200,0,10);
257 fHistograms->Add(hDCAGammaGammaMesonAfter);
258
259 hDCAZMesonPrimVtxAfter=new TH2F(Form("InvMassDCAZMesonPrimVtx After %s",GetCutNumber().Data()),"InvMassDCAZMesonPrimVtx After",800,0,0.8,401,-10,10);
260 fHistograms->Add(hDCAZMesonPrimVtxAfter);
261
262 hDCARMesonPrimVtxAfter=new TH1F(Form("DCARMesonPrimVtx After %s",GetCutNumber().Data()),"DCARMesonPrimVtx After",200,0,10);
263 fHistograms->Add(hDCARMesonPrimVtxAfter);
264
ccfa8c0d 265 TH1::AddDirectory(kTRUE);
2bb2434e 266}
267
2bb2434e 268//________________________________________________________________________
11c1e680 269Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack, Double_t fRapidityShift){
e5b6e8a6 270 // Returns true for all pions within acceptance cuts for decay into 2 photons
271 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
4803eb1f 272
e5b6e8a6 273 if(!fMCStack)return kFALSE;
4803eb1f 274
275 if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
e5b6e8a6 276 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
4803eb1f 277
e5b6e8a6 278 Double_t rapidity = 10.;
279 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
11c1e680 280 rapidity=8.-fRapidityShift;
e5b6e8a6 281 } else{
11c1e680 282 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
4803eb1f 283 }
284
e5b6e8a6 285 // Rapidity Cut
286 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
4803eb1f 287
e5b6e8a6 288 // Select only -> 2y decay channel
289 if(fMCMother->GetNDaughters()!=2)return kFALSE;
4803eb1f 290
e5b6e8a6 291 for(Int_t i=0;i<2;i++){
292 TParticle *MDaughter=fMCStack->Particle(fMCMother->GetDaughter(i));
293 // Is Daughter a Photon?
294 if(MDaughter->GetPdgCode()!=22)return kFALSE;
295 // Is Photon in Acceptance?
296 // if(bMCDaughtersInAcceptance){
297 // if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
298 // }
299 }
300 return kTRUE;
301 }
302 return kFALSE;
2bb2434e 303}
2bb2434e 304//________________________________________________________________________
ae947965 305Bool_t AliConversionMesonCuts::MesonIsSelectedAODMC(AliAODMCParticle *MCMother,TClonesArray *AODMCArray, Double_t fRapidityShift){
e5b6e8a6 306 // Returns true for all pions within acceptance cuts for decay into 2 photons
307 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
2bb2434e 308
ae947965 309 if(!AODMCArray)return kFALSE;
310
311 if(MCMother->GetPdgCode()==111 || MCMother->GetPdgCode()==221){
312 Double_t rMeson = sqrt( (MCMother->Xv()*MCMother->Xv()) + (MCMother->Yv()*MCMother->Yv()) ) ;
313 if(rMeson>fMaxR) return kFALSE; // cuts on distance from collision point
e5b6e8a6 314
315 Double_t rapidity = 10.;
ae947965 316 if(MCMother->E() - MCMother->Pz() == 0 || MCMother->E() + MCMother->Pz() == 0){
11c1e680 317 rapidity=8.-fRapidityShift;
ae947965 318 } else{
319 rapidity = 0.5*(TMath::Log((MCMother->E()+MCMother->Pz()) / (MCMother->E()-MCMother->Pz())))-fRapidityShift;
e5b6e8a6 320 }
ae947965 321
e5b6e8a6 322 // Rapidity Cut
323 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
324
ae947965 325 // Select only -> 2y decay channel
326 if(MCMother->GetNDaughters()!=2)return kFALSE;
e5b6e8a6 327
ae947965 328 for(Int_t i=0;i<2;i++){
329 AliAODMCParticle *MDaughter=static_cast<AliAODMCParticle*>(AODMCArray->At(MCMother->GetDaughter(i)));
330 // Is Daughter a Photon?
331 if(MDaughter->GetPdgCode()!=22)return kFALSE;
332 // Is Photon in Acceptance?
333 // if(bMCDaughtersInAcceptance){
334 // if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
335 // }
e5b6e8a6 336 }
ae947965 337 return kTRUE;
e5b6e8a6 338 }
339 return kFALSE;
ae947965 340}
341//________________________________________________________________________
342Bool_t AliConversionMesonCuts::MesonIsSelectedMCDalitz(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelelectron, Int_t &labelpositron, Int_t &labelgamma, Double_t fRapidityShift){
4803eb1f 343
ae947965 344 // Returns true for all pions within acceptance cuts for decay into 2 photons
345 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
346
347 if( !fMCStack )return kFALSE;
4803eb1f 348
ae947965 349 if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
4803eb1f 350
ae947965 351 if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
352
353 Double_t rapidity = 10.;
4803eb1f 354
ae947965 355 if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
4803eb1f 356 rapidity=8.-fRapidityShift;
ae947965 357 }
358 else{
4803eb1f 359 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
360 }
361
362 // Rapidity Cut
ae947965 363 if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
364
4803eb1f 365 // Select only -> Dalitz decay channel
ae947965 366 if( fMCMother->GetNDaughters() != 3 )return kFALSE;
367
368 TParticle *positron = 0x0;
369 TParticle *electron = 0x0;
370 TParticle *gamma = 0x0;
4803eb1f 371
ae947965 372 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
4803eb1f 373
374 TParticle* temp = (TParticle*)fMCStack->Particle( index );
375
376 switch( temp->GetPdgCode() ) {
377 case ::kPositron:
378 positron = temp;
379 labelpositron = index;
380 break;
381 case ::kElectron:
382 electron = temp;
383 labelelectron = index;
384 break;
385 case ::kGamma:
386 gamma = temp;
387 labelgamma = index;
388 break;
389 }
390 }
391
392 if( positron && electron && gamma) return kTRUE;
393 return kFALSE;
394
395
2bb2434e 396}
0f8c33c1 397//________________________________________________________________________
398Bool_t AliConversionMesonCuts::MesonIsSelectedMCChiC(TParticle *fMCMother,AliStack *fMCStack,Int_t & labelelectronChiC, Int_t & labelpositronChiC, Int_t & labelgammaChiC, Double_t fRapidityShift){
399 // Returns true for all ChiC within acceptance cuts for decay into JPsi + gamma -> e+ + e- + gamma
400 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
401
402 if(!fMCStack)return kFALSE;
4803eb1f 403 // if(fMCMother->GetPdgCode()==20443 ){
404 // return kFALSE;
405 // }
0f8c33c1 406 if(fMCMother->GetPdgCode()==10441 || fMCMother->GetPdgCode()==10443 || fMCMother->GetPdgCode()==445 ){
4803eb1f 407 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
408
409 Double_t rapidity = 10.;
410 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
411 rapidity=8.-fRapidityShift;
412 }
413 else{
414 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
415 }
416
417 // Rapidity Cut
418 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
419
420 // Select only -> ChiC radiative (JPsi+gamma) decay channel
0f8c33c1 421 if(fMCMother->GetNDaughters()!=2)return kFALSE;
422
4803eb1f 423 TParticle *jpsi = 0x0;
424 TParticle *gamma = 0x0;
425 TParticle *positron = 0x0;
426 TParticle *electron = 0x0;
427
428 Int_t labeljpsiChiC = -1;
429
430 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
431
432 TParticle* temp = (TParticle*)fMCStack->Particle( index );
433
434 switch( temp->GetPdgCode() ) {
435 case 443:
436 jpsi = temp;
437 labeljpsiChiC = index;
438 break;
439 case 22:
440 gamma = temp;
441 labelgammaChiC = index;
442 break;
443 }
444 }
0f8c33c1 445
446 if ( !jpsi || ! gamma) return kFALSE;
4803eb1f 447 if(jpsi->GetNDaughters()!=2)return kFALSE;
448
449
450 for(Int_t index= jpsi->GetFirstDaughter();index<= jpsi->GetLastDaughter();index++){
451 TParticle* temp = (TParticle*)fMCStack->Particle( index );
452 switch( temp->GetPdgCode() ) {
453 case -11:
454 electron = temp;
455 labelelectronChiC = index;
456 break;
457 case 11:
458 positron = temp;
459 labelpositronChiC = index;
460 break;
461 }
462 }
463 if( !electron || !positron) return kFALSE;
464 if( positron && electron && gamma) return kTRUE;
0f8c33c1 465 }
466 return kFALSE;
467}
468
2bb2434e 469
470
471///________________________________________________________________________
11c1e680 472Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal, Double_t fRapidityShift)
2bb2434e 473{
4803eb1f 474
e5b6e8a6 475 // Selection of reconstructed Meson candidates
476 // Use flag IsSignal in order to fill Fill different
477 // histograms for Signal and Background
478 TH1 *hist=0x0;
479
480 if(IsSignal){hist=hMesonCuts;}
481 else{hist=hMesonBGCuts;}
482
483 Int_t cutIndex=0;
484
485 if(hist)hist->Fill(cutIndex);
486 cutIndex++;
487
488 // Undefined Rapidity -> Floating Point exception
489 if((pi0->E()+pi0->Pz())/(pi0->E()-pi0->Pz())<=0){
490 if(hist)hist->Fill(cutIndex);
491 cutIndex++;
492 return kFALSE;
493 }
494 else{
495 // PseudoRapidity Cut --> But we cut on Rapidity !!!
496 cutIndex++;
11c1e680 497 if(abs(pi0->Rapidity()-fRapidityShift)>fRapidityCutMeson){
e5b6e8a6 498 if(hist)hist->Fill(cutIndex);
499 return kFALSE;
500 }
501 }
502 cutIndex++;
503
504 // Opening Angle Cut
505 //fOpeningAngle=2*TMath::ATan(0.134/pi0->P());// physical minimum opening angle
506 if( pi0->GetOpeningAngle() < fOpeningAngle){
507 if(hist)hist->Fill(cutIndex);
508 return kFALSE;
509 }
510 cutIndex++;
511
976b1f89 512 if ( fAlphaPtDepCut == kTRUE ) {
513
514 fAlphaCutMeson = fFAlphaCut->Eval( pi0->Pt() );
515 }
516
517
e5b6e8a6 518 // Alpha Max Cut
519 if(pi0->GetAlpha()>fAlphaCutMeson){
520 if(hist)hist->Fill(cutIndex);
521 return kFALSE;
522 }
523 cutIndex++;
524
525 // Alpha Min Cut
526 if(pi0->GetAlpha()<fAlphaMinCutMeson){
527 if(hist)hist->Fill(cutIndex);
528 return kFALSE;
529 }
530 cutIndex++;
531
4803eb1f 532 if (hDCAGammaGammaMesonBefore)hDCAGammaGammaMesonBefore->Fill(pi0->GetDCABetweenPhotons());
533 if (hDCARMesonPrimVtxBefore)hDCARMesonPrimVtxBefore->Fill(pi0->GetDCARMotherPrimVtx());
534
535 if (pi0->GetDCABetweenPhotons() > fDCAGammaGammaCut){
536 if(hist)hist->Fill(cutIndex);
537 return kFALSE;
538 }
539 cutIndex++;
540
541 if (pi0->GetDCARMotherPrimVtx() > fDCARMesonPrimVtxCut){
542 if(hist)hist->Fill(cutIndex);
543 return kFALSE;
544 }
545 cutIndex++;
546
547
548 if (hDCAZMesonPrimVtxBefore)hDCAZMesonPrimVtxBefore->Fill(pi0->GetDCAZMotherPrimVtx());
549
550 if (abs(pi0->GetDCAZMotherPrimVtx()) > fDCAZMesonPrimVtxCut){
551 if(hist)hist->Fill(cutIndex);
552 return kFALSE;
553 }
554 cutIndex++;
555
556
557 if (hDCAGammaGammaMesonAfter)hDCAGammaGammaMesonAfter->Fill(pi0->GetDCABetweenPhotons());
558 if (hDCARMesonPrimVtxAfter)hDCARMesonPrimVtxAfter->Fill(pi0->GetDCARMotherPrimVtx());
559 if (hDCAZMesonPrimVtxAfter)hDCAZMesonPrimVtxAfter->Fill(pi0->M(),pi0->GetDCAZMotherPrimVtx());
560
e5b6e8a6 561 if(hist)hist->Fill(cutIndex);
562 return kTRUE;
2bb2434e 563}
564
565
566
567///________________________________________________________________________
568///________________________________________________________________________
e5b6e8a6 569Bool_t AliConversionMesonCuts::UpdateCutString() {
570 ///Update the cut string (if it has been created yet)
571
572 if(fCutString && fCutString->GetString().Length() == kNCuts) {
e5b6e8a6 573 fCutString->SetString(GetCutNumber());
574 } else {
e5b6e8a6 575 return kFALSE;
576 }
e5b6e8a6 577 return kTRUE;
2bb2434e 578}
579
580///________________________________________________________________________
581Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
e5b6e8a6 582 // Initialize Cuts from a given Cut string
583 AliInfo(Form("Set Meson Cutnumber: %s",analysisCutSelection.Data()));
584 if(analysisCutSelection.Length()!=kNCuts) {
585 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
586 return kFALSE;
587 }
588 if(!analysisCutSelection.IsDigit()){
589 AliError("Cut selection contains characters");
590 return kFALSE;
591 }
4803eb1f 592
e5b6e8a6 593 const char *cutSelection = analysisCutSelection.Data();
594#define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
595 for(Int_t ii=0;ii<kNCuts;ii++){
596 ASSIGNARRAY(ii);
597 }
598
599 // Set Individual Cuts
600 for(Int_t ii=0;ii<kNCuts;ii++){
2bb2434e 601 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
e5b6e8a6 602 }
2bb2434e 603
e5b6e8a6 604 //PrintCuts();
605 return kTRUE;
2bb2434e 606}
607///________________________________________________________________________
608Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
e5b6e8a6 609 ///Set individual cut ID
610
611 //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;
612 switch (cutID) {
613 case kMesonKind:
614 if( SetMesonKind(value)) {
615 fCuts[kMesonKind] = value;
616 UpdateCutString();
617 return kTRUE;
618 } else return kFALSE;
619 case kchi2MesonCut:
620 if( SetChi2MesonCut(value)) {
621 fCuts[kchi2MesonCut] = value;
622 UpdateCutString();
623 return kTRUE;
624 } else return kFALSE;
625 case kalphaMesonCut:
626 if( SetAlphaMesonCut(value)) {
627 fCuts[kalphaMesonCut] = value;
628 UpdateCutString();
629 return kTRUE;
630 } else return kFALSE;
631 case kRCut:
632 if( SetRCut(value)) {
633 fCuts[kRCut] = value;
634 UpdateCutString();
635 return kTRUE;
636 } else return kFALSE;
637
638 case kRapidityMesonCut:
639 if( SetRapidityMesonCut(value)) {
640 fCuts[kRapidityMesonCut] = value;
641 UpdateCutString();
642 return kTRUE;
643 } else return kFALSE;
644
645 case kBackgroundScheme:
646 if( SetBackgroundScheme(value)) {
647 fCuts[kBackgroundScheme] = value;
648 UpdateCutString();
649 return kTRUE;
650 } else return kFALSE;
651
652 case kDegreesForRotationMethod:
653 if( SetNDegreesForRotationMethod(value)) {
654 fCuts[kDegreesForRotationMethod] = value;
655 UpdateCutString();
656 return kTRUE;
657 } else return kFALSE;
658
659 case kNumberOfBGEvents:
660 if( SetNumberOfBGEvents(value)) {
661 fCuts[kNumberOfBGEvents] = value;
662 UpdateCutString();
663 return kTRUE;
664 } else return kFALSE;
665
666 case kuseMCPSmearing:
667 if( SetMCPSmearing(value)) {
668 fCuts[kuseMCPSmearing] = value;
669 UpdateCutString();
670 return kTRUE;
671 } else return kFALSE;
672 case kElecShare:
673 if( SetSharedElectronCut(value)) {
674 fCuts[kElecShare] = value;
675 UpdateCutString();
676 return kTRUE;
677 } else return kFALSE;
678 case kToCloseV0s:
679 if( SetToCloseV0sCut(value)) {
680 fCuts[kToCloseV0s] = value;
681 UpdateCutString();
682 return kTRUE;
683 } else return kFALSE;
4803eb1f 684 case kDcaGammaGamma:
685 if( SetDCAGammaGammaCut(value)) {
686 fCuts[kDcaGammaGamma] = value;
687 UpdateCutString();
688 return kTRUE;
689 } else return kFALSE;
690 case kDcaZPrimVtx:
691 if( SetDCAZMesonPrimVtxCut(value)) {
692 fCuts[kDcaZPrimVtx] = value;
693 UpdateCutString();
694 return kTRUE;
695 } else return kFALSE;
696 case kDcaRPrimVtx:
697 if( SetDCARMesonPrimVtxCut(value)) {
698 fCuts[kDcaRPrimVtx] = value;
699 UpdateCutString();
700 return kTRUE;
701 } else return kFALSE;
e5b6e8a6 702
703 case kNCuts:
704 cout << "Error:: Cut id out of range"<< endl;
705 return kFALSE;
706 }
4803eb1f 707
e5b6e8a6 708 cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
709 return kFALSE;
4803eb1f 710
2bb2434e 711}
712
713
714///________________________________________________________________________
715void AliConversionMesonCuts::PrintCuts() {
e5b6e8a6 716 // Print out current Cut Selection
717 for(Int_t ic = 0; ic < kNCuts; ic++) {
718 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
719 }
2bb2434e 720}
721
722///________________________________________________________________________
723Bool_t AliConversionMesonCuts::SetMesonKind(Int_t mesonKind){
e5b6e8a6 724 // Set Cut
725 switch(mesonKind){
726 case 0:
727 fMesonKind=0;
728 break;
729 case 1:
730 fMesonKind=1;;
731 break;
732 default:
733 cout<<"Warning: Meson kind not defined"<<mesonKind<<endl;
734 return kFALSE;
735 }
736 return kTRUE;
2bb2434e 737}
738
739///________________________________________________________________________
740Bool_t AliConversionMesonCuts::SetRCut(Int_t rCut){
e5b6e8a6 741 // Set Cut
742 switch(rCut){
743 case 0:
744 fMaxR = 180.;
745 break;
746 case 1:
747 fMaxR = 180.;
748 break;
749 case 2:
750 fMaxR = 180.;
751 break;
752 case 3:
4803eb1f 753 fMaxR = 70.;
e5b6e8a6 754 break;
755 case 4:
756 fMaxR = 70.;
757 break;
758 case 5:
759 fMaxR = 180.;
760 break;
761 // High purity cuts for PbPb
762 case 9:
763 fMaxR = 180.;
764 break;
765 default:
766 cout<<"Warning: rCut not defined"<<rCut<<endl;
767 return kFALSE;
768 }
769 return kTRUE;
2bb2434e 770}
771
772///________________________________________________________________________
773Bool_t AliConversionMesonCuts::SetChi2MesonCut(Int_t chi2MesonCut){
e5b6e8a6 774 // Set Cut
775 switch(chi2MesonCut){
776 case 0: // 100.
777 fChi2CutMeson = 100.;
778 break;
779 case 1: // 50.
780 fChi2CutMeson = 50.;
781 break;
782 case 2: // 30.
783 fChi2CutMeson = 30.;
784 break;
785 case 3:
786 fChi2CutMeson = 200.;
787 break;
788 case 4:
789 fChi2CutMeson = 500.;
790 break;
791 case 5:
792 fChi2CutMeson = 1000.;
793 break;
794 default:
795 cout<<"Warning: Chi2MesonCut not defined "<<chi2MesonCut<<endl;
796 return kFALSE;
797 }
798 return kTRUE;
2bb2434e 799}
800
801
802///________________________________________________________________________
803Bool_t AliConversionMesonCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
804{ // Set Cut
e5b6e8a6 805 switch(alphaMesonCut){
806 case 0: // 0- 0.7
807 fAlphaMinCutMeson = 0.0;
808 fAlphaCutMeson = 0.7;
976b1f89 809 fAlphaPtDepCut = kFALSE;
e5b6e8a6 810 break;
976b1f89 811 case 1: // Updated 31 October 2013 before 0.0 - 0.5
812 if( fFAlphaCut ) delete fFAlphaCut;
813 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
814 fFAlphaCut->SetParameter(0,0.7);
815 fFAlphaCut->SetParameter(1,1.2);
816 fAlphaMinCutMeson = 0.0;
817 fAlphaCutMeson = -1.0;
818 fAlphaPtDepCut = kTRUE;
e5b6e8a6 819 break;
976b1f89 820 case 2: // Updated 31 October 2013 before 0.5-1
821 if( fFAlphaCut ) delete fFAlphaCut;
822 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
823 fFAlphaCut->SetParameter(0,0.8);
824 fFAlphaCut->SetParameter(1,1.2);
825 fAlphaMinCutMeson = 0.0;
826 fAlphaCutMeson = -1.0;
827 fAlphaPtDepCut = kTRUE;
e5b6e8a6 828 break;
829 case 3: // 0.0-1
830 fAlphaMinCutMeson = 0.0;
831 fAlphaCutMeson = 1.;
976b1f89 832 fAlphaPtDepCut = kFALSE;
e5b6e8a6 833 break;
834 case 4: // 0-0.65
835 fAlphaMinCutMeson = 0.0;
836 fAlphaCutMeson = 0.65;
976b1f89 837 fAlphaPtDepCut = kFALSE;
e5b6e8a6 838 break;
839 case 5: // 0-0.75
840 fAlphaMinCutMeson = 0.0;
841 fAlphaCutMeson = 0.75;
976b1f89 842 fAlphaPtDepCut = kFALSE;
e5b6e8a6 843 break;
844 case 6: // 0-0.8
845 fAlphaMinCutMeson = 0.0;
846 fAlphaCutMeson = 0.8;
976b1f89 847 fAlphaPtDepCut = kFALSE;
e5b6e8a6 848 break;
849 case 7: // 0.0-0.85
850 fAlphaMinCutMeson = 0.0;
851 fAlphaCutMeson = 0.85;
976b1f89 852 fAlphaPtDepCut = kFALSE;
e5b6e8a6 853 break;
854 case 8: // 0.0-0.6
855 fAlphaMinCutMeson = 0.0;
856 fAlphaCutMeson = 0.6;
976b1f89 857 fAlphaPtDepCut = kFALSE;
e5b6e8a6 858 break;
49af2ef8 859 case 9: // Updated 11 November 2013 before 0.0 - 0.3
860 if( fFAlphaCut ) delete fFAlphaCut;
861 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
862 fFAlphaCut->SetParameter(0,0.65);
863 fFAlphaCut->SetParameter(1,1.2);
864 fAlphaMinCutMeson = 0.0;
865 fAlphaCutMeson = -1.0;
866 fAlphaPtDepCut = kTRUE;
e5b6e8a6 867 break;
868 default:
869 cout<<"Warning: AlphaMesonCut not defined "<<alphaMesonCut<<endl;
870 return kFALSE;
871 }
872 return kTRUE;
2bb2434e 873}
874
875///________________________________________________________________________
4803eb1f 876Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
e5b6e8a6 877 // Set Cut
878 switch(RapidityMesonCut){
621d4c94 879 case 0: // changed from 0.9 to 1.35
880 fRapidityCutMeson = 1.35;
e5b6e8a6 881 break;
882 case 1: //
883 fRapidityCutMeson = 0.8;
884 break;
885 case 2: //
886 fRapidityCutMeson = 0.7;
887 break;
888 case 3: //
889 fRapidityCutMeson = 0.6;
890 break;
891 case 4: //
892 fRapidityCutMeson = 0.5;
893 break;
894 case 5: //
895 fRapidityCutMeson = 0.85;
896 break;
897 case 6: //
898 fRapidityCutMeson = 0.75;
899 break;
11c1e680 900 case 7: //
901 fRapidityCutMeson = 0.3;
902 break;
903 case 8: //
904 fRapidityCutMeson = 0.35;
905 break;
906 case 9: //
907 fRapidityCutMeson = 0.4;
908 break;
e5b6e8a6 909 default:
910 cout<<"Warning: RapidityMesonCut not defined "<<RapidityMesonCut<<endl;
911 return kFALSE;
912 }
913 return kTRUE;
2bb2434e 914}
915
916
917///________________________________________________________________________
918Bool_t AliConversionMesonCuts::SetBackgroundScheme(Int_t BackgroundScheme){
e5b6e8a6 919 // Set Cut
920 switch(BackgroundScheme){
921 case 0: //Rotation
922 fUseRotationMethodInBG=kTRUE;
923 fdoBGProbability=kFALSE;
924 break;
925 case 1: // mixed event with V0 multiplicity
926 fUseRotationMethodInBG=kFALSE;
927 fUseTrackMultiplicityForBG=kFALSE;
928 fdoBGProbability=kFALSE;
929 break;
930 case 2: // mixed event with track multiplicity
931 fUseRotationMethodInBG=kFALSE;
932 fUseTrackMultiplicityForBG=kTRUE;
933 fdoBGProbability=kFALSE;
934 break;
935 case 3: //Rotation
936 fUseRotationMethodInBG=kTRUE;
937 fdoBGProbability=kTRUE;
938 break;
939 case 4: //No BG calculation
940 cout << "no BG calculation should be done" << endl;
941 fUseRotationMethodInBG=kFALSE;
942 fdoBGProbability=kFALSE;
943 fDoBG=kFALSE;
944 break;
945 case 5: //Rotation
946 fUseRotationMethodInBG=kTRUE;
947 fdoBGProbability=kFALSE;
948 fBackgroundHandler = 1;
949 break;
950 case 6: // mixed event with V0 multiplicity
951 fUseRotationMethodInBG=kFALSE;
952 fUseTrackMultiplicityForBG=kFALSE;
953 fdoBGProbability=kFALSE;
954 fBackgroundHandler = 1;
955 break;
956 case 7: // mixed event with track multiplicity
957 fUseRotationMethodInBG=kFALSE;
958 fUseTrackMultiplicityForBG=kTRUE;
959 fdoBGProbability=kFALSE;
960 fBackgroundHandler = 1;
961 break;
962 case 8: //Rotation
963 fUseRotationMethodInBG=kTRUE;
964 fdoBGProbability=kTRUE;
965 fBackgroundHandler = 1;
966 break;
967 default:
968 cout<<"Warning: BackgroundScheme not defined "<<BackgroundScheme<<endl;
969 return kFALSE;
970 }
971 return kTRUE;
2bb2434e 972}
973
ca91a3e1 974
2bb2434e 975///________________________________________________________________________
976Bool_t AliConversionMesonCuts::SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod){
e5b6e8a6 977 // Set Cut
978 switch(DegreesForRotationMethod){
979 case 0:
980 fnDegreeRotationPMForBG = 5;
981 break;
982 case 1:
983 fnDegreeRotationPMForBG = 10;
984 break;
985 case 2:
986 fnDegreeRotationPMForBG = 15;
987 break;
988 case 3:
989 fnDegreeRotationPMForBG = 20;
990 break;
991 default:
992 cout<<"Warning: DegreesForRotationMethod not defined "<<DegreesForRotationMethod<<endl;
993 return kFALSE;
994 }
995 fCuts[kDegreesForRotationMethod]=DegreesForRotationMethod;
996 return kTRUE;
2bb2434e 997}
998
999///________________________________________________________________________
ca91a3e1 1000Bool_t AliConversionMesonCuts::SetNumberOfBGEvents(Int_t NumberOfBGEvents){
e5b6e8a6 1001 // Set Cut
1002 switch(NumberOfBGEvents){
1003 case 0:
1004 fNumberOfBGEvents = 5;
1005 break;
1006 case 1:
1007 fNumberOfBGEvents = 10;
1008 break;
1009 case 2:
1010 fNumberOfBGEvents = 15;
1011 break;
1012 case 3:
1013 fNumberOfBGEvents = 20;
1014 break;
1015 case 4:
1016 fNumberOfBGEvents = 2;
1017 break;
1018 case 5:
1019 fNumberOfBGEvents = 50;
1020 break;
1021 case 6:
1022 fNumberOfBGEvents = 80;
1023 break;
1024 case 7:
1025 fNumberOfBGEvents = 100;
1026 break;
1027 default:
1028 cout<<"Warning: NumberOfBGEvents not defined "<<NumberOfBGEvents<<endl;
1029 return kFALSE;
1030 }
1031 return kTRUE;
2bb2434e 1032}
2bb2434e 1033///________________________________________________________________________
1034Bool_t AliConversionMesonCuts::SetSharedElectronCut(Int_t sharedElec) {
1035
e5b6e8a6 1036 switch(sharedElec){
1037 case 0:
1038 fDoSharedElecCut = kFALSE;
1039 break;
1040 case 1:
1041 fDoSharedElecCut = kTRUE;
1042 break;
1043 default:
1044 cout<<"Warning: Shared Electron Cut not defined "<<sharedElec<<endl;
1045 return kFALSE;
1046 }
4803eb1f 1047
e5b6e8a6 1048 return kTRUE;
2bb2434e 1049}
1050
1051///________________________________________________________________________
1052Bool_t AliConversionMesonCuts::SetToCloseV0sCut(Int_t toClose) {
1053
e5b6e8a6 1054 switch(toClose){
1055 case 0:
1056 fDoToCloseV0sCut = kFALSE;
1057 fminV0Dist = 250;
1058 break;
1059 case 1:
1060 fDoToCloseV0sCut = kTRUE;
1061 fminV0Dist = 1;
1062 break;
1063 case 2:
1064 fDoToCloseV0sCut = kTRUE;
1065 fminV0Dist = 2;
1066 break;
1067 case 3:
1068 fDoToCloseV0sCut = kTRUE;
1069 fminV0Dist = 3;
1070 break;
1071 default:
1072 cout<<"Warning: Shared Electron Cut not defined "<<toClose<<endl;
1073 return kFALSE;
1074 }
1075 return kTRUE;
2bb2434e 1076}
1077
ca91a3e1 1078///________________________________________________________________________
1079Bool_t AliConversionMesonCuts::SetMCPSmearing(Int_t useMCPSmearing)
1080{// Set Cut
e5b6e8a6 1081 switch(useMCPSmearing){
1082 case 0:
1083 fUseMCPSmearing=0;
1084 fPBremSmearing=1.;
1085 fPSigSmearing=0.;
1086 fPSigSmearingCte=0.;
1087 break;
1088 case 1:
1089 fUseMCPSmearing=1;
1090 fPBremSmearing=1.0e-14;
1091 fPSigSmearing=0.;
1092 fPSigSmearingCte=0.;
1093 break;
1094 case 2:
1095 fUseMCPSmearing=1;
1096 fPBremSmearing=1.0e-15;
1097 fPSigSmearing=0.0;
1098 fPSigSmearingCte=0.;
1099 break;
1100 case 3:
1101 fUseMCPSmearing=1;
1102 fPBremSmearing=1.;
1103 fPSigSmearing=0.003;
1104 fPSigSmearingCte=0.002;
1105 break;
1106 case 4:
1107 fUseMCPSmearing=1;
1108 fPBremSmearing=1.;
1109 fPSigSmearing=0.003;
1110 fPSigSmearingCte=0.007;
1111 break;
1112 case 5:
1113 fUseMCPSmearing=1;
1114 fPBremSmearing=1.;
1115 fPSigSmearing=0.003;
1116 fPSigSmearingCte=0.016;
1117 break;
1118 case 6:
1119 fUseMCPSmearing=1;
1120 fPBremSmearing=1.;
1121 fPSigSmearing=0.007;
1122 fPSigSmearingCte=0.016;
1123 break;
1124 case 7:
1125 fUseMCPSmearing=1;
1126 fPBremSmearing=1.0e-16;
1127 fPSigSmearing=0.0;
1128 fPSigSmearingCte=0.;
1129 break;
1130 case 8:
1131 fUseMCPSmearing=1;
1132 fPBremSmearing=1.;
1133 fPSigSmearing=0.007;
1134 fPSigSmearingCte=0.014;
1135 break;
1136 case 9:
1137 fUseMCPSmearing=1;
1138 fPBremSmearing=1.;
1139 fPSigSmearing=0.007;
1140 fPSigSmearingCte=0.011;
1141 break;
1142
1143 default:
1144 AliError("Warning: UseMCPSmearing not defined");
1145 return kFALSE;
1146 }
1147 return kTRUE;
ca91a3e1 1148}
4803eb1f 1149
1150
1151///________________________________________________________________________
1152Bool_t AliConversionMesonCuts::SetDCAGammaGammaCut(Int_t DCAGammaGamma){
1153 // Set Cut
1154 switch(DCAGammaGamma){
1155 case 0: //
1156 fDCAGammaGammaCut = 1000;
1157 break;
1158 case 1: //
1159 fDCAGammaGammaCut = 10;
1160 break;
1161 case 2: //
1162 fDCAGammaGammaCut = 5;
1163 break;
1164 case 3: //
1165 fDCAGammaGammaCut = 4;
1166 break;
1167 case 4: //
1168 fDCAGammaGammaCut = 3;
1169 break;
1170 case 5: //
1171 fDCAGammaGammaCut = 2.5;
1172 break;
1173 case 6: //
1174 fDCAGammaGammaCut = 2;
1175 break;
1176 case 7: //
1177 fDCAGammaGammaCut = 1.5;
1178 break;
1179 case 8: //
1180 fDCAGammaGammaCut = 1;
1181 break;
1182 case 9: //
1183 fDCAGammaGammaCut = 0.5;
1184 break;
1185 default:
1186 cout<<"Warning: DCAGammaGamma not defined "<<DCAGammaGamma<<endl;
1187 return kFALSE;
1188 }
1189 return kTRUE;
1190}
1191
1192///________________________________________________________________________
1193Bool_t AliConversionMesonCuts::SetDCAZMesonPrimVtxCut(Int_t DCAZMesonPrimVtx){
1194 // Set Cut
1195 switch(DCAZMesonPrimVtx){
1196 case 0: //
1197 fDCAZMesonPrimVtxCut = 1000;
1198 break;
1199 case 1: //
1200 fDCAZMesonPrimVtxCut = 10;
1201 break;
1202 case 2: //
1203 fDCAZMesonPrimVtxCut = 5;
1204 break;
1205 case 3: //
1206 fDCAZMesonPrimVtxCut = 4;
1207 break;
1208 case 4: //
1209 fDCAZMesonPrimVtxCut = 3;
1210 break;
1211 case 5: //
1212 fDCAZMesonPrimVtxCut = 2.5;
1213 break;
1214 case 6: //
1215 fDCAZMesonPrimVtxCut = 2;
1216 break;
1217 case 7: //
1218 fDCAZMesonPrimVtxCut = 1.5;
1219 break;
1220 case 8: //
1221 fDCAZMesonPrimVtxCut = 1;
1222 break;
1223 case 9: //
1224 fDCAZMesonPrimVtxCut = 0.5;
1225 break;
1226 default:
1227 cout<<"Warning: DCAZMesonPrimVtx not defined "<<DCAZMesonPrimVtx<<endl;
1228 return kFALSE;
1229 }
1230 return kTRUE;
1231}
1232
1233///________________________________________________________________________
1234Bool_t AliConversionMesonCuts::SetDCARMesonPrimVtxCut(Int_t DCARMesonPrimVtx){
1235 // Set Cut
1236 switch(DCARMesonPrimVtx){
1237 case 0: //
1238 fDCARMesonPrimVtxCut = 1000;
1239 break;
1240 case 1: //
1241 fDCARMesonPrimVtxCut = 10;
1242 break;
1243 case 2: //
1244 fDCARMesonPrimVtxCut = 5;
1245 break;
1246 case 3: //
1247 fDCARMesonPrimVtxCut = 4;
1248 break;
1249 case 4: //
1250 fDCARMesonPrimVtxCut = 3;
1251 break;
1252 case 5: //
1253 fDCARMesonPrimVtxCut = 2.5;
1254 break;
1255 case 6: //
1256 fDCARMesonPrimVtxCut = 2;
1257 break;
1258 case 7: //
1259 fDCARMesonPrimVtxCut = 1.5;
1260 break;
1261 case 8: //
1262 fDCARMesonPrimVtxCut = 1;
1263 break;
1264 case 9: //
1265 fDCARMesonPrimVtxCut = 0.5;
1266 break;
1267 default:
1268 cout<<"Warning: DCARMesonPrimVtx not defined "<<DCARMesonPrimVtx<<endl;
1269 return kFALSE;
1270 }
1271 return kTRUE;
1272}
1273
1274
2bb2434e 1275///________________________________________________________________________
1276TString AliConversionMesonCuts::GetCutNumber(){
e5b6e8a6 1277 // returns TString with current cut number
1278 TString a(kNCuts);
1279 for(Int_t ii=0;ii<kNCuts;ii++){
1280 a.Append(Form("%d",fCuts[ii]));
1281 }
1282 return a;
2bb2434e 1283}
1284
1285///________________________________________________________________________
1286void AliConversionMesonCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
4803eb1f 1287
e5b6e8a6 1288 Int_t posLabel = photon->GetTrackLabelPositive();
1289 Int_t negLabel = photon->GetTrackLabelNegative();
4803eb1f 1290
e5b6e8a6 1291 fElectronLabelArray[nV0*2] = posLabel;
1292 fElectronLabelArray[(nV0*2)+1] = negLabel;
2bb2434e 1293}
1294
1295///________________________________________________________________________
1296Bool_t AliConversionMesonCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
1297
e5b6e8a6 1298 Int_t posLabel = photon->GetTrackLabelPositive();
1299 Int_t negLabel = photon->GetTrackLabelNegative();
2bb2434e 1300
e5b6e8a6 1301 for(Int_t i = 0; i<nV0s*2;i++){
1302 if(i==nV0*2) continue;
1303 if(i==(nV0*2)+1) continue;
1304 if(fElectronLabelArray[i] == posLabel){
1305 return kFALSE;}
1306 if(fElectronLabelArray[i] == negLabel){
1307 return kFALSE;}
1308 }
2bb2434e 1309
e5b6e8a6 1310 return kTRUE;
2bb2434e 1311}
1312///________________________________________________________________________
1313Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
e5b6e8a6 1314 Double_t posX = photon->GetConversionX();
1315 Double_t posY = photon->GetConversionY();
1316 Double_t posZ = photon->GetConversionZ();
1317
1318 for(Int_t i = 0;i<photons->GetEntries();i++){
1319 if(nV0 == i) continue;
1320 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
1321 Double_t posCompX = photonComp->GetConversionX();
1322 Double_t posCompY = photonComp->GetConversionY();
1323 Double_t posCompZ = photonComp->GetConversionZ();
4803eb1f 1324
e5b6e8a6 1325 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
2bb2434e 1326
e5b6e8a6 1327 if(dist < fminV0Dist*fminV0Dist){
1328 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
1329 else {
1330 return kFALSE;}
1331 }
4803eb1f 1332
e5b6e8a6 1333 }
1334 return kTRUE;
2bb2434e 1335}
ca91a3e1 1336
1337///________________________________________________________________________
1338void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
1339{
4803eb1f 1340
0a2b2b4b 1341 if (photon==NULL) return;
ca91a3e1 1342 Double_t facPBrem = 1.;
1343 Double_t facPSig = 0.;
1344
1345 Double_t phi=0.;
1346 Double_t theta=0.;
1347 Double_t P=0.;
1348
4803eb1f 1349
ca91a3e1 1350 P=photon->P();
1351 phi=photon->Phi();
1352 if( photon->P()!=0){
1353 theta=acos( photon->Pz()/ photon->P());
1354 }
1355
4803eb1f 1356 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
ca91a3e1 1357 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
1358 }
4803eb1f 1359
ca91a3e1 1360 if( fPBremSmearing != 1.){
1361 if(fBrem!=NULL){
1362 facPBrem = fBrem->GetRandom();
1363 }
1364 }
1365
1366 photon->SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
1367 photon->SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
1368 photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
1369 photon->SetE(photon->P());
1370}