1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Svein Lindal, Daniel Lohner *
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 **************************************************************************/
16 ////////////////////////////////////////////////
17 //---------------------------------------------
18 // Class handling all kinds of selection cuts for
19 // Gamma Conversion analysis
20 //---------------------------------------------
21 ////////////////////////////////////////////////
23 #include "AliConversionMesonCuts.h"
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"
36 #include "AliAODConversionMother.h"
37 #include "TObjString.h"
38 #include "AliAODEvent.h"
39 #include "AliESDEvent.h"
40 #include "AliCentrality.h"
43 #include "TDatabasePDG.h"
44 #include "AliAODMCParticle.h"
50 ClassImp(AliConversionMesonCuts)
53 const char* AliConversionMesonCuts::fgkCutNames[AliConversionMesonCuts::kNCuts] = {
55 "BackgroundScheme", //1
56 "NumberOfBGEvents", //2
57 "DegreesForRotationMethod", //3
58 "RapidityMesonCut", //4
61 "SelectionWindow", //7
62 "SharedElectronCuts", //8
63 "RejectToCloseV0s", //9
64 "UseMCPSmearing", //10
71 //________________________________________________________________________
72 AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *title) :
73 AliAnalysisCuts(name,title),
78 fSelectionHigh(0.145),
82 fUseRotationMethodInBG(kFALSE),
84 fdoBGProbability(kFALSE),
85 fUseTrackMultiplicityForBG(kFALSE),
86 fnDegreeRotationPMForBG(0),
89 fDoToCloseV0sCut(kFALSE),
91 fDoSharedElecCut(kFALSE),
92 fUseMCPSmearing(kFALSE),
99 fAlphaPtDepCut(kFALSE),
100 fElectronLabelArraySize(500),
101 fElectronLabelArray(NULL),
102 fDCAGammaGammaCut(1000),
103 fDCAZMesonPrimVtxCut(1000),
104 fDCARMesonPrimVtxCut(1000),
105 fDCAGammaGammaCutOn(kFALSE),
106 fDCAZMesonPrimVtxCutOn(kFALSE),
107 fDCARMesonPrimVtxCutOn(kFALSE),
108 fBackgroundHandler(0),
112 hDCAGammaGammaMesonBefore(NULL),
113 hDCAZMesonPrimVtxBefore(NULL),
114 hDCARMesonPrimVtxBefore(NULL),
115 hDCAGammaGammaMesonAfter(NULL),
116 hDCAZMesonPrimVtxAfter(NULL),
117 hDCARMesonPrimVtxAfter(NULL)
120 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
121 fCutString=new TObjString((GetCutNumber()).Data());
122 fElectronLabelArray = new Int_t[fElectronLabelArraySize];
124 fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
125 // tests done with 1.0e-14
126 fBrem->SetParameter(0,fPBremSmearing);
127 fBrem->SetNpx(100000);
132 //________________________________________________________________________
133 AliConversionMesonCuts::AliConversionMesonCuts(const AliConversionMesonCuts &ref) :
134 AliAnalysisCuts(ref),
136 fMesonKind(ref.fMesonKind),
138 fSelectionLow(ref.fSelectionLow),
139 fSelectionHigh(ref.fSelectionHigh),
140 fAlphaMinCutMeson(ref.fAlphaMinCutMeson),
141 fAlphaCutMeson(ref.fAlphaCutMeson),
142 fRapidityCutMeson(ref.fRapidityCutMeson),
143 fUseRotationMethodInBG(ref.fUseRotationMethodInBG),
145 fdoBGProbability(ref.fdoBGProbability),
146 fUseTrackMultiplicityForBG(ref.fUseTrackMultiplicityForBG),
147 fnDegreeRotationPMForBG(ref.fnDegreeRotationPMForBG),
148 fNumberOfBGEvents(ref. fNumberOfBGEvents),
149 fOpeningAngle(ref.fOpeningAngle),
150 fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
151 fminV0Dist(ref.fminV0Dist),
152 fDoSharedElecCut(ref.fDoSharedElecCut),
153 fUseMCPSmearing(ref.fUseMCPSmearing),
154 fPBremSmearing(ref.fPBremSmearing),
155 fPSigSmearing(ref.fPSigSmearing),
156 fPSigSmearingCte(ref.fPSigSmearingCte),
158 fRandom(ref.fRandom),
160 fAlphaPtDepCut(ref.fAlphaPtDepCut),
161 fElectronLabelArraySize(ref.fElectronLabelArraySize),
162 fElectronLabelArray(NULL),
163 fDCAGammaGammaCut(ref.fDCAGammaGammaCut),
164 fDCAZMesonPrimVtxCut(ref.fDCAZMesonPrimVtxCut),
165 fDCARMesonPrimVtxCut(ref.fDCARMesonPrimVtxCut),
166 fDCAGammaGammaCutOn(ref.fDCAGammaGammaCutOn),
167 fDCAZMesonPrimVtxCutOn(ref.fDCAZMesonPrimVtxCutOn),
168 fDCARMesonPrimVtxCutOn(ref.fDCARMesonPrimVtxCutOn),
169 fBackgroundHandler(ref.fBackgroundHandler),
173 hDCAGammaGammaMesonBefore(NULL),
174 hDCAZMesonPrimVtxBefore(NULL),
175 hDCARMesonPrimVtxBefore(NULL),
176 hDCAGammaGammaMesonAfter(NULL),
177 hDCAZMesonPrimVtxAfter(NULL),
178 hDCARMesonPrimVtxAfter(NULL)
181 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
182 fCutString=new TObjString((GetCutNumber()).Data());
183 fElectronLabelArray = new Int_t[fElectronLabelArraySize];
184 if (fBrem == NULL)fBrem = (TF1*)ref.fBrem->Clone("fBrem");
185 // Histograms are not copied, if you need them, call InitCutHistograms
189 //________________________________________________________________________
190 AliConversionMesonCuts::~AliConversionMesonCuts() {
192 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
194 // delete fHistograms;
195 // fHistograms = NULL;
196 if(fCutString != NULL){
200 if(fElectronLabelArray){
201 delete fElectronLabelArray;
202 fElectronLabelArray = NULL;
207 //________________________________________________________________________
208 void AliConversionMesonCuts::InitCutHistograms(TString name, Bool_t additionalHists){
210 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
211 TH1::AddDirectory(kFALSE);
213 if(fHistograms != NULL){
217 if(fHistograms==NULL){
218 fHistograms=new TList();
219 fHistograms->SetOwner(kTRUE);
220 if(name=="")fHistograms->SetName(Form("ConvMesonCuts_%s",GetCutNumber().Data()));
221 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
225 hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",13,-0.5,12.5);
226 hMesonCuts->GetXaxis()->SetBinLabel(1,"in");
227 hMesonCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
228 hMesonCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
229 hMesonCuts->GetXaxis()->SetBinLabel(4,"opening angle");
230 hMesonCuts->GetXaxis()->SetBinLabel(5,"alpha max");
231 hMesonCuts->GetXaxis()->SetBinLabel(6,"alpha min");
232 hMesonCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
233 hMesonCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
234 hMesonCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
235 hMesonCuts->GetXaxis()->SetBinLabel(10,"out");
236 fHistograms->Add(hMesonCuts);
238 hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",13,-0.5,12.5);
239 hMesonBGCuts->GetXaxis()->SetBinLabel(1,"in");
240 hMesonBGCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
241 hMesonBGCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
242 hMesonBGCuts->GetXaxis()->SetBinLabel(4,"opening angle");
243 hMesonBGCuts->GetXaxis()->SetBinLabel(5,"alpha max");
244 hMesonBGCuts->GetXaxis()->SetBinLabel(6,"alpha min");
245 hMesonBGCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
246 hMesonBGCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
247 hMesonBGCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
248 hMesonBGCuts->GetXaxis()->SetBinLabel(10,"out");
250 fHistograms->Add(hMesonBGCuts);
252 if (additionalHists){
253 hDCAGammaGammaMesonBefore=new TH1F(Form("DCAGammaGammaMeson Before %s",GetCutNumber().Data()),"DCAGammaGammaMeson Before",200,0,10);
254 fHistograms->Add(hDCAGammaGammaMesonBefore);
256 hDCARMesonPrimVtxBefore=new TH1F(Form("DCARMesonPrimVtx Before %s",GetCutNumber().Data()),"DCARMesonPrimVtx Before",200,0,10);
257 fHistograms->Add(hDCARMesonPrimVtxBefore);
259 hDCAZMesonPrimVtxBefore=new TH1F(Form("DCAZMesonPrimVtx Before %s",GetCutNumber().Data()),"DCAZMesonPrimVtx Before",401,-10,10);
260 fHistograms->Add(hDCAZMesonPrimVtxBefore);
264 hDCAGammaGammaMesonAfter=new TH1F(Form("DCAGammaGammaMeson After %s",GetCutNumber().Data()),"DCAGammaGammaMeson After",200,0,10);
265 fHistograms->Add(hDCAGammaGammaMesonAfter);
267 hDCAZMesonPrimVtxAfter=new TH2F(Form("InvMassDCAZMesonPrimVtx After %s",GetCutNumber().Data()),"InvMassDCAZMesonPrimVtx After",800,0,0.8,401,-10,10);
268 fHistograms->Add(hDCAZMesonPrimVtxAfter);
270 hDCARMesonPrimVtxAfter=new TH1F(Form("DCARMesonPrimVtx After %s",GetCutNumber().Data()),"DCARMesonPrimVtx After",200,0,10);
271 fHistograms->Add(hDCARMesonPrimVtxAfter);
273 TH1::AddDirectory(kTRUE);
276 //________________________________________________________________________
277 Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack, Double_t fRapidityShift){
278 // Returns true for all pions within acceptance cuts for decay into 2 photons
279 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
281 if(!fMCStack)return kFALSE;
283 if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
284 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
286 Double_t rapidity = 10.;
287 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
288 rapidity=8.-fRapidityShift;
290 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
294 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
296 // Select only -> 2y decay channel
297 if(fMCMother->GetNDaughters()!=2)return kFALSE;
299 for(Int_t i=0;i<2;i++){
300 TParticle *MDaughter=fMCStack->Particle(fMCMother->GetDaughter(i));
301 // Is Daughter a Photon?
302 if(MDaughter->GetPdgCode()!=22)return kFALSE;
303 // Is Photon in Acceptance?
304 // if(bMCDaughtersInAcceptance){
305 // if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
312 //________________________________________________________________________
313 Bool_t AliConversionMesonCuts::MesonIsSelectedAODMC(AliAODMCParticle *MCMother,TClonesArray *AODMCArray, Double_t fRapidityShift){
314 // Returns true for all pions within acceptance cuts for decay into 2 photons
315 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
317 if(!AODMCArray)return kFALSE;
319 if(MCMother->GetPdgCode()==111 || MCMother->GetPdgCode()==221){
320 Double_t rMeson = sqrt( (MCMother->Xv()*MCMother->Xv()) + (MCMother->Yv()*MCMother->Yv()) ) ;
321 if(rMeson>fMaxR) return kFALSE; // cuts on distance from collision point
323 Double_t rapidity = 10.;
324 if(MCMother->E() - MCMother->Pz() == 0 || MCMother->E() + MCMother->Pz() == 0){
325 rapidity=8.-fRapidityShift;
327 rapidity = 0.5*(TMath::Log((MCMother->E()+MCMother->Pz()) / (MCMother->E()-MCMother->Pz())))-fRapidityShift;
331 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
333 // Select only -> 2y decay channel
334 if(MCMother->GetNDaughters()!=2)return kFALSE;
336 for(Int_t i=0;i<2;i++){
337 AliAODMCParticle *MDaughter=static_cast<AliAODMCParticle*>(AODMCArray->At(MCMother->GetDaughter(i)));
338 // Is Daughter a Photon?
339 if(MDaughter->GetPdgCode()!=22)return kFALSE;
340 // Is Photon in Acceptance?
341 // if(bMCDaughtersInAcceptance){
342 // if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
350 //________________________________________________________________________
351 Bool_t AliConversionMesonCuts::MesonIsSelectedMCDalitz(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelelectron, Int_t &labelpositron, Int_t &labelgamma, Double_t fRapidityShift){
353 // Returns true for all pions within acceptance cuts for decay into 2 photons
354 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
356 if( !fMCStack )return kFALSE;
358 if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
360 if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
362 Double_t rapidity = 10.;
364 if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
365 rapidity=8.-fRapidityShift;
368 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
372 if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
374 // Select only -> Dalitz decay channel
375 if( fMCMother->GetNDaughters() != 3 )return kFALSE;
377 TParticle *positron = 0x0;
378 TParticle *electron = 0x0;
379 TParticle *gamma = 0x0;
381 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
383 TParticle* temp = (TParticle*)fMCStack->Particle( index );
385 switch( temp->GetPdgCode() ) {
388 labelpositron = index;
392 labelelectron = index;
401 if( positron && electron && gamma) return kTRUE;
405 //________________________________________________________________________
406 Bool_t AliConversionMesonCuts::MesonIsSelectedMCEtaPiPlPiMiGamma(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelNegPion, Int_t &labelPosPion, Int_t &labelGamma, Double_t fRapidityShift){
408 // Returns true for all pions within acceptance cuts for decay into 2 photons
409 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
411 if( !fMCStack )return kFALSE;
413 if( fMCMother->GetPdgCode() != 221 ) return kFALSE;
415 if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
417 Double_t rapidity = 10.;
419 if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
420 rapidity=8.-fRapidityShift;
423 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
427 if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
429 // Select only -> Dalitz decay channel
430 if( fMCMother->GetNDaughters() != 3 )return kFALSE;
432 TParticle *posPion = 0x0;
433 TParticle *negPion = 0x0;
434 TParticle *gamma = 0x0;
436 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
438 TParticle* temp = (TParticle*)fMCStack->Particle( index );
440 switch( temp->GetPdgCode() ) {
443 labelPosPion = index;
447 labelNegPion = index;
456 if( posPion && negPion && gamma) return kTRUE;
460 //________________________________________________________________________
461 Bool_t AliConversionMesonCuts::MesonIsSelectedMCPiPlPiMiPiZero(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelNegPion, Int_t &labelPosPion, Int_t &labelNeutPion, Double_t fRapidityShift){
463 // Returns true for all pions within acceptance cuts for decay into 2 photons
464 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
466 if( !fMCStack )return kFALSE;
468 if( !(fMCMother->GetPdgCode() == 221 || fMCMother->GetPdgCode() == 223) ) return kFALSE;
470 if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
472 Double_t rapidity = 10.;
474 if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
475 rapidity=8.-fRapidityShift;
478 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
482 if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
484 // Select only -> pi+ pi- pi0
485 if( fMCMother->GetNDaughters() != 3 )return kFALSE;
487 TParticle *posPion = 0x0;
488 TParticle *negPion = 0x0;
489 TParticle *neutPion = 0x0;
491 // cout << "\n"<< fMCMother->GetPdgCode() << "\n" << endl;
492 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
494 TParticle* temp = (TParticle*)fMCStack->Particle( index );
495 // cout << temp->GetPdgCode() << endl;
496 switch( temp->GetPdgCode() ) {
499 labelPosPion = index;
503 labelNegPion = index;
507 labelNeutPion = index;
512 if( posPion && negPion && neutPion ) return kTRUE;
517 //________________________________________________________________________
518 Bool_t AliConversionMesonCuts::MesonIsSelectedMCChiC(TParticle *fMCMother,AliStack *fMCStack,Int_t & labelelectronChiC, Int_t & labelpositronChiC, Int_t & labelgammaChiC, Double_t fRapidityShift){
519 // Returns true for all ChiC within acceptance cuts for decay into JPsi + gamma -> e+ + e- + gamma
520 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
522 if(!fMCStack)return kFALSE;
523 // if(fMCMother->GetPdgCode()==20443 ){
526 if(fMCMother->GetPdgCode()==10441 || fMCMother->GetPdgCode()==10443 || fMCMother->GetPdgCode()==445 ){
527 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
529 Double_t rapidity = 10.;
530 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
531 rapidity=8.-fRapidityShift;
534 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
538 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
540 // Select only -> ChiC radiative (JPsi+gamma) decay channel
541 if(fMCMother->GetNDaughters()!=2)return kFALSE;
543 TParticle *jpsi = 0x0;
544 TParticle *gamma = 0x0;
545 TParticle *positron = 0x0;
546 TParticle *electron = 0x0;
548 Int_t labeljpsiChiC = -1;
550 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
552 TParticle* temp = (TParticle*)fMCStack->Particle( index );
554 switch( temp->GetPdgCode() ) {
557 labeljpsiChiC = index;
561 labelgammaChiC = index;
566 if ( !jpsi || ! gamma) return kFALSE;
567 if(jpsi->GetNDaughters()!=2)return kFALSE;
570 for(Int_t index= jpsi->GetFirstDaughter();index<= jpsi->GetLastDaughter();index++){
571 TParticle* temp = (TParticle*)fMCStack->Particle( index );
572 switch( temp->GetPdgCode() ) {
575 labelelectronChiC = index;
579 labelpositronChiC = index;
583 if( !electron || !positron) return kFALSE;
584 if( positron && electron && gamma) return kTRUE;
589 ///________________________________________________________________________
590 Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal, Double_t fRapidityShift)
593 // Selection of reconstructed Meson candidates
594 // Use flag IsSignal in order to fill Fill different
595 // histograms for Signal and Background
598 if(IsSignal){hist=hMesonCuts;}
599 else{hist=hMesonBGCuts;}
603 if(hist)hist->Fill(cutIndex);
606 // Undefined Rapidity -> Floating Point exception
607 if((pi0->E()+pi0->Pz())/(pi0->E()-pi0->Pz())<=0){
608 if(hist)hist->Fill(cutIndex);
610 if (!IsSignal)cout << "undefined rapidity" << endl;
614 // PseudoRapidity Cut --> But we cut on Rapidity !!!
616 if(abs(pi0->Rapidity()-fRapidityShift)>fRapidityCutMeson){
617 if(hist)hist->Fill(cutIndex);
618 // if (!IsSignal) cout << abs(pi0->Rapidity()-fRapidityShift) << ">" << fRapidityCutMeson << endl;
625 //fOpeningAngle=2*TMath::ATan(0.134/pi0->P());// physical minimum opening angle
626 if( pi0->GetOpeningAngle() < fOpeningAngle){
627 // if (!IsSignal) cout << pi0->GetOpeningAngle() << "<" << fOpeningAngle << endl;
628 if(hist)hist->Fill(cutIndex);
633 if ( fAlphaPtDepCut == kTRUE ) {
635 fAlphaCutMeson = fFAlphaCut->Eval( pi0->Pt() );
640 if(pi0->GetAlpha()>fAlphaCutMeson){
641 // if (!IsSignal) cout << pi0->GetAlpha() << ">" << fAlphaCutMeson << endl;
642 if(hist)hist->Fill(cutIndex);
648 if(pi0->GetAlpha()<fAlphaMinCutMeson){
649 // if (!IsSignal)cout << pi0->GetAlpha() << "<" << fAlphaMinCutMeson << endl;
650 if(hist)hist->Fill(cutIndex);
655 if (hDCAGammaGammaMesonBefore)hDCAGammaGammaMesonBefore->Fill(pi0->GetDCABetweenPhotons());
656 if (hDCARMesonPrimVtxBefore)hDCARMesonPrimVtxBefore->Fill(pi0->GetDCARMotherPrimVtx());
658 if (fDCAGammaGammaCutOn){
659 if (pi0->GetDCABetweenPhotons() > fDCAGammaGammaCut){
660 // if (!IsSignal)cout << pi0->GetDCABetweenPhotons() << ">" << fDCAGammaGammaCut << endl;
661 if(hist)hist->Fill(cutIndex);
667 if (fDCARMesonPrimVtxCutOn){
668 if (pi0->GetDCARMotherPrimVtx() > fDCARMesonPrimVtxCut){
669 // if (!IsSignal) cout << pi0->GetDCARMotherPrimVtx() << ">" << fDCARMesonPrimVtxCut << endl;
670 if(hist)hist->Fill(cutIndex);
677 if (hDCAZMesonPrimVtxBefore)hDCAZMesonPrimVtxBefore->Fill(pi0->GetDCAZMotherPrimVtx());
679 if (fDCAZMesonPrimVtxCutOn){
680 if (abs(pi0->GetDCAZMotherPrimVtx()) > fDCAZMesonPrimVtxCut){
681 // if (!IsSignal) cout << pi0->GetDCAZMotherPrimVtx() << ">" << fDCAZMesonPrimVtxCut << endl;
682 if(hist)hist->Fill(cutIndex);
689 if (hDCAGammaGammaMesonAfter)hDCAGammaGammaMesonAfter->Fill(pi0->GetDCABetweenPhotons());
690 if (hDCARMesonPrimVtxAfter)hDCARMesonPrimVtxAfter->Fill(pi0->GetDCARMotherPrimVtx());
691 if (hDCAZMesonPrimVtxAfter)hDCAZMesonPrimVtxAfter->Fill(pi0->M(),pi0->GetDCAZMotherPrimVtx());
693 if(hist)hist->Fill(cutIndex);
699 ///________________________________________________________________________
700 ///________________________________________________________________________
701 Bool_t AliConversionMesonCuts::UpdateCutString() {
702 ///Update the cut string (if it has been created yet)
704 if(fCutString && fCutString->GetString().Length() == kNCuts) {
705 fCutString->SetString(GetCutNumber());
712 ///________________________________________________________________________
713 Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
714 // Initialize Cuts from a given Cut string
715 AliInfo(Form("Set Meson Cutnumber: %s",analysisCutSelection.Data()));
716 if(analysisCutSelection.Length()!=kNCuts) {
717 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
720 if(!analysisCutSelection.IsDigit()){
721 AliError("Cut selection contains characters");
725 const char *cutSelection = analysisCutSelection.Data();
726 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
727 for(Int_t ii=0;ii<kNCuts;ii++){
731 // Set Individual Cuts
732 for(Int_t ii=0;ii<kNCuts;ii++){
733 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
736 PrintCutsWithValues();
739 ///________________________________________________________________________
740 Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
741 ///Set individual cut ID
743 //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;
746 if( SetMesonKind(value)) {
747 fCuts[kMesonKind] = value;
750 } else return kFALSE;
752 if( SetSelectionWindowCut(value)) {
753 fCuts[kSelectionCut] = value;
756 } else return kFALSE;
758 if( SetAlphaMesonCut(value)) {
759 fCuts[kalphaMesonCut] = value;
762 } else return kFALSE;
764 if( SetRCut(value)) {
765 fCuts[kRCut] = value;
768 } else return kFALSE;
770 case kRapidityMesonCut:
771 if( SetRapidityMesonCut(value)) {
772 fCuts[kRapidityMesonCut] = value;
775 } else return kFALSE;
777 case kBackgroundScheme:
778 if( SetBackgroundScheme(value)) {
779 fCuts[kBackgroundScheme] = value;
782 } else return kFALSE;
784 case kDegreesForRotationMethod:
785 if( SetNDegreesForRotationMethod(value)) {
786 fCuts[kDegreesForRotationMethod] = value;
789 } else return kFALSE;
791 case kNumberOfBGEvents:
792 if( SetNumberOfBGEvents(value)) {
793 fCuts[kNumberOfBGEvents] = value;
796 } else return kFALSE;
798 case kuseMCPSmearing:
799 if( SetMCPSmearing(value)) {
800 fCuts[kuseMCPSmearing] = value;
803 } else return kFALSE;
805 if( SetSharedElectronCut(value)) {
806 fCuts[kElecShare] = value;
809 } else return kFALSE;
811 if( SetToCloseV0sCut(value)) {
812 fCuts[kToCloseV0s] = value;
815 } else return kFALSE;
817 if( SetDCAGammaGammaCut(value)) {
818 fCuts[kDcaGammaGamma] = value;
821 } else return kFALSE;
823 if( SetDCAZMesonPrimVtxCut(value)) {
824 fCuts[kDcaZPrimVtx] = value;
827 } else return kFALSE;
829 if( SetDCARMesonPrimVtxCut(value)) {
830 fCuts[kDcaRPrimVtx] = value;
833 } else return kFALSE;
836 cout << "Error:: Cut id out of range"<< endl;
840 cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
846 ///________________________________________________________________________
847 void AliConversionMesonCuts::PrintCuts() {
848 // Print out current Cut Selection
849 for(Int_t ic = 0; ic < kNCuts; ic++) {
850 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
854 ///________________________________________________________________________
855 void AliConversionMesonCuts::PrintCutsWithValues() {
856 // Print out current Cut Selection with values
857 printf("\nMeson cutnumber \n");
858 for(Int_t ic = 0; ic < kNCuts; ic++) {
859 printf("%d",fCuts[ic]);
863 printf("Meson cuts \n");
864 printf("\t |y| < %3.2f \n", fRapidityCutMeson);
865 printf("\t theta_{open} < %3.4f\n", fOpeningAngle);
866 if (!fAlphaPtDepCut) printf("\t %3.2f < alpha < %3.2f\n", fAlphaMinCutMeson, fAlphaCutMeson);
867 if (fDCAGammaGammaCutOn)printf("\t dca_{gamma,gamma} > %3.2f\n", fDCAGammaGammaCut);
868 if (fDCARMesonPrimVtxCutOn)printf("\t dca_{R, prim Vtx} > %3.2f\n", fDCARMesonPrimVtxCut);
869 if (fDCAZMesonPrimVtxCutOn)printf("\t dca_{Z, prim Vtx} > %3.2f\n\n", fDCAZMesonPrimVtxCut);
870 printf("\t Meson selection window for further analysis %3.3f > M_{gamma,gamma} > %3.3f\n\n", fSelectionLow, fSelectionHigh);
872 printf("Meson BG settings \n");
874 if (!fUseRotationMethodInBG & !fUseTrackMultiplicityForBG) printf("\t BG scheme: mixing V0 mult \n");
875 if (!fUseRotationMethodInBG & fUseTrackMultiplicityForBG) printf("\t BG scheme: mixing track mult \n");
876 if (fUseRotationMethodInBG )printf("\t BG scheme: rotation \n");
877 if (fdoBGProbability) printf("\t -> use BG probability \n");
878 if (fBackgroundHandler) printf("\t -> use new BG handler \n");
879 printf("\t depth of pool: %d\n", fNumberOfBGEvents);
880 if (fUseRotationMethodInBG )printf("\t degree's for BG rotation: %d\n", fnDegreeRotationPMForBG);
886 ///________________________________________________________________________
887 Bool_t AliConversionMesonCuts::SetMesonKind(Int_t mesonKind){
897 cout<<"Warning: Meson kind not defined"<<mesonKind<<endl;
903 ///________________________________________________________________________
904 Bool_t AliConversionMesonCuts::SetRCut(Int_t rCut){
925 // High purity cuts for PbPb
930 cout<<"Warning: rCut not defined"<<rCut<<endl;
936 ///________________________________________________________________________
937 Bool_t AliConversionMesonCuts::SetSelectionWindowCut(Int_t selectionCut){
939 switch(selectionCut){
941 fSelectionLow = 0.08;
942 fSelectionHigh = 0.145;
946 fSelectionHigh = 0.145;
949 fSelectionLow = 0.11;
950 fSelectionHigh = 0.145;
953 fSelectionLow = 0.12;
954 fSelectionHigh = 0.145;
958 fSelectionHigh = 0.15;
961 fSelectionLow = 0.11;
962 fSelectionHigh = 0.15;
965 fSelectionLow = 0.12;
966 fSelectionHigh = 0.15;
970 cout<<"Warning: SelectionCut not defined "<<selectionCut<<endl;
977 ///________________________________________________________________________
978 Bool_t AliConversionMesonCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
980 switch(alphaMesonCut){
982 fAlphaMinCutMeson = 0.0;
983 fAlphaCutMeson = 0.7;
984 fAlphaPtDepCut = kFALSE;
986 case 1: // Updated 31 October 2013 before 0.0 - 0.5
987 if( fFAlphaCut ) delete fFAlphaCut;
988 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
989 fFAlphaCut->SetParameter(0,0.7);
990 fFAlphaCut->SetParameter(1,1.2);
991 fAlphaMinCutMeson = 0.0;
992 fAlphaCutMeson = -1.0;
993 fAlphaPtDepCut = kTRUE;
995 case 2: // Updated 31 October 2013 before 0.5-1
996 if( fFAlphaCut ) delete fFAlphaCut;
997 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
998 fFAlphaCut->SetParameter(0,0.8);
999 fFAlphaCut->SetParameter(1,1.2);
1000 fAlphaMinCutMeson = 0.0;
1001 fAlphaCutMeson = -1.0;
1002 fAlphaPtDepCut = kTRUE;
1005 fAlphaMinCutMeson = 0.0;
1006 fAlphaCutMeson = 1.;
1007 fAlphaPtDepCut = kFALSE;
1010 fAlphaMinCutMeson = 0.0;
1011 fAlphaCutMeson = 0.65;
1012 fAlphaPtDepCut = kFALSE;
1015 fAlphaMinCutMeson = 0.0;
1016 fAlphaCutMeson = 0.75;
1017 fAlphaPtDepCut = kFALSE;
1020 fAlphaMinCutMeson = 0.0;
1021 fAlphaCutMeson = 0.8;
1022 fAlphaPtDepCut = kFALSE;
1025 fAlphaMinCutMeson = 0.0;
1026 fAlphaCutMeson = 0.85;
1027 fAlphaPtDepCut = kFALSE;
1030 fAlphaMinCutMeson = 0.0;
1031 fAlphaCutMeson = 0.6;
1032 fAlphaPtDepCut = kFALSE;
1034 case 9: // Updated 11 November 2013 before 0.0 - 0.3
1035 if( fFAlphaCut ) delete fFAlphaCut;
1036 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
1037 fFAlphaCut->SetParameter(0,0.65);
1038 fFAlphaCut->SetParameter(1,1.2);
1039 fAlphaMinCutMeson = 0.0;
1040 fAlphaCutMeson = -1.0;
1041 fAlphaPtDepCut = kTRUE;
1044 cout<<"Warning: AlphaMesonCut not defined "<<alphaMesonCut<<endl;
1050 ///________________________________________________________________________
1051 Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
1053 switch(RapidityMesonCut){
1054 case 0: // changed from 0.9 to 1.35
1055 fRapidityCutMeson = 1.35;
1058 fRapidityCutMeson = 0.8;
1061 fRapidityCutMeson = 0.7;
1064 fRapidityCutMeson = 0.6;
1067 fRapidityCutMeson = 0.5;
1070 fRapidityCutMeson = 0.85;
1073 fRapidityCutMeson = 0.75;
1076 fRapidityCutMeson = 0.3;
1078 case 8: //changed, before 0.35
1079 fRapidityCutMeson = 0.25;
1082 fRapidityCutMeson = 0.4;
1085 cout<<"Warning: RapidityMesonCut not defined "<<RapidityMesonCut<<endl;
1092 ///________________________________________________________________________
1093 Bool_t AliConversionMesonCuts::SetBackgroundScheme(Int_t BackgroundScheme){
1095 switch(BackgroundScheme){
1097 fUseRotationMethodInBG=kTRUE;
1098 fdoBGProbability=kFALSE;
1100 case 1: // mixed event with V0 multiplicity
1101 fUseRotationMethodInBG=kFALSE;
1102 fUseTrackMultiplicityForBG=kFALSE;
1103 fdoBGProbability=kFALSE;
1105 case 2: // mixed event with track multiplicity
1106 fUseRotationMethodInBG=kFALSE;
1107 fUseTrackMultiplicityForBG=kTRUE;
1108 fdoBGProbability=kFALSE;
1111 fUseRotationMethodInBG=kTRUE;
1112 fdoBGProbability=kTRUE;
1114 case 4: //No BG calculation
1115 cout << "no BG calculation should be done" << endl;
1116 fUseRotationMethodInBG=kFALSE;
1117 fdoBGProbability=kFALSE;
1121 fUseRotationMethodInBG=kTRUE;
1122 fdoBGProbability=kFALSE;
1123 fBackgroundHandler = 1;
1125 case 6: // mixed event with V0 multiplicity
1126 fUseRotationMethodInBG=kFALSE;
1127 fUseTrackMultiplicityForBG=kFALSE;
1128 fdoBGProbability=kFALSE;
1129 fBackgroundHandler = 1;
1131 case 7: // mixed event with track multiplicity
1132 fUseRotationMethodInBG=kFALSE;
1133 fUseTrackMultiplicityForBG=kTRUE;
1134 fdoBGProbability=kFALSE;
1135 fBackgroundHandler = 1;
1138 fUseRotationMethodInBG=kTRUE;
1139 fdoBGProbability=kTRUE;
1140 fBackgroundHandler = 1;
1143 cout<<"Warning: BackgroundScheme not defined "<<BackgroundScheme<<endl;
1150 ///________________________________________________________________________
1151 Bool_t AliConversionMesonCuts::SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod){
1153 switch(DegreesForRotationMethod){
1155 fnDegreeRotationPMForBG = 5;
1158 fnDegreeRotationPMForBG = 10;
1161 fnDegreeRotationPMForBG = 15;
1164 fnDegreeRotationPMForBG = 20;
1167 cout<<"Warning: DegreesForRotationMethod not defined "<<DegreesForRotationMethod<<endl;
1170 fCuts[kDegreesForRotationMethod]=DegreesForRotationMethod;
1174 ///________________________________________________________________________
1175 Bool_t AliConversionMesonCuts::SetNumberOfBGEvents(Int_t NumberOfBGEvents){
1177 switch(NumberOfBGEvents){
1179 fNumberOfBGEvents = 5;
1182 fNumberOfBGEvents = 10;
1185 fNumberOfBGEvents = 15;
1188 fNumberOfBGEvents = 20;
1191 fNumberOfBGEvents = 2;
1194 fNumberOfBGEvents = 50;
1197 fNumberOfBGEvents = 80;
1200 fNumberOfBGEvents = 100;
1203 cout<<"Warning: NumberOfBGEvents not defined "<<NumberOfBGEvents<<endl;
1208 ///________________________________________________________________________
1209 Bool_t AliConversionMesonCuts::SetSharedElectronCut(Int_t sharedElec) {
1213 fDoSharedElecCut = kFALSE;
1216 fDoSharedElecCut = kTRUE;
1219 cout<<"Warning: Shared Electron Cut not defined "<<sharedElec<<endl;
1226 ///________________________________________________________________________
1227 Bool_t AliConversionMesonCuts::SetToCloseV0sCut(Int_t toClose) {
1231 fDoToCloseV0sCut = kFALSE;
1235 fDoToCloseV0sCut = kTRUE;
1239 fDoToCloseV0sCut = kTRUE;
1243 fDoToCloseV0sCut = kTRUE;
1247 cout<<"Warning: Shared Electron Cut not defined "<<toClose<<endl;
1253 ///________________________________________________________________________
1254 Bool_t AliConversionMesonCuts::SetMCPSmearing(Int_t useMCPSmearing)
1256 switch(useMCPSmearing){
1261 fPSigSmearingCte=0.;
1265 fPBremSmearing=1.0e-14;
1267 fPSigSmearingCte=0.;
1271 fPBremSmearing=1.0e-15;
1273 fPSigSmearingCte=0.;
1278 fPSigSmearing=0.003;
1279 fPSigSmearingCte=0.002;
1284 fPSigSmearing=0.003;
1285 fPSigSmearingCte=0.007;
1290 fPSigSmearing=0.003;
1291 fPSigSmearingCte=0.016;
1296 fPSigSmearing=0.007;
1297 fPSigSmearingCte=0.016;
1301 fPBremSmearing=1.0e-16;
1303 fPSigSmearingCte=0.;
1308 fPSigSmearing=0.007;
1309 fPSigSmearingCte=0.014;
1314 fPSigSmearing=0.007;
1315 fPSigSmearingCte=0.011;
1319 AliError("Warning: UseMCPSmearing not defined");
1326 ///________________________________________________________________________
1327 Bool_t AliConversionMesonCuts::SetDCAGammaGammaCut(Int_t DCAGammaGamma){
1329 switch(DCAGammaGamma){
1331 fDCAGammaGammaCutOn = kFALSE;
1332 fDCAGammaGammaCut = 1000;
1335 fDCAGammaGammaCutOn = kTRUE;
1336 fDCAGammaGammaCut = 10;
1339 fDCAGammaGammaCutOn = kTRUE;
1340 fDCAGammaGammaCut = 5;
1343 fDCAGammaGammaCutOn = kTRUE;
1344 fDCAGammaGammaCut = 4;
1347 fDCAGammaGammaCutOn = kTRUE;
1348 fDCAGammaGammaCut = 3;
1351 fDCAGammaGammaCutOn = kTRUE;
1352 fDCAGammaGammaCut = 2.5;
1355 fDCAGammaGammaCutOn = kTRUE;
1356 fDCAGammaGammaCut = 2;
1359 fDCAGammaGammaCutOn = kTRUE;
1360 fDCAGammaGammaCut = 1.5;
1363 fDCAGammaGammaCutOn = kTRUE;
1364 fDCAGammaGammaCut = 1;
1367 fDCAGammaGammaCutOn = kTRUE;
1368 fDCAGammaGammaCut = 0.5;
1371 cout<<"Warning: DCAGammaGamma not defined "<<DCAGammaGamma<<endl;
1377 ///________________________________________________________________________
1378 Bool_t AliConversionMesonCuts::SetDCAZMesonPrimVtxCut(Int_t DCAZMesonPrimVtx){
1380 switch(DCAZMesonPrimVtx){
1382 fDCAZMesonPrimVtxCutOn = kFALSE;
1383 fDCAZMesonPrimVtxCut = 1000;
1386 fDCAZMesonPrimVtxCutOn = kTRUE;
1387 fDCAZMesonPrimVtxCut = 10;
1390 fDCAZMesonPrimVtxCutOn = kTRUE;
1391 fDCAZMesonPrimVtxCut = 5;
1394 fDCAZMesonPrimVtxCutOn = kTRUE;
1395 fDCAZMesonPrimVtxCut = 4;
1398 fDCAZMesonPrimVtxCutOn = kTRUE;
1399 fDCAZMesonPrimVtxCut = 3;
1402 fDCAZMesonPrimVtxCutOn = kTRUE;
1403 fDCAZMesonPrimVtxCut = 2.5;
1406 fDCAZMesonPrimVtxCutOn = kTRUE;
1407 fDCAZMesonPrimVtxCut = 2;
1410 fDCAZMesonPrimVtxCutOn = kTRUE;
1411 fDCAZMesonPrimVtxCut = 1.5;
1414 fDCAZMesonPrimVtxCutOn = kTRUE;
1415 fDCAZMesonPrimVtxCut = 1;
1418 fDCAZMesonPrimVtxCutOn = kTRUE;
1419 fDCAZMesonPrimVtxCut = 0.5;
1422 cout<<"Warning: DCAZMesonPrimVtx not defined "<<DCAZMesonPrimVtx<<endl;
1428 ///________________________________________________________________________
1429 Bool_t AliConversionMesonCuts::SetDCARMesonPrimVtxCut(Int_t DCARMesonPrimVtx){
1431 switch(DCARMesonPrimVtx){
1433 fDCARMesonPrimVtxCutOn = kFALSE;
1434 fDCARMesonPrimVtxCut = 1000;
1437 fDCARMesonPrimVtxCutOn = kTRUE;
1438 fDCARMesonPrimVtxCut = 10;
1441 fDCARMesonPrimVtxCutOn = kTRUE;
1442 fDCARMesonPrimVtxCut = 5;
1445 fDCARMesonPrimVtxCutOn = kTRUE;
1446 fDCARMesonPrimVtxCut = 4;
1449 fDCARMesonPrimVtxCutOn = kTRUE;
1450 fDCARMesonPrimVtxCut = 3;
1453 fDCARMesonPrimVtxCutOn = kTRUE;
1454 fDCARMesonPrimVtxCut = 2.5;
1457 fDCARMesonPrimVtxCutOn = kTRUE;
1458 fDCARMesonPrimVtxCut = 2;
1461 fDCARMesonPrimVtxCutOn = kTRUE;
1462 fDCARMesonPrimVtxCut = 1.5;
1465 fDCARMesonPrimVtxCutOn = kTRUE;
1466 fDCARMesonPrimVtxCut = 1;
1469 fDCARMesonPrimVtxCutOn = kTRUE;
1470 fDCARMesonPrimVtxCut = 0.5;
1473 cout<<"Warning: DCARMesonPrimVtx not defined "<<DCARMesonPrimVtx<<endl;
1480 ///________________________________________________________________________
1481 TString AliConversionMesonCuts::GetCutNumber(){
1482 // returns TString with current cut number
1484 for(Int_t ii=0;ii<kNCuts;ii++){
1485 a.Append(Form("%d",fCuts[ii]));
1490 ///________________________________________________________________________
1491 void AliConversionMesonCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
1493 Int_t posLabel = photon->GetTrackLabelPositive();
1494 Int_t negLabel = photon->GetTrackLabelNegative();
1496 fElectronLabelArray[nV0*2] = posLabel;
1497 fElectronLabelArray[(nV0*2)+1] = negLabel;
1500 ///________________________________________________________________________
1501 Bool_t AliConversionMesonCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
1503 Int_t posLabel = photon->GetTrackLabelPositive();
1504 Int_t negLabel = photon->GetTrackLabelNegative();
1506 for(Int_t i = 0; i<nV0s*2;i++){
1507 if(i==nV0*2) continue;
1508 if(i==(nV0*2)+1) continue;
1509 if(fElectronLabelArray[i] == posLabel){
1511 if(fElectronLabelArray[i] == negLabel){
1517 ///________________________________________________________________________
1518 Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
1519 Double_t posX = photon->GetConversionX();
1520 Double_t posY = photon->GetConversionY();
1521 Double_t posZ = photon->GetConversionZ();
1523 for(Int_t i = 0;i<photons->GetEntries();i++){
1524 if(nV0 == i) continue;
1525 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
1526 Double_t posCompX = photonComp->GetConversionX();
1527 Double_t posCompY = photonComp->GetConversionY();
1528 Double_t posCompZ = photonComp->GetConversionZ();
1530 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
1532 if(dist < fminV0Dist*fminV0Dist){
1533 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
1542 ///________________________________________________________________________
1543 void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
1546 if (photon==NULL) return;
1547 Double_t facPBrem = 1.;
1548 Double_t facPSig = 0.;
1557 if( photon->P()!=0){
1558 theta=acos( photon->Pz()/ photon->P());
1561 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
1562 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
1565 if( fPBremSmearing != 1.){
1567 facPBrem = fBrem->GetRandom();
1571 photon->SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
1572 photon->SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
1573 photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
1574 photon->SetE(photon->P());
1576 ///________________________________________________________________________
1577 void AliConversionMesonCuts::SmearVirtualPhoton(AliAODConversionPhoton* photon)
1580 if (photon==NULL) return;
1581 Double_t facPBrem = 1.;
1582 Double_t facPSig = 0.;
1591 if( photon->P()!=0){
1592 theta=acos( photon->Pz()/ photon->P());
1595 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
1596 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
1599 if( fPBremSmearing != 1.){
1601 facPBrem = fBrem->GetRandom();
1605 photon->SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
1606 photon->SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
1607 photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
1610 ///________________________________________________________________________
1611 TLorentzVector AliConversionMesonCuts::SmearElectron(TLorentzVector particle)
1614 //if (particle==0) return;
1615 Double_t facPBrem = 1.;
1616 Double_t facPSig = 0.;
1627 if (phi < 0.) phi += 2. * TMath::Pi();
1629 if( particle.P()!=0){
1630 theta=acos( particle.Pz()/ particle.P());
1634 Double_t fPSigSmearingHalf = fPSigSmearing / 2.0; //The parameter was set for gammas with 2 particles and here we have just one electron
1635 Double_t sqrtfPSigSmearingCteHalf = fPSigSmearingCte / 2.0 ; //The parameter was set for gammas with 2 particles and here we have just one electron
1639 if( fPSigSmearingHalf != 0. || sqrtfPSigSmearingCteHalf!=0. ){
1640 facPSig = TMath::Sqrt(sqrtfPSigSmearingCteHalf*sqrtfPSigSmearingCteHalf+fPSigSmearingHalf*fPSigSmearingHalf*P*P)*fRandom.Gaus(0.,1.);
1643 if( fPBremSmearing != 1.){
1645 facPBrem = fBrem->GetRandom();
1649 TLorentzVector SmearedParticle;
1651 SmearedParticle.SetXYZM( facPBrem* (1+facPSig)* P*sin(theta)*cos(phi) , facPBrem* (1+facPSig)* P*sin(theta)*sin(phi) ,
1652 facPBrem* (1+facPSig)* P*cos(theta) , TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass()) ;
1654 //particle.SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
1655 //particle.SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
1656 //particle.SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
1658 return SmearedParticle;