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
62 "SharedElectronCuts", //8
63 "RejectToCloseV0s", //9
64 "UseMCPSmearing", //10
71 //________________________________________________________________________
72 AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *title) :
73 AliAnalysisCuts(name,title),
81 fUseRotationMethodInBG(kFALSE),
83 fdoBGProbability(kFALSE),
84 fUseTrackMultiplicityForBG(kFALSE),
85 fnDegreeRotationPMForBG(0),
88 fDoToCloseV0sCut(kFALSE),
90 fDoSharedElecCut(kFALSE),
91 fUseMCPSmearing(kFALSE),
98 fAlphaPtDepCut(kFALSE),
99 fElectronLabelArraySize(500),
100 fElectronLabelArray(NULL),
101 fDCAGammaGammaCut(1000),
102 fDCAZMesonPrimVtxCut(1000),
103 fDCARMesonPrimVtxCut(1000),
104 fBackgroundHandler(0),
108 hDCAGammaGammaMesonBefore(NULL),
109 hDCAZMesonPrimVtxBefore(NULL),
110 hDCARMesonPrimVtxBefore(NULL),
111 hDCAGammaGammaMesonAfter(NULL),
112 hDCAZMesonPrimVtxAfter(NULL),
113 hDCARMesonPrimVtxAfter(NULL)
116 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
117 fCutString=new TObjString((GetCutNumber()).Data());
118 fElectronLabelArray = new Int_t[fElectronLabelArraySize];
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);
128 //________________________________________________________________________
129 AliConversionMesonCuts::AliConversionMesonCuts(const AliConversionMesonCuts &ref) :
130 AliAnalysisCuts(ref),
132 fMesonKind(ref.fMesonKind),
134 fChi2CutMeson(ref.fChi2CutMeson),
135 fAlphaMinCutMeson(ref.fAlphaMinCutMeson),
136 fAlphaCutMeson(ref.fAlphaCutMeson),
137 fRapidityCutMeson(ref.fRapidityCutMeson),
138 fUseRotationMethodInBG(ref.fUseRotationMethodInBG),
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),
153 fRandom(ref.fRandom),
155 fAlphaPtDepCut(ref.fAlphaPtDepCut),
156 fElectronLabelArraySize(ref.fElectronLabelArraySize),
157 fElectronLabelArray(NULL),
158 fDCAGammaGammaCut(ref.fDCAGammaGammaCut),
159 fDCAZMesonPrimVtxCut(ref.fDCAZMesonPrimVtxCut),
160 fDCARMesonPrimVtxCut(ref.fDCARMesonPrimVtxCut),
161 fBackgroundHandler(ref.fBackgroundHandler),
165 hDCAGammaGammaMesonBefore(NULL),
166 hDCAZMesonPrimVtxBefore(NULL),
167 hDCARMesonPrimVtxBefore(NULL),
168 hDCAGammaGammaMesonAfter(NULL),
169 hDCAZMesonPrimVtxAfter(NULL),
170 hDCARMesonPrimVtxAfter(NULL)
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
181 //________________________________________________________________________
182 AliConversionMesonCuts::~AliConversionMesonCuts() {
184 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
186 // delete fHistograms;
187 // fHistograms = NULL;
188 if(fCutString != NULL){
192 if(fElectronLabelArray){
193 delete fElectronLabelArray;
194 fElectronLabelArray = NULL;
199 //________________________________________________________________________
200 void AliConversionMesonCuts::InitCutHistograms(TString name, Bool_t additionalHists){
202 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
203 TH1::AddDirectory(kFALSE);
205 if(fHistograms != NULL){
209 if(fHistograms==NULL){
210 fHistograms=new TList();
211 fHistograms->SetOwner(kTRUE);
212 if(name=="")fHistograms->SetName(Form("ConvMesonCuts_%s",GetCutNumber().Data()));
213 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
217 hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",13,-0.5,12.5);
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");
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");
228 fHistograms->Add(hMesonCuts);
230 hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",13,-0.5,12.5);
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");
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");
242 fHistograms->Add(hMesonBGCuts);
244 if (additionalHists){
245 hDCAGammaGammaMesonBefore=new TH1F(Form("DCAGammaGammaMeson Before %s",GetCutNumber().Data()),"DCAGammaGammaMeson Before",200,0,10);
246 fHistograms->Add(hDCAGammaGammaMesonBefore);
248 hDCARMesonPrimVtxBefore=new TH1F(Form("DCARMesonPrimVtx Before %s",GetCutNumber().Data()),"DCARMesonPrimVtx Before",200,0,10);
249 fHistograms->Add(hDCARMesonPrimVtxBefore);
251 hDCAZMesonPrimVtxBefore=new TH1F(Form("DCAZMesonPrimVtx Before %s",GetCutNumber().Data()),"DCAZMesonPrimVtx Before",401,-10,10);
252 fHistograms->Add(hDCAZMesonPrimVtxBefore);
256 hDCAGammaGammaMesonAfter=new TH1F(Form("DCAGammaGammaMeson After %s",GetCutNumber().Data()),"DCAGammaGammaMeson After",200,0,10);
257 fHistograms->Add(hDCAGammaGammaMesonAfter);
259 hDCAZMesonPrimVtxAfter=new TH2F(Form("InvMassDCAZMesonPrimVtx After %s",GetCutNumber().Data()),"InvMassDCAZMesonPrimVtx After",800,0,0.8,401,-10,10);
260 fHistograms->Add(hDCAZMesonPrimVtxAfter);
262 hDCARMesonPrimVtxAfter=new TH1F(Form("DCARMesonPrimVtx After %s",GetCutNumber().Data()),"DCARMesonPrimVtx After",200,0,10);
263 fHistograms->Add(hDCARMesonPrimVtxAfter);
265 TH1::AddDirectory(kTRUE);
268 //________________________________________________________________________
269 Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack, Double_t fRapidityShift){
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
273 if(!fMCStack)return kFALSE;
275 if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
276 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
278 Double_t rapidity = 10.;
279 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
280 rapidity=8.-fRapidityShift;
282 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
286 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
288 // Select only -> 2y decay channel
289 if(fMCMother->GetNDaughters()!=2)return kFALSE;
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;}
304 //________________________________________________________________________
305 Bool_t AliConversionMesonCuts::MesonIsSelectedAODMC(AliAODMCParticle *MCMother,TClonesArray *AODMCArray, Double_t fRapidityShift){
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
309 if(!AODMCArray)return kFALSE;
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
315 Double_t rapidity = 10.;
316 if(MCMother->E() - MCMother->Pz() == 0 || MCMother->E() + MCMother->Pz() == 0){
317 rapidity=8.-fRapidityShift;
319 rapidity = 0.5*(TMath::Log((MCMother->E()+MCMother->Pz()) / (MCMother->E()-MCMother->Pz())))-fRapidityShift;
323 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
325 // Select only -> 2y decay channel
326 if(MCMother->GetNDaughters()!=2)return kFALSE;
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;}
342 //________________________________________________________________________
343 Bool_t AliConversionMesonCuts::MesonIsSelectedMCDalitz(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelelectron, Int_t &labelpositron, Int_t &labelgamma, Double_t fRapidityShift){
345 // Returns true for all pions within acceptance cuts for decay into 2 photons
346 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
348 if( !fMCStack )return kFALSE;
350 if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
352 if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
354 Double_t rapidity = 10.;
356 if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
357 rapidity=8.-fRapidityShift;
360 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
364 if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
366 // Select only -> Dalitz decay channel
367 if( fMCMother->GetNDaughters() != 3 )return kFALSE;
369 TParticle *positron = 0x0;
370 TParticle *electron = 0x0;
371 TParticle *gamma = 0x0;
373 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
375 TParticle* temp = (TParticle*)fMCStack->Particle( index );
377 switch( temp->GetPdgCode() ) {
380 labelpositron = index;
384 labelelectron = index;
393 if( positron && electron && gamma) return kTRUE;
397 //________________________________________________________________________
398 Bool_t AliConversionMesonCuts::MesonIsSelectedMCEtaPiPlPiMiGamma(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelNegPion, Int_t &labelPosPion, Int_t &labelGamma, Double_t fRapidityShift){
400 // Returns true for all pions within acceptance cuts for decay into 2 photons
401 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
403 if( !fMCStack )return kFALSE;
405 if( fMCMother->GetPdgCode() != 221 ) return kFALSE;
407 if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
409 Double_t rapidity = 10.;
411 if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
412 rapidity=8.-fRapidityShift;
415 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
419 if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
421 // Select only -> Dalitz decay channel
422 if( fMCMother->GetNDaughters() != 3 )return kFALSE;
424 TParticle *posPion = 0x0;
425 TParticle *negPion = 0x0;
426 TParticle *gamma = 0x0;
428 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
430 TParticle* temp = (TParticle*)fMCStack->Particle( index );
432 switch( temp->GetPdgCode() ) {
435 labelPosPion = index;
439 labelNegPion = index;
448 if( posPion && negPion && gamma) return kTRUE;
452 //________________________________________________________________________
453 Bool_t AliConversionMesonCuts::MesonIsSelectedMCChiC(TParticle *fMCMother,AliStack *fMCStack,Int_t & labelelectronChiC, Int_t & labelpositronChiC, Int_t & labelgammaChiC, Double_t fRapidityShift){
454 // Returns true for all ChiC within acceptance cuts for decay into JPsi + gamma -> e+ + e- + gamma
455 // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
457 if(!fMCStack)return kFALSE;
458 // if(fMCMother->GetPdgCode()==20443 ){
461 if(fMCMother->GetPdgCode()==10441 || fMCMother->GetPdgCode()==10443 || fMCMother->GetPdgCode()==445 ){
462 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
464 Double_t rapidity = 10.;
465 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
466 rapidity=8.-fRapidityShift;
469 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
473 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
475 // Select only -> ChiC radiative (JPsi+gamma) decay channel
476 if(fMCMother->GetNDaughters()!=2)return kFALSE;
478 TParticle *jpsi = 0x0;
479 TParticle *gamma = 0x0;
480 TParticle *positron = 0x0;
481 TParticle *electron = 0x0;
483 Int_t labeljpsiChiC = -1;
485 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
487 TParticle* temp = (TParticle*)fMCStack->Particle( index );
489 switch( temp->GetPdgCode() ) {
492 labeljpsiChiC = index;
496 labelgammaChiC = index;
501 if ( !jpsi || ! gamma) return kFALSE;
502 if(jpsi->GetNDaughters()!=2)return kFALSE;
505 for(Int_t index= jpsi->GetFirstDaughter();index<= jpsi->GetLastDaughter();index++){
506 TParticle* temp = (TParticle*)fMCStack->Particle( index );
507 switch( temp->GetPdgCode() ) {
510 labelelectronChiC = index;
514 labelpositronChiC = index;
518 if( !electron || !positron) return kFALSE;
519 if( positron && electron && gamma) return kTRUE;
526 ///________________________________________________________________________
527 Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal, Double_t fRapidityShift)
530 // Selection of reconstructed Meson candidates
531 // Use flag IsSignal in order to fill Fill different
532 // histograms for Signal and Background
535 if(IsSignal){hist=hMesonCuts;}
536 else{hist=hMesonBGCuts;}
540 if(hist)hist->Fill(cutIndex);
543 // Undefined Rapidity -> Floating Point exception
544 if((pi0->E()+pi0->Pz())/(pi0->E()-pi0->Pz())<=0){
545 if(hist)hist->Fill(cutIndex);
547 // cout << "undefined rapidity" << endl;
551 // PseudoRapidity Cut --> But we cut on Rapidity !!!
553 if(abs(pi0->Rapidity()-fRapidityShift)>fRapidityCutMeson){
554 if(hist)hist->Fill(cutIndex);
555 // cout << abs(pi0->Rapidity()-fRapidityShift) << ">" << fRapidityCutMeson << endl;
562 //fOpeningAngle=2*TMath::ATan(0.134/pi0->P());// physical minimum opening angle
563 if( pi0->GetOpeningAngle() < fOpeningAngle){
564 // cout << pi0->GetOpeningAngle() << "<" << fOpeningAngle << endl;
565 if(hist)hist->Fill(cutIndex);
570 if ( fAlphaPtDepCut == kTRUE ) {
572 fAlphaCutMeson = fFAlphaCut->Eval( pi0->Pt() );
577 if(pi0->GetAlpha()>fAlphaCutMeson){
578 // cout << pi0->GetAlpha() << ">" << fAlphaCutMeson << endl;
579 if(hist)hist->Fill(cutIndex);
585 if(pi0->GetAlpha()<fAlphaMinCutMeson){
586 // cout << pi0->GetAlpha() << "<" << fAlphaMinCutMeson << endl;
587 if(hist)hist->Fill(cutIndex);
592 if (hDCAGammaGammaMesonBefore)hDCAGammaGammaMesonBefore->Fill(pi0->GetDCABetweenPhotons());
593 if (hDCARMesonPrimVtxBefore)hDCARMesonPrimVtxBefore->Fill(pi0->GetDCARMotherPrimVtx());
595 if (pi0->GetDCABetweenPhotons() > fDCAGammaGammaCut){
596 // cout << pi0->GetDCABetweenPhotons() << ">" << fDCAGammaGammaCut << endl;
597 if(hist)hist->Fill(cutIndex);
602 if (pi0->GetDCARMotherPrimVtx() > fDCARMesonPrimVtxCut){
603 // cout << pi0->GetDCARMotherPrimVtx() << ">" << fDCARMesonPrimVtxCut << endl;
604 if(hist)hist->Fill(cutIndex);
610 if (hDCAZMesonPrimVtxBefore)hDCAZMesonPrimVtxBefore->Fill(pi0->GetDCAZMotherPrimVtx());
612 if (abs(pi0->GetDCAZMotherPrimVtx()) > fDCAZMesonPrimVtxCut){
613 // cout << pi0->GetDCAZMotherPrimVtx() << ">" << fDCAZMesonPrimVtxCut << endl;
614 if(hist)hist->Fill(cutIndex);
620 if (hDCAGammaGammaMesonAfter)hDCAGammaGammaMesonAfter->Fill(pi0->GetDCABetweenPhotons());
621 if (hDCARMesonPrimVtxAfter)hDCARMesonPrimVtxAfter->Fill(pi0->GetDCARMotherPrimVtx());
622 if (hDCAZMesonPrimVtxAfter)hDCAZMesonPrimVtxAfter->Fill(pi0->M(),pi0->GetDCAZMotherPrimVtx());
624 if(hist)hist->Fill(cutIndex);
630 ///________________________________________________________________________
631 ///________________________________________________________________________
632 Bool_t AliConversionMesonCuts::UpdateCutString() {
633 ///Update the cut string (if it has been created yet)
635 if(fCutString && fCutString->GetString().Length() == kNCuts) {
636 fCutString->SetString(GetCutNumber());
643 ///________________________________________________________________________
644 Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
645 // Initialize Cuts from a given Cut string
646 AliInfo(Form("Set Meson Cutnumber: %s",analysisCutSelection.Data()));
647 if(analysisCutSelection.Length()!=kNCuts) {
648 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
651 if(!analysisCutSelection.IsDigit()){
652 AliError("Cut selection contains characters");
656 const char *cutSelection = analysisCutSelection.Data();
657 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
658 for(Int_t ii=0;ii<kNCuts;ii++){
662 // Set Individual Cuts
663 for(Int_t ii=0;ii<kNCuts;ii++){
664 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
670 ///________________________________________________________________________
671 Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
672 ///Set individual cut ID
674 //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;
677 if( SetMesonKind(value)) {
678 fCuts[kMesonKind] = value;
681 } else return kFALSE;
683 if( SetChi2MesonCut(value)) {
684 fCuts[kchi2MesonCut] = value;
687 } else return kFALSE;
689 if( SetAlphaMesonCut(value)) {
690 fCuts[kalphaMesonCut] = value;
693 } else return kFALSE;
695 if( SetRCut(value)) {
696 fCuts[kRCut] = value;
699 } else return kFALSE;
701 case kRapidityMesonCut:
702 if( SetRapidityMesonCut(value)) {
703 fCuts[kRapidityMesonCut] = value;
706 } else return kFALSE;
708 case kBackgroundScheme:
709 if( SetBackgroundScheme(value)) {
710 fCuts[kBackgroundScheme] = value;
713 } else return kFALSE;
715 case kDegreesForRotationMethod:
716 if( SetNDegreesForRotationMethod(value)) {
717 fCuts[kDegreesForRotationMethod] = value;
720 } else return kFALSE;
722 case kNumberOfBGEvents:
723 if( SetNumberOfBGEvents(value)) {
724 fCuts[kNumberOfBGEvents] = value;
727 } else return kFALSE;
729 case kuseMCPSmearing:
730 if( SetMCPSmearing(value)) {
731 fCuts[kuseMCPSmearing] = value;
734 } else return kFALSE;
736 if( SetSharedElectronCut(value)) {
737 fCuts[kElecShare] = value;
740 } else return kFALSE;
742 if( SetToCloseV0sCut(value)) {
743 fCuts[kToCloseV0s] = value;
746 } else return kFALSE;
748 if( SetDCAGammaGammaCut(value)) {
749 fCuts[kDcaGammaGamma] = value;
752 } else return kFALSE;
754 if( SetDCAZMesonPrimVtxCut(value)) {
755 fCuts[kDcaZPrimVtx] = value;
758 } else return kFALSE;
760 if( SetDCARMesonPrimVtxCut(value)) {
761 fCuts[kDcaRPrimVtx] = value;
764 } else return kFALSE;
767 cout << "Error:: Cut id out of range"<< endl;
771 cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
777 ///________________________________________________________________________
778 void AliConversionMesonCuts::PrintCuts() {
779 // Print out current Cut Selection
780 for(Int_t ic = 0; ic < kNCuts; ic++) {
781 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
785 ///________________________________________________________________________
786 Bool_t AliConversionMesonCuts::SetMesonKind(Int_t mesonKind){
796 cout<<"Warning: Meson kind not defined"<<mesonKind<<endl;
802 ///________________________________________________________________________
803 Bool_t AliConversionMesonCuts::SetRCut(Int_t rCut){
824 // High purity cuts for PbPb
829 cout<<"Warning: rCut not defined"<<rCut<<endl;
835 ///________________________________________________________________________
836 Bool_t AliConversionMesonCuts::SetChi2MesonCut(Int_t chi2MesonCut){
838 switch(chi2MesonCut){
840 fChi2CutMeson = 100.;
849 fChi2CutMeson = 200.;
852 fChi2CutMeson = 500.;
855 fChi2CutMeson = 1000.;
858 cout<<"Warning: Chi2MesonCut not defined "<<chi2MesonCut<<endl;
865 ///________________________________________________________________________
866 Bool_t AliConversionMesonCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
868 switch(alphaMesonCut){
870 fAlphaMinCutMeson = 0.0;
871 fAlphaCutMeson = 0.7;
872 fAlphaPtDepCut = kFALSE;
874 case 1: // Updated 31 October 2013 before 0.0 - 0.5
875 if( fFAlphaCut ) delete fFAlphaCut;
876 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
877 fFAlphaCut->SetParameter(0,0.7);
878 fFAlphaCut->SetParameter(1,1.2);
879 fAlphaMinCutMeson = 0.0;
880 fAlphaCutMeson = -1.0;
881 fAlphaPtDepCut = kTRUE;
883 case 2: // Updated 31 October 2013 before 0.5-1
884 if( fFAlphaCut ) delete fFAlphaCut;
885 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
886 fFAlphaCut->SetParameter(0,0.8);
887 fFAlphaCut->SetParameter(1,1.2);
888 fAlphaMinCutMeson = 0.0;
889 fAlphaCutMeson = -1.0;
890 fAlphaPtDepCut = kTRUE;
893 fAlphaMinCutMeson = 0.0;
895 fAlphaPtDepCut = kFALSE;
898 fAlphaMinCutMeson = 0.0;
899 fAlphaCutMeson = 0.65;
900 fAlphaPtDepCut = kFALSE;
903 fAlphaMinCutMeson = 0.0;
904 fAlphaCutMeson = 0.75;
905 fAlphaPtDepCut = kFALSE;
908 fAlphaMinCutMeson = 0.0;
909 fAlphaCutMeson = 0.8;
910 fAlphaPtDepCut = kFALSE;
913 fAlphaMinCutMeson = 0.0;
914 fAlphaCutMeson = 0.85;
915 fAlphaPtDepCut = kFALSE;
918 fAlphaMinCutMeson = 0.0;
919 fAlphaCutMeson = 0.6;
920 fAlphaPtDepCut = kFALSE;
922 case 9: // Updated 11 November 2013 before 0.0 - 0.3
923 if( fFAlphaCut ) delete fFAlphaCut;
924 fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
925 fFAlphaCut->SetParameter(0,0.65);
926 fFAlphaCut->SetParameter(1,1.2);
927 fAlphaMinCutMeson = 0.0;
928 fAlphaCutMeson = -1.0;
929 fAlphaPtDepCut = kTRUE;
932 cout<<"Warning: AlphaMesonCut not defined "<<alphaMesonCut<<endl;
938 ///________________________________________________________________________
939 Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
941 switch(RapidityMesonCut){
942 case 0: // changed from 0.9 to 1.35
943 fRapidityCutMeson = 1.35;
946 fRapidityCutMeson = 0.8;
949 fRapidityCutMeson = 0.7;
952 fRapidityCutMeson = 0.6;
955 fRapidityCutMeson = 0.5;
958 fRapidityCutMeson = 0.85;
961 fRapidityCutMeson = 0.75;
964 fRapidityCutMeson = 0.3;
967 fRapidityCutMeson = 0.35;
970 fRapidityCutMeson = 0.4;
973 cout<<"Warning: RapidityMesonCut not defined "<<RapidityMesonCut<<endl;
980 ///________________________________________________________________________
981 Bool_t AliConversionMesonCuts::SetBackgroundScheme(Int_t BackgroundScheme){
983 switch(BackgroundScheme){
985 fUseRotationMethodInBG=kTRUE;
986 fdoBGProbability=kFALSE;
988 case 1: // mixed event with V0 multiplicity
989 fUseRotationMethodInBG=kFALSE;
990 fUseTrackMultiplicityForBG=kFALSE;
991 fdoBGProbability=kFALSE;
993 case 2: // mixed event with track multiplicity
994 fUseRotationMethodInBG=kFALSE;
995 fUseTrackMultiplicityForBG=kTRUE;
996 fdoBGProbability=kFALSE;
999 fUseRotationMethodInBG=kTRUE;
1000 fdoBGProbability=kTRUE;
1002 case 4: //No BG calculation
1003 cout << "no BG calculation should be done" << endl;
1004 fUseRotationMethodInBG=kFALSE;
1005 fdoBGProbability=kFALSE;
1009 fUseRotationMethodInBG=kTRUE;
1010 fdoBGProbability=kFALSE;
1011 fBackgroundHandler = 1;
1013 case 6: // mixed event with V0 multiplicity
1014 fUseRotationMethodInBG=kFALSE;
1015 fUseTrackMultiplicityForBG=kFALSE;
1016 fdoBGProbability=kFALSE;
1017 fBackgroundHandler = 1;
1019 case 7: // mixed event with track multiplicity
1020 fUseRotationMethodInBG=kFALSE;
1021 fUseTrackMultiplicityForBG=kTRUE;
1022 fdoBGProbability=kFALSE;
1023 fBackgroundHandler = 1;
1026 fUseRotationMethodInBG=kTRUE;
1027 fdoBGProbability=kTRUE;
1028 fBackgroundHandler = 1;
1031 cout<<"Warning: BackgroundScheme not defined "<<BackgroundScheme<<endl;
1038 ///________________________________________________________________________
1039 Bool_t AliConversionMesonCuts::SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod){
1041 switch(DegreesForRotationMethod){
1043 fnDegreeRotationPMForBG = 5;
1046 fnDegreeRotationPMForBG = 10;
1049 fnDegreeRotationPMForBG = 15;
1052 fnDegreeRotationPMForBG = 20;
1055 cout<<"Warning: DegreesForRotationMethod not defined "<<DegreesForRotationMethod<<endl;
1058 fCuts[kDegreesForRotationMethod]=DegreesForRotationMethod;
1062 ///________________________________________________________________________
1063 Bool_t AliConversionMesonCuts::SetNumberOfBGEvents(Int_t NumberOfBGEvents){
1065 switch(NumberOfBGEvents){
1067 fNumberOfBGEvents = 5;
1070 fNumberOfBGEvents = 10;
1073 fNumberOfBGEvents = 15;
1076 fNumberOfBGEvents = 20;
1079 fNumberOfBGEvents = 2;
1082 fNumberOfBGEvents = 50;
1085 fNumberOfBGEvents = 80;
1088 fNumberOfBGEvents = 100;
1091 cout<<"Warning: NumberOfBGEvents not defined "<<NumberOfBGEvents<<endl;
1096 ///________________________________________________________________________
1097 Bool_t AliConversionMesonCuts::SetSharedElectronCut(Int_t sharedElec) {
1101 fDoSharedElecCut = kFALSE;
1104 fDoSharedElecCut = kTRUE;
1107 cout<<"Warning: Shared Electron Cut not defined "<<sharedElec<<endl;
1114 ///________________________________________________________________________
1115 Bool_t AliConversionMesonCuts::SetToCloseV0sCut(Int_t toClose) {
1119 fDoToCloseV0sCut = kFALSE;
1123 fDoToCloseV0sCut = kTRUE;
1127 fDoToCloseV0sCut = kTRUE;
1131 fDoToCloseV0sCut = kTRUE;
1135 cout<<"Warning: Shared Electron Cut not defined "<<toClose<<endl;
1141 ///________________________________________________________________________
1142 Bool_t AliConversionMesonCuts::SetMCPSmearing(Int_t useMCPSmearing)
1144 switch(useMCPSmearing){
1149 fPSigSmearingCte=0.;
1153 fPBremSmearing=1.0e-14;
1155 fPSigSmearingCte=0.;
1159 fPBremSmearing=1.0e-15;
1161 fPSigSmearingCte=0.;
1166 fPSigSmearing=0.003;
1167 fPSigSmearingCte=0.002;
1172 fPSigSmearing=0.003;
1173 fPSigSmearingCte=0.007;
1178 fPSigSmearing=0.003;
1179 fPSigSmearingCte=0.016;
1184 fPSigSmearing=0.007;
1185 fPSigSmearingCte=0.016;
1189 fPBremSmearing=1.0e-16;
1191 fPSigSmearingCte=0.;
1196 fPSigSmearing=0.007;
1197 fPSigSmearingCte=0.014;
1202 fPSigSmearing=0.007;
1203 fPSigSmearingCte=0.011;
1207 AliError("Warning: UseMCPSmearing not defined");
1214 ///________________________________________________________________________
1215 Bool_t AliConversionMesonCuts::SetDCAGammaGammaCut(Int_t DCAGammaGamma){
1217 switch(DCAGammaGamma){
1219 fDCAGammaGammaCut = 1000;
1222 fDCAGammaGammaCut = 10;
1225 fDCAGammaGammaCut = 5;
1228 fDCAGammaGammaCut = 4;
1231 fDCAGammaGammaCut = 3;
1234 fDCAGammaGammaCut = 2.5;
1237 fDCAGammaGammaCut = 2;
1240 fDCAGammaGammaCut = 1.5;
1243 fDCAGammaGammaCut = 1;
1246 fDCAGammaGammaCut = 0.5;
1249 cout<<"Warning: DCAGammaGamma not defined "<<DCAGammaGamma<<endl;
1255 ///________________________________________________________________________
1256 Bool_t AliConversionMesonCuts::SetDCAZMesonPrimVtxCut(Int_t DCAZMesonPrimVtx){
1258 switch(DCAZMesonPrimVtx){
1260 fDCAZMesonPrimVtxCut = 1000;
1263 fDCAZMesonPrimVtxCut = 10;
1266 fDCAZMesonPrimVtxCut = 5;
1269 fDCAZMesonPrimVtxCut = 4;
1272 fDCAZMesonPrimVtxCut = 3;
1275 fDCAZMesonPrimVtxCut = 2.5;
1278 fDCAZMesonPrimVtxCut = 2;
1281 fDCAZMesonPrimVtxCut = 1.5;
1284 fDCAZMesonPrimVtxCut = 1;
1287 fDCAZMesonPrimVtxCut = 0.5;
1290 cout<<"Warning: DCAZMesonPrimVtx not defined "<<DCAZMesonPrimVtx<<endl;
1296 ///________________________________________________________________________
1297 Bool_t AliConversionMesonCuts::SetDCARMesonPrimVtxCut(Int_t DCARMesonPrimVtx){
1299 switch(DCARMesonPrimVtx){
1301 fDCARMesonPrimVtxCut = 1000;
1304 fDCARMesonPrimVtxCut = 10;
1307 fDCARMesonPrimVtxCut = 5;
1310 fDCARMesonPrimVtxCut = 4;
1313 fDCARMesonPrimVtxCut = 3;
1316 fDCARMesonPrimVtxCut = 2.5;
1319 fDCARMesonPrimVtxCut = 2;
1322 fDCARMesonPrimVtxCut = 1.5;
1325 fDCARMesonPrimVtxCut = 1;
1328 fDCARMesonPrimVtxCut = 0.5;
1331 cout<<"Warning: DCARMesonPrimVtx not defined "<<DCARMesonPrimVtx<<endl;
1338 ///________________________________________________________________________
1339 TString AliConversionMesonCuts::GetCutNumber(){
1340 // returns TString with current cut number
1342 for(Int_t ii=0;ii<kNCuts;ii++){
1343 a.Append(Form("%d",fCuts[ii]));
1348 ///________________________________________________________________________
1349 void AliConversionMesonCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
1351 Int_t posLabel = photon->GetTrackLabelPositive();
1352 Int_t negLabel = photon->GetTrackLabelNegative();
1354 fElectronLabelArray[nV0*2] = posLabel;
1355 fElectronLabelArray[(nV0*2)+1] = negLabel;
1358 ///________________________________________________________________________
1359 Bool_t AliConversionMesonCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
1361 Int_t posLabel = photon->GetTrackLabelPositive();
1362 Int_t negLabel = photon->GetTrackLabelNegative();
1364 for(Int_t i = 0; i<nV0s*2;i++){
1365 if(i==nV0*2) continue;
1366 if(i==(nV0*2)+1) continue;
1367 if(fElectronLabelArray[i] == posLabel){
1369 if(fElectronLabelArray[i] == negLabel){
1375 ///________________________________________________________________________
1376 Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
1377 Double_t posX = photon->GetConversionX();
1378 Double_t posY = photon->GetConversionY();
1379 Double_t posZ = photon->GetConversionZ();
1381 for(Int_t i = 0;i<photons->GetEntries();i++){
1382 if(nV0 == i) continue;
1383 AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
1384 Double_t posCompX = photonComp->GetConversionX();
1385 Double_t posCompY = photonComp->GetConversionY();
1386 Double_t posCompZ = photonComp->GetConversionZ();
1388 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
1390 if(dist < fminV0Dist*fminV0Dist){
1391 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
1400 ///________________________________________________________________________
1401 void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
1404 if (photon==NULL) return;
1405 Double_t facPBrem = 1.;
1406 Double_t facPSig = 0.;
1415 if( photon->P()!=0){
1416 theta=acos( photon->Pz()/ photon->P());
1419 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
1420 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
1423 if( fPBremSmearing != 1.){
1425 facPBrem = fBrem->GetRandom();
1429 photon->SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
1430 photon->SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
1431 photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
1432 photon->SetE(photon->P());