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