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),
97 fElectronLabelArraySize(500),
98 fElectronLabelArray(NULL),
99 fDCAGammaGammaCut(1000),
100 fDCAZMesonPrimVtxCut(1000),
101 fDCARMesonPrimVtxCut(1000),
102 fBackgroundHandler(0),
106 hDCAGammaGammaMesonBefore(NULL),
107 hDCAZMesonPrimVtxBefore(NULL),
108 hDCARMesonPrimVtxBefore(NULL),
109 hDCAGammaGammaMesonAfter(NULL),
110 hDCAZMesonPrimVtxAfter(NULL),
111 hDCARMesonPrimVtxAfter(NULL)
114 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
115 fCutString=new TObjString((GetCutNumber()).Data());
116 fElectronLabelArray = new Int_t[fElectronLabelArraySize];
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);
126 //________________________________________________________________________
127 AliConversionMesonCuts::AliConversionMesonCuts(const AliConversionMesonCuts &ref) :
128 AliAnalysisCuts(ref),
130 fMesonKind(ref.fMesonKind),
132 fChi2CutMeson(ref.fChi2CutMeson),
133 fAlphaMinCutMeson(ref.fAlphaMinCutMeson),
134 fAlphaCutMeson(ref.fAlphaCutMeson),
135 fRapidityCutMeson(ref.fRapidityCutMeson),
136 fUseRotationMethodInBG(ref.fUseRotationMethodInBG),
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),
151 fRandom(ref.fRandom),
152 fElectronLabelArraySize(ref.fElectronLabelArraySize),
153 fElectronLabelArray(NULL),
154 fDCAGammaGammaCut(ref.fDCAGammaGammaCut),
155 fDCAZMesonPrimVtxCut(ref.fDCAZMesonPrimVtxCut),
156 fDCARMesonPrimVtxCut(ref.fDCARMesonPrimVtxCut),
157 fBackgroundHandler(ref.fBackgroundHandler),
161 hDCAGammaGammaMesonBefore(NULL),
162 hDCAZMesonPrimVtxBefore(NULL),
163 hDCARMesonPrimVtxBefore(NULL),
164 hDCAGammaGammaMesonAfter(NULL),
165 hDCAZMesonPrimVtxAfter(NULL),
166 hDCARMesonPrimVtxAfter(NULL)
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
177 //________________________________________________________________________
178 AliConversionMesonCuts::~AliConversionMesonCuts() {
180 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
182 // delete fHistograms;
183 // fHistograms = NULL;
184 if(fCutString != NULL){
188 if(fElectronLabelArray){
189 delete fElectronLabelArray;
190 fElectronLabelArray = NULL;
195 //________________________________________________________________________
196 void AliConversionMesonCuts::InitCutHistograms(TString name, Bool_t additionalHists){
198 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
199 TH1::AddDirectory(kFALSE);
201 if(fHistograms != NULL){
205 if(fHistograms==NULL){
206 fHistograms=new TList();
207 fHistograms->SetOwner(kTRUE);
208 if(name=="")fHistograms->SetName(Form("ConvMesonCuts_%s",GetCutNumber().Data()));
209 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
213 hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",13,-0.5,12.5);
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");
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");
224 fHistograms->Add(hMesonCuts);
226 hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",13,-0.5,12.5);
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");
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");
238 fHistograms->Add(hMesonBGCuts);
240 if (additionalHists){
241 hDCAGammaGammaMesonBefore=new TH1F(Form("DCAGammaGammaMeson Before %s",GetCutNumber().Data()),"DCAGammaGammaMeson Before",200,0,10);
242 fHistograms->Add(hDCAGammaGammaMesonBefore);
244 hDCARMesonPrimVtxBefore=new TH1F(Form("DCARMesonPrimVtx Before %s",GetCutNumber().Data()),"DCARMesonPrimVtx Before",200,0,10);
245 fHistograms->Add(hDCARMesonPrimVtxBefore);
247 hDCAZMesonPrimVtxBefore=new TH1F(Form("DCAZMesonPrimVtx Before %s",GetCutNumber().Data()),"DCAZMesonPrimVtx Before",401,-10,10);
248 fHistograms->Add(hDCAZMesonPrimVtxBefore);
252 hDCAGammaGammaMesonAfter=new TH1F(Form("DCAGammaGammaMeson After %s",GetCutNumber().Data()),"DCAGammaGammaMeson After",200,0,10);
253 fHistograms->Add(hDCAGammaGammaMesonAfter);
255 hDCAZMesonPrimVtxAfter=new TH2F(Form("InvMassDCAZMesonPrimVtx After %s",GetCutNumber().Data()),"InvMassDCAZMesonPrimVtx After",800,0,0.8,401,-10,10);
256 fHistograms->Add(hDCAZMesonPrimVtxAfter);
258 hDCARMesonPrimVtxAfter=new TH1F(Form("DCARMesonPrimVtx After %s",GetCutNumber().Data()),"DCARMesonPrimVtx After",200,0,10);
259 fHistograms->Add(hDCARMesonPrimVtxAfter);
261 TH1::AddDirectory(kTRUE);
264 //________________________________________________________________________
265 Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack, Double_t fRapidityShift){
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
269 if(!fMCStack)return kFALSE;
271 if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
272 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
274 Double_t rapidity = 10.;
275 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
276 rapidity=8.-fRapidityShift;
278 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
282 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
284 // Select only -> 2y decay channel
285 if(fMCMother->GetNDaughters()!=2)return kFALSE;
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;}
300 //________________________________________________________________________
301 Bool_t AliConversionMesonCuts::MesonIsSelectedAODMC(AliAODMCParticle *MCMother,TClonesArray *AODMCArray, Double_t fRapidityShift){
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
305 if(!AODMCArray)return kFALSE;
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
311 Double_t rapidity = 10.;
312 if(MCMother->E() - MCMother->Pz() == 0 || MCMother->E() + MCMother->Pz() == 0){
313 rapidity=8.-fRapidityShift;
315 rapidity = 0.5*(TMath::Log((MCMother->E()+MCMother->Pz()) / (MCMother->E()-MCMother->Pz())))-fRapidityShift;
319 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
321 // Select only -> 2y decay channel
322 if(MCMother->GetNDaughters()!=2)return kFALSE;
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;}
337 //________________________________________________________________________
338 Bool_t AliConversionMesonCuts::MesonIsSelectedMCDalitz(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelelectron, Int_t &labelpositron, Int_t &labelgamma, Double_t fRapidityShift){
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
343 if( !fMCStack )return kFALSE;
345 if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
347 if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
349 Double_t rapidity = 10.;
351 if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
352 rapidity=8.-fRapidityShift;
355 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
359 if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
361 // Select only -> Dalitz decay channel
362 if( fMCMother->GetNDaughters() != 3 )return kFALSE;
364 TParticle *positron = 0x0;
365 TParticle *electron = 0x0;
366 TParticle *gamma = 0x0;
368 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
370 TParticle* temp = (TParticle*)fMCStack->Particle( index );
372 switch( temp->GetPdgCode() ) {
375 labelpositron = index;
379 labelelectron = index;
388 if( positron && electron && gamma) return kTRUE;
393 //________________________________________________________________________
394 Bool_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
398 if(!fMCStack)return kFALSE;
399 // if(fMCMother->GetPdgCode()==20443 ){
402 if(fMCMother->GetPdgCode()==10441 || fMCMother->GetPdgCode()==10443 || fMCMother->GetPdgCode()==445 ){
403 if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
405 Double_t rapidity = 10.;
406 if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
407 rapidity=8.-fRapidityShift;
410 rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
414 if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
416 // Select only -> ChiC radiative (JPsi+gamma) decay channel
417 if(fMCMother->GetNDaughters()!=2)return kFALSE;
419 TParticle *jpsi = 0x0;
420 TParticle *gamma = 0x0;
421 TParticle *positron = 0x0;
422 TParticle *electron = 0x0;
424 Int_t labeljpsiChiC = -1;
426 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
428 TParticle* temp = (TParticle*)fMCStack->Particle( index );
430 switch( temp->GetPdgCode() ) {
433 labeljpsiChiC = index;
437 labelgammaChiC = index;
442 if ( !jpsi || ! gamma) return kFALSE;
443 if(jpsi->GetNDaughters()!=2)return kFALSE;
446 for(Int_t index= jpsi->GetFirstDaughter();index<= jpsi->GetLastDaughter();index++){
447 TParticle* temp = (TParticle*)fMCStack->Particle( index );
448 switch( temp->GetPdgCode() ) {
451 labelelectronChiC = index;
455 labelpositronChiC = index;
459 if( !electron || !positron) return kFALSE;
460 if( positron && electron && gamma) return kTRUE;
467 ///________________________________________________________________________
468 Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal, Double_t fRapidityShift)
471 // Selection of reconstructed Meson candidates
472 // Use flag IsSignal in order to fill Fill different
473 // histograms for Signal and Background
476 if(IsSignal){hist=hMesonCuts;}
477 else{hist=hMesonBGCuts;}
481 if(hist)hist->Fill(cutIndex);
484 // Undefined Rapidity -> Floating Point exception
485 if((pi0->E()+pi0->Pz())/(pi0->E()-pi0->Pz())<=0){
486 if(hist)hist->Fill(cutIndex);
491 // PseudoRapidity Cut --> But we cut on Rapidity !!!
493 if(abs(pi0->Rapidity()-fRapidityShift)>fRapidityCutMeson){
494 if(hist)hist->Fill(cutIndex);
501 //fOpeningAngle=2*TMath::ATan(0.134/pi0->P());// physical minimum opening angle
502 if( pi0->GetOpeningAngle() < fOpeningAngle){
503 if(hist)hist->Fill(cutIndex);
509 if(pi0->GetAlpha()>fAlphaCutMeson){
510 if(hist)hist->Fill(cutIndex);
516 if(pi0->GetAlpha()<fAlphaMinCutMeson){
517 if(hist)hist->Fill(cutIndex);
522 if (hDCAGammaGammaMesonBefore)hDCAGammaGammaMesonBefore->Fill(pi0->GetDCABetweenPhotons());
523 if (hDCARMesonPrimVtxBefore)hDCARMesonPrimVtxBefore->Fill(pi0->GetDCARMotherPrimVtx());
525 if (pi0->GetDCABetweenPhotons() > fDCAGammaGammaCut){
526 if(hist)hist->Fill(cutIndex);
531 if (pi0->GetDCARMotherPrimVtx() > fDCARMesonPrimVtxCut){
532 if(hist)hist->Fill(cutIndex);
538 if (hDCAZMesonPrimVtxBefore)hDCAZMesonPrimVtxBefore->Fill(pi0->GetDCAZMotherPrimVtx());
540 if (abs(pi0->GetDCAZMotherPrimVtx()) > fDCAZMesonPrimVtxCut){
541 if(hist)hist->Fill(cutIndex);
547 if (hDCAGammaGammaMesonAfter)hDCAGammaGammaMesonAfter->Fill(pi0->GetDCABetweenPhotons());
548 if (hDCARMesonPrimVtxAfter)hDCARMesonPrimVtxAfter->Fill(pi0->GetDCARMotherPrimVtx());
549 if (hDCAZMesonPrimVtxAfter)hDCAZMesonPrimVtxAfter->Fill(pi0->M(),pi0->GetDCAZMotherPrimVtx());
551 if(hist)hist->Fill(cutIndex);
557 ///________________________________________________________________________
558 ///________________________________________________________________________
559 Bool_t AliConversionMesonCuts::UpdateCutString() {
560 ///Update the cut string (if it has been created yet)
562 if(fCutString && fCutString->GetString().Length() == kNCuts) {
563 fCutString->SetString(GetCutNumber());
570 ///________________________________________________________________________
571 Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
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));
578 if(!analysisCutSelection.IsDigit()){
579 AliError("Cut selection contains characters");
583 const char *cutSelection = analysisCutSelection.Data();
584 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
585 for(Int_t ii=0;ii<kNCuts;ii++){
589 // Set Individual Cuts
590 for(Int_t ii=0;ii<kNCuts;ii++){
591 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
597 ///________________________________________________________________________
598 Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
599 ///Set individual cut ID
601 //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;
604 if( SetMesonKind(value)) {
605 fCuts[kMesonKind] = value;
608 } else return kFALSE;
610 if( SetChi2MesonCut(value)) {
611 fCuts[kchi2MesonCut] = value;
614 } else return kFALSE;
616 if( SetAlphaMesonCut(value)) {
617 fCuts[kalphaMesonCut] = value;
620 } else return kFALSE;
622 if( SetRCut(value)) {
623 fCuts[kRCut] = value;
626 } else return kFALSE;
628 case kRapidityMesonCut:
629 if( SetRapidityMesonCut(value)) {
630 fCuts[kRapidityMesonCut] = value;
633 } else return kFALSE;
635 case kBackgroundScheme:
636 if( SetBackgroundScheme(value)) {
637 fCuts[kBackgroundScheme] = value;
640 } else return kFALSE;
642 case kDegreesForRotationMethod:
643 if( SetNDegreesForRotationMethod(value)) {
644 fCuts[kDegreesForRotationMethod] = value;
647 } else return kFALSE;
649 case kNumberOfBGEvents:
650 if( SetNumberOfBGEvents(value)) {
651 fCuts[kNumberOfBGEvents] = value;
654 } else return kFALSE;
656 case kuseMCPSmearing:
657 if( SetMCPSmearing(value)) {
658 fCuts[kuseMCPSmearing] = value;
661 } else return kFALSE;
663 if( SetSharedElectronCut(value)) {
664 fCuts[kElecShare] = value;
667 } else return kFALSE;
669 if( SetToCloseV0sCut(value)) {
670 fCuts[kToCloseV0s] = value;
673 } else return kFALSE;
675 if( SetDCAGammaGammaCut(value)) {
676 fCuts[kDcaGammaGamma] = value;
679 } else return kFALSE;
681 if( SetDCAZMesonPrimVtxCut(value)) {
682 fCuts[kDcaZPrimVtx] = value;
685 } else return kFALSE;
687 if( SetDCARMesonPrimVtxCut(value)) {
688 fCuts[kDcaRPrimVtx] = value;
691 } else return kFALSE;
694 cout << "Error:: Cut id out of range"<< endl;
698 cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
704 ///________________________________________________________________________
705 void AliConversionMesonCuts::PrintCuts() {
706 // Print out current Cut Selection
707 for(Int_t ic = 0; ic < kNCuts; ic++) {
708 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
712 ///________________________________________________________________________
713 Bool_t AliConversionMesonCuts::SetMesonKind(Int_t mesonKind){
723 cout<<"Warning: Meson kind not defined"<<mesonKind<<endl;
729 ///________________________________________________________________________
730 Bool_t AliConversionMesonCuts::SetRCut(Int_t rCut){
751 // High purity cuts for PbPb
756 cout<<"Warning: rCut not defined"<<rCut<<endl;
762 ///________________________________________________________________________
763 Bool_t AliConversionMesonCuts::SetChi2MesonCut(Int_t chi2MesonCut){
765 switch(chi2MesonCut){
767 fChi2CutMeson = 100.;
776 fChi2CutMeson = 200.;
779 fChi2CutMeson = 500.;
782 fChi2CutMeson = 1000.;
785 cout<<"Warning: Chi2MesonCut not defined "<<chi2MesonCut<<endl;
792 ///________________________________________________________________________
793 Bool_t AliConversionMesonCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
795 switch(alphaMesonCut){
797 fAlphaMinCutMeson = 0.0;
798 fAlphaCutMeson = 0.7;
801 fAlphaMinCutMeson = 0.0;
802 fAlphaCutMeson = 0.5;
805 fAlphaMinCutMeson = 0.5;
809 fAlphaMinCutMeson = 0.0;
813 fAlphaMinCutMeson = 0.0;
814 fAlphaCutMeson = 0.65;
817 fAlphaMinCutMeson = 0.0;
818 fAlphaCutMeson = 0.75;
821 fAlphaMinCutMeson = 0.0;
822 fAlphaCutMeson = 0.8;
825 fAlphaMinCutMeson = 0.0;
826 fAlphaCutMeson = 0.85;
829 fAlphaMinCutMeson = 0.0;
830 fAlphaCutMeson = 0.6;
833 fAlphaMinCutMeson = 0.0;
834 fAlphaCutMeson = 0.3;
837 cout<<"Warning: AlphaMesonCut not defined "<<alphaMesonCut<<endl;
843 ///________________________________________________________________________
844 Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
846 switch(RapidityMesonCut){
848 fRapidityCutMeson = 0.9;
851 fRapidityCutMeson = 0.8;
854 fRapidityCutMeson = 0.7;
857 fRapidityCutMeson = 0.6;
860 fRapidityCutMeson = 0.5;
863 fRapidityCutMeson = 0.85;
866 fRapidityCutMeson = 0.75;
869 fRapidityCutMeson = 0.3;
872 fRapidityCutMeson = 0.35;
875 fRapidityCutMeson = 0.4;
878 cout<<"Warning: RapidityMesonCut not defined "<<RapidityMesonCut<<endl;
885 ///________________________________________________________________________
886 Bool_t AliConversionMesonCuts::SetBackgroundScheme(Int_t BackgroundScheme){
888 switch(BackgroundScheme){
890 fUseRotationMethodInBG=kTRUE;
891 fdoBGProbability=kFALSE;
893 case 1: // mixed event with V0 multiplicity
894 fUseRotationMethodInBG=kFALSE;
895 fUseTrackMultiplicityForBG=kFALSE;
896 fdoBGProbability=kFALSE;
898 case 2: // mixed event with track multiplicity
899 fUseRotationMethodInBG=kFALSE;
900 fUseTrackMultiplicityForBG=kTRUE;
901 fdoBGProbability=kFALSE;
904 fUseRotationMethodInBG=kTRUE;
905 fdoBGProbability=kTRUE;
907 case 4: //No BG calculation
908 cout << "no BG calculation should be done" << endl;
909 fUseRotationMethodInBG=kFALSE;
910 fdoBGProbability=kFALSE;
914 fUseRotationMethodInBG=kTRUE;
915 fdoBGProbability=kFALSE;
916 fBackgroundHandler = 1;
918 case 6: // mixed event with V0 multiplicity
919 fUseRotationMethodInBG=kFALSE;
920 fUseTrackMultiplicityForBG=kFALSE;
921 fdoBGProbability=kFALSE;
922 fBackgroundHandler = 1;
924 case 7: // mixed event with track multiplicity
925 fUseRotationMethodInBG=kFALSE;
926 fUseTrackMultiplicityForBG=kTRUE;
927 fdoBGProbability=kFALSE;
928 fBackgroundHandler = 1;
931 fUseRotationMethodInBG=kTRUE;
932 fdoBGProbability=kTRUE;
933 fBackgroundHandler = 1;
936 cout<<"Warning: BackgroundScheme not defined "<<BackgroundScheme<<endl;
943 ///________________________________________________________________________
944 Bool_t AliConversionMesonCuts::SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod){
946 switch(DegreesForRotationMethod){
948 fnDegreeRotationPMForBG = 5;
951 fnDegreeRotationPMForBG = 10;
954 fnDegreeRotationPMForBG = 15;
957 fnDegreeRotationPMForBG = 20;
960 cout<<"Warning: DegreesForRotationMethod not defined "<<DegreesForRotationMethod<<endl;
963 fCuts[kDegreesForRotationMethod]=DegreesForRotationMethod;
967 ///________________________________________________________________________
968 Bool_t AliConversionMesonCuts::SetNumberOfBGEvents(Int_t NumberOfBGEvents){
970 switch(NumberOfBGEvents){
972 fNumberOfBGEvents = 5;
975 fNumberOfBGEvents = 10;
978 fNumberOfBGEvents = 15;
981 fNumberOfBGEvents = 20;
984 fNumberOfBGEvents = 2;
987 fNumberOfBGEvents = 50;
990 fNumberOfBGEvents = 80;
993 fNumberOfBGEvents = 100;
996 cout<<"Warning: NumberOfBGEvents not defined "<<NumberOfBGEvents<<endl;
1001 ///________________________________________________________________________
1002 Bool_t AliConversionMesonCuts::SetSharedElectronCut(Int_t sharedElec) {
1006 fDoSharedElecCut = kFALSE;
1009 fDoSharedElecCut = kTRUE;
1012 cout<<"Warning: Shared Electron Cut not defined "<<sharedElec<<endl;
1019 ///________________________________________________________________________
1020 Bool_t AliConversionMesonCuts::SetToCloseV0sCut(Int_t toClose) {
1024 fDoToCloseV0sCut = kFALSE;
1028 fDoToCloseV0sCut = kTRUE;
1032 fDoToCloseV0sCut = kTRUE;
1036 fDoToCloseV0sCut = kTRUE;
1040 cout<<"Warning: Shared Electron Cut not defined "<<toClose<<endl;
1046 ///________________________________________________________________________
1047 Bool_t AliConversionMesonCuts::SetMCPSmearing(Int_t useMCPSmearing)
1049 switch(useMCPSmearing){
1054 fPSigSmearingCte=0.;
1058 fPBremSmearing=1.0e-14;
1060 fPSigSmearingCte=0.;
1064 fPBremSmearing=1.0e-15;
1066 fPSigSmearingCte=0.;
1071 fPSigSmearing=0.003;
1072 fPSigSmearingCte=0.002;
1077 fPSigSmearing=0.003;
1078 fPSigSmearingCte=0.007;
1083 fPSigSmearing=0.003;
1084 fPSigSmearingCte=0.016;
1089 fPSigSmearing=0.007;
1090 fPSigSmearingCte=0.016;
1094 fPBremSmearing=1.0e-16;
1096 fPSigSmearingCte=0.;
1101 fPSigSmearing=0.007;
1102 fPSigSmearingCte=0.014;
1107 fPSigSmearing=0.007;
1108 fPSigSmearingCte=0.011;
1112 AliError("Warning: UseMCPSmearing not defined");
1119 ///________________________________________________________________________
1120 Bool_t AliConversionMesonCuts::SetDCAGammaGammaCut(Int_t DCAGammaGamma){
1122 switch(DCAGammaGamma){
1124 fDCAGammaGammaCut = 1000;
1127 fDCAGammaGammaCut = 10;
1130 fDCAGammaGammaCut = 5;
1133 fDCAGammaGammaCut = 4;
1136 fDCAGammaGammaCut = 3;
1139 fDCAGammaGammaCut = 2.5;
1142 fDCAGammaGammaCut = 2;
1145 fDCAGammaGammaCut = 1.5;
1148 fDCAGammaGammaCut = 1;
1151 fDCAGammaGammaCut = 0.5;
1154 cout<<"Warning: DCAGammaGamma not defined "<<DCAGammaGamma<<endl;
1160 ///________________________________________________________________________
1161 Bool_t AliConversionMesonCuts::SetDCAZMesonPrimVtxCut(Int_t DCAZMesonPrimVtx){
1163 switch(DCAZMesonPrimVtx){
1165 fDCAZMesonPrimVtxCut = 1000;
1168 fDCAZMesonPrimVtxCut = 10;
1171 fDCAZMesonPrimVtxCut = 5;
1174 fDCAZMesonPrimVtxCut = 4;
1177 fDCAZMesonPrimVtxCut = 3;
1180 fDCAZMesonPrimVtxCut = 2.5;
1183 fDCAZMesonPrimVtxCut = 2;
1186 fDCAZMesonPrimVtxCut = 1.5;
1189 fDCAZMesonPrimVtxCut = 1;
1192 fDCAZMesonPrimVtxCut = 0.5;
1195 cout<<"Warning: DCAZMesonPrimVtx not defined "<<DCAZMesonPrimVtx<<endl;
1201 ///________________________________________________________________________
1202 Bool_t AliConversionMesonCuts::SetDCARMesonPrimVtxCut(Int_t DCARMesonPrimVtx){
1204 switch(DCARMesonPrimVtx){
1206 fDCARMesonPrimVtxCut = 1000;
1209 fDCARMesonPrimVtxCut = 10;
1212 fDCARMesonPrimVtxCut = 5;
1215 fDCARMesonPrimVtxCut = 4;
1218 fDCARMesonPrimVtxCut = 3;
1221 fDCARMesonPrimVtxCut = 2.5;
1224 fDCARMesonPrimVtxCut = 2;
1227 fDCARMesonPrimVtxCut = 1.5;
1230 fDCARMesonPrimVtxCut = 1;
1233 fDCARMesonPrimVtxCut = 0.5;
1236 cout<<"Warning: DCARMesonPrimVtx not defined "<<DCARMesonPrimVtx<<endl;
1243 ///________________________________________________________________________
1244 TString AliConversionMesonCuts::GetCutNumber(){
1245 // returns TString with current cut number
1247 for(Int_t ii=0;ii<kNCuts;ii++){
1248 a.Append(Form("%d",fCuts[ii]));
1253 ///________________________________________________________________________
1254 void AliConversionMesonCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
1256 Int_t posLabel = photon->GetTrackLabelPositive();
1257 Int_t negLabel = photon->GetTrackLabelNegative();
1259 fElectronLabelArray[nV0*2] = posLabel;
1260 fElectronLabelArray[(nV0*2)+1] = negLabel;
1263 ///________________________________________________________________________
1264 Bool_t AliConversionMesonCuts::RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s){
1266 Int_t posLabel = photon->GetTrackLabelPositive();
1267 Int_t negLabel = photon->GetTrackLabelNegative();
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){
1274 if(fElectronLabelArray[i] == negLabel){
1280 ///________________________________________________________________________
1281 Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0){
1282 Double_t posX = photon->GetConversionX();
1283 Double_t posY = photon->GetConversionY();
1284 Double_t posZ = photon->GetConversionZ();
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();
1293 Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
1295 if(dist < fminV0Dist*fminV0Dist){
1296 if(photon->GetChi2perNDF() < photonComp->GetChi2perNDF()) return kTRUE;
1305 ///________________________________________________________________________
1306 void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
1309 if (photon==NULL) return;
1310 Double_t facPBrem = 1.;
1311 Double_t facPSig = 0.;
1320 if( photon->P()!=0){
1321 theta=acos( photon->Pz()/ photon->P());
1324 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
1325 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
1328 if( fPBremSmearing != 1.){
1330 facPBrem = fBrem->GetRandom();
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());