added functionality to PWGGA/GammaConv/AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.cxx
authorfbock <friederike.bock@cern.ch>
Sat, 9 Aug 2014 13:28:38 +0000 (15:28 +0200)
committerfbock <friederike.bock@cern.ch>
Sat, 9 Aug 2014 13:28:38 +0000 (15:28 +0200)
PWGGA/GammaConv/AliAODConversionMother.h
PWGGA/GammaConv/AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.cxx
PWGGA/GammaConv/AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.h
PWGGA/GammaConv/AliConversionAODBGHandlerRP.h
PWGGA/GammaConv/AliGammaConversionAODBGHandler.cxx
PWGGA/GammaConv/AliGammaConversionAODBGHandler.h

index c44da85..de2a99d 100644 (file)
 
 class AliAODConversionMother : public AliAODConversionParticle{
 
- public: 
+       public: 
 
-     //Default Constructor
-     AliAODConversionMother();
+               //Default Constructor
+               AliAODConversionMother();
 
-     // Constructor for ESD to AOD Conversion
-     AliAODConversionMother(AliKFConversionMother *kf);
+               // Constructor for ESD to AOD Conversion
+               AliAODConversionMother(AliKFConversionMother *kf);
 
-     //Constructor Decay Mother Particle
-     AliAODConversionMother(AliAODConversionPhoton *y1,AliAODConversionPhoton *y2);
-        // Constructor Mother particle from one photon and one meson
-        AliAODConversionMother(AliAODConversionMother *meson, AliAODConversionPhoton *gamma);
+               //Constructor Decay Mother Particle
+               AliAODConversionMother(AliAODConversionPhoton *y1,AliAODConversionPhoton *y2);
+               // Constructor Mother particle from one photon and one meson
+               AliAODConversionMother(AliAODConversionMother *meson, AliAODConversionPhoton *gamma);
 
-        
-     //Destructor
-     virtual ~AliAODConversionMother();
-
-     // MC
-
-     void SetMCLabel(Int_t i){fMCLabel=i;}
-     Int_t GetMCLabel(){return fMCLabel;}
-     TParticle *GetMCParticle(AliStack *fMCStack);
-     Bool_t IsTrueMeson(AliStack *fMCStack,Int_t pdgcode);
-
-     ///Set the Chi2 of reconstructed conversion gamma
-     void SetChi2(Float_t chi2) {fChi2 = chi2;}
-
-     //Get the Chi2 of particle
-     Float_t Chi2() const {return fChi2;}
-
-     ///Set track or MC labels
-     void SetLabel1(Int_t label){fLabel[0] = label;}
-     void SetLabel2(Int_t label){fLabel[1] = label;}
-     void SetLabel3(Int_t label){fLabel[2] = label;}
-     void SetLabels(Int_t label1, Int_t label2, Int_t label3 = 0){fLabel[0] = label1; fLabel[1] = label2; fLabel[2] = label3;}
-
-     Int_t GetLabel(Int_t i) const {return fLabel[i];}
-     Int_t GetLabel1() const {return fLabel[0];}
-     Int_t GetLabel2() const {return fLabel[1];}
-     Int_t GetLabel3() const {return fLabel[2];}
                
-     Double_t GetProductionRadius() const {return TMath::Sqrt(fProductionVtx[0]*fProductionVtx[0]+fProductionVtx[1]*fProductionVtx[1]);}
-     Double_t GetProductionX() const {return fProductionVtx[0];}
-     Double_t GetProductionY() const {return fProductionVtx[1];}
-     Double_t GetProductionZ() const {return fProductionVtx[2];}
-
-     Float_t GetDCABetweenPhotons() const {return fdcaBetweenPhotons;}
-     Float_t GetDCAZMotherPrimVtx() const {return fdcaZPrimVtx;}
-     Float_t GetDCARMotherPrimVtx() const {return fdcaRPrimVtx;}
-     UChar_t GetMesonQuality() const {return fQuality;}
-       
-     Double_t GetOpeningAngle() const { return fOpeningAngle;}
-
-     Double_t GetAlpha() const { return fAlpha;}
-
-     void SetWeight(Double_t weight) {fWeight=weight;}
-     Double_t GetWeight() const {return fWeight;}
-
-     Float_t CalculateDistanceBetweenPhotons(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2 , Double_t prodPoint[3]);
-     void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex);
-     void DetermineMesonQuality(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2);
-        
-private:
-    Int_t fLabel[3]; // Labels of the decay photons
-    Int_t fMCLabel; // MC Label
-    Float_t fChi2; // Chi sq of reconstructed mother
-    Double_t fOpeningAngle;
-    Double_t fAlpha;
-    Double_t fWeight; // Weight for BG Calculation
-    Float_t fdcaBetweenPhotons; // dca between the two photons
-    Double_t fProductionVtx[3]; // Production vertex
-    Float_t fdcaZPrimVtx; // dca Z of meson to primary vertex
-    Float_t fdcaRPrimVtx; // dca R of meson to primary vertex
-    UChar_t fQuality; // Quality of the meson:
-                       // 0: garbage
-                       // 1: both photons quality 1
-                       // 2: 1 photon quality 1, 1 photon quality 2
-                       // 3: 1 photon quality 1, 1 photon quality 3
-                       // 4: both photons quality 2
-                       // 5: 1 photon quality 2, 1 photon quality 3
-                       // 6: both photons quality 3
-    
-    
+               //Destructor
+               virtual ~AliAODConversionMother();
+
+               // MC
+
+               void SetMCLabel(Int_t i){fMCLabel=i;}
+               Int_t GetMCLabel(){return fMCLabel;}
+               TParticle *GetMCParticle(AliStack *fMCStack);
+               Bool_t IsTrueMeson(AliStack *fMCStack,Int_t pdgcode);
+
+               ///Set the Chi2 of reconstructed conversion gamma
+               void SetChi2(Float_t chi2) {fChi2 = chi2;}
+
+               //Get the Chi2 of particle
+               Float_t Chi2() const {return fChi2;}
+
+               ///Set track or MC labels
+               void SetLabel1(Int_t label){fLabel[0] = label;}
+               void SetLabel2(Int_t label){fLabel[1] = label;}
+               void SetLabel3(Int_t label){fLabel[2] = label;}
+               void SetLabels(Int_t label1, Int_t label2, Int_t label3 = 0){fLabel[0] = label1; fLabel[1] = label2; fLabel[2] = label3;}
+
+               Int_t GetLabel(Int_t i) const {return fLabel[i];}
+               Int_t GetLabel1() const {return fLabel[0];}
+               Int_t GetLabel2() const {return fLabel[1];}
+               Int_t GetLabel3() const {return fLabel[2];}
+                       
+               Double_t GetProductionRadius() const {return TMath::Sqrt(fProductionVtx[0]*fProductionVtx[0]+fProductionVtx[1]*fProductionVtx[1]);}
+               Double_t GetProductionX() const {return fProductionVtx[0];}
+               Double_t GetProductionY() const {return fProductionVtx[1];}
+               Double_t GetProductionZ() const {return fProductionVtx[2];}
+
+               void SetProductionX(Double_t x) {fProductionVtx[0]=x;}
+               void SetProductionY(Double_t y) {fProductionVtx[1]=y;}
+               void SetProductionZ(Double_t z) {fProductionVtx[2]=z;}
+               void SetProductionPoint(Double_t* point){
+                       fProductionVtx[0] = point[0];
+                       fProductionVtx[1] = point[1];
+                       fProductionVtx[2] = point[2];
+               }
+                       
+               Float_t GetDCABetweenPhotons() const {return fdcaBetweenPhotons;}
+               Float_t GetDCAZMotherPrimVtx() const {return fdcaZPrimVtx;}
+               Float_t GetDCARMotherPrimVtx() const {return fdcaRPrimVtx;}
+               UChar_t GetMesonQuality() const {return fQuality;}
+                       
+               Double_t GetOpeningAngle() const { return fOpeningAngle;}
+
+               Double_t GetAlpha() const { return fAlpha;}
+
+               void SetWeight(Double_t weight) {fWeight=weight;}
+               Double_t GetWeight() const {return fWeight;}
+
+               Float_t CalculateDistanceBetweenPhotons(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2 , Double_t prodPoint[3]);
+               void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex);
+               void DetermineMesonQuality(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2);
+                       
+       private:
+               Int_t fLabel[3];                                                // Labels of the decay photons
+               Int_t fMCLabel;                                                 // MC Label
+               Float_t fChi2;                                                  // Chi sq of reconstructed mother
+               Double_t fOpeningAngle;
+               Double_t fAlpha;
+               Double_t fWeight;                                               // Weight for BG Calculation
+               Float_t fdcaBetweenPhotons;                     // dca between the two photons
+               Double_t fProductionVtx[3];                     // Production vertex
+               Float_t fdcaZPrimVtx;                                   // dca Z of meson to primary vertex
+               Float_t fdcaRPrimVtx;                                   // dca R of meson to primary vertex
+               UChar_t fQuality;                                               // Quality of the meson:
+                                                                                                       // 0: garbage
+                                                                                                       // 1: both photons quality 1
+                                                                                                       // 2: 1 photon quality 1, 1 photon quality 2
+                                                                                                       // 3: 1 photon quality 1, 1 photon quality 3
+                                                                                                       // 4: both photons quality 2
+                                                                                                       // 5: 1 photon quality 2, 1 photon quality 3
+                                                                                                       // 6: both photons quality 3
+               
+               
     ClassDef(AliAODConversionMother,4)
 };
 
index 910b937..197955d 100644 (file)
@@ -709,8 +709,8 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::UserExec(Option_t *){
                ProcessPionCandidates(); // Process this cuts gammas
                        
                CalculateMesonCandidates();
-//             CalculateBackground();
-//             UpdateEventByEventData();
+               CalculateBackground();
+               UpdateEventByEventData();
                                
                fGoodGammas->Clear(); // delete this cuts good gammas
 //             if (fNeutralPionCandidates->GetEntries()>0)cout << "##################################"<<  fNeutralPionCandidates->GetEntries() << endl;
@@ -1310,7 +1310,7 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::CalculateMesonCandidates(){
                vector<Bool_t> lGoodVirtualParticle(fGoodVirtualParticles->GetEntries(), kFALSE);
                
                for(Int_t mesonIndex=0; mesonIndex<fNeutralPionCandidates->GetEntries(); mesonIndex++){
-                       AliAODConversionMother *neutralPion=static_cast<AliAODConversionMother*>(fNeutralPionCandidates->At(mesonIndex));
+                       AliAODConversionMother *neutralPion=dynamic_cast<AliAODConversionMother*>(fNeutralPionCandidates->At(mesonIndex));
                        if (neutralPion==NULL) continue;
                        for(Int_t virtualParticleIndex=0;virtualParticleIndex<fGoodVirtualParticles->GetEntries();virtualParticleIndex++){
 
@@ -1434,7 +1434,7 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::CalculateBackground(){
        AliGammaConversionAODBGHandler::GammaConversionVertex *bgEventVertex = NULL;
        if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity() ) {
                for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
-                       AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
+                       AliGammaConversionMotherAODVector *previousEventMesons = fBGHandler[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBG);
                        if(fMoveParticleAccordingToVertex == kTRUE && method == 1){
                                bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
                        }
@@ -1442,14 +1442,14 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::CalculateBackground(){
                        for(Int_t iCurrent=0;iCurrent<fGoodVirtualParticles->GetEntries();iCurrent++){
                                AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualParticles->At(iCurrent));
 
-                               for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
-                                       AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
+                               for(UInt_t iPrevious=0;iPrevious<previousEventMesons->size();iPrevious++){
+                                       AliAODConversionMother previousGoodMeson = (AliAODConversionMother)(*(previousEventMesons->at(iPrevious)));
 
                                        if(fMoveParticleAccordingToVertex == kTRUE && method == 1 ){
-                                               MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+                                               MoveParticleAccordingToVertex(&previousGoodMeson,bgEventVertex);
                                        }
 
-                                       AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
+                                       AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&previousGoodMeson,&currentEventGoodV0);
                                                                
 
                                        if( ( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
@@ -1464,8 +1464,8 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::CalculateBackground(){
                }
        } else {
                for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
-                       AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
-                       if(previousEventV0s){
+                       AliGammaConversionMotherAODVector *previousEventMesons = fBGHandler[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBG);
+                       if(previousEventMesons){
                                if(fMoveParticleAccordingToVertex == kTRUE && method == 1){
                                        bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
                                }
@@ -1473,15 +1473,15 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::CalculateBackground(){
 
                                        AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualParticles->At(iCurrent));
 
-                                       for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
+                                       for(UInt_t iPrevious=0;iPrevious<previousEventMesons->size();iPrevious++){
 
-                                               AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
+                                               AliAODConversionMother previousGoodMeson = (AliAODConversionMother)(*(previousEventMesons->at(iPrevious)));
 
                                                if(fMoveParticleAccordingToVertex == kTRUE && method ==1){
-                                                       MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+                                                       MoveParticleAccordingToVertex(&previousGoodMeson,bgEventVertex);
                                                }
 
-                                               AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
+                                               AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&previousGoodMeson,&currentEventGoodV0);
                                                                
                                                if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
                                                        fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
@@ -1592,11 +1592,11 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::UpdateEventByEventData(){
 
        Int_t method = 1;
        if( method == 1 ) {
-               if(fGoodGammas->GetEntries() >0 ){
+               if(fNeutralPionCandidates->GetEntries() >0 ){
                        if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-                               fBGHandler[fiCut]->AddEvent(fGoodGammas,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
+                               fBGHandler[fiCut]->AddMesonEvent(fNeutralPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
                        } else{ // means we use #V0s for multiplicity
-                               fBGHandler[fiCut]->AddEvent(fGoodGammas,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGoodGammas->GetEntries(),0);
+                               fBGHandler[fiCut]->AddMesonEvent(fNeutralPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGoodGammas->GetEntries(),0);
                        }
                }
        } else if ( method == 2 ){
@@ -1611,15 +1611,15 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::UpdateEventByEventData(){
 }
 
 //________________________________________________________________________
-void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex){
+void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::MoveParticleAccordingToVertex(AliAODConversionMother* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex){
    //see header file for documentation
 
    Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
    Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
    Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
 
-   Double_t movedPlace[3] = {particle->GetConversionX() - dx,particle->GetConversionY() - dy,particle->GetConversionZ() - dz};
-   particle->SetConversionPoint(movedPlace);
+   Double_t movedPlace[3] = {particle->GetProductionX() - dx,particle->GetProductionY() - dy,particle->GetProductionZ() - dz};
+   particle->SetProductionPoint(movedPlace);
 }
 
 //_____________________________________________________________________________________
index 0a65535..5d3efd4 100644 (file)
@@ -75,7 +75,7 @@ class AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero: public AliAnalysisTaskSE
                void ProcessPhotonCandidates();
                void ProcessTruePhotonCandidates(AliAODConversionPhoton*);
                void ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionMother *TrueNeutralPionCandidate, AliAODConversionPhoton *TrueVirtualGammaCandidate);
-               void MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex);
+               void MoveParticleAccordingToVertex(AliAODConversionMother* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex);
        void ProcessNeutralPionCandidatesPureConversions();     
                void ProcessTrueNeutralPionCandidatesPureConversions(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
                void ProcessTrueNeutralPionCandidatesPureConversionsAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
index dd1723d..86d25e3 100644 (file)
@@ -8,53 +8,53 @@
 #include "TList.h"
 using namespace std;
 
-typedef vector<AliAODConversionPhoton*> AliGammaConversionPhotonVector;   // Vector containing photons
-typedef vector<AliGammaConversionPhotonVector> AliGammaConversionBGEventVector;       // Event contains vector of gammas (AliConversionPhotons)
-typedef vector<AliGammaConversionBGEventVector> AliGammaConversionMultiplicityVector;  // Multiplicity classes containing event vectors
-typedef vector<AliGammaConversionMultiplicityVector> AliGammaConversionBGVector;       // z vertex position ...
+typedef vector<AliAODConversionPhoton*> AliGammaConversionPhotonVector;                                // Vector containing photons
+typedef vector<AliGammaConversionPhotonVector> AliGammaConversionBGEventVector;                        // Event contains vector of gammas (AliConversionPhotons)
+typedef vector<AliGammaConversionBGEventVector> AliGammaConversionMultiplicityVector;  // Multiplicity classes containing event vectors
+typedef vector<AliGammaConversionMultiplicityVector> AliGammaConversionBGVector;               // z vertex position ...
 
 
 class AliConversionAODBGHandlerRP: public TObject{
 
-public:
-
-    AliConversionAODBGHandlerRP(Bool_t IsHeavyIon=kFALSE,Bool_t UseChargedTrackMult=kTRUE,Int_t NEvents=10);
-    
-    virtual ~AliConversionAODBGHandlerRP();
-
-    Int_t GetZBinIndex(Double_t z) const;
-    Int_t GetMultiplicityBinIndex(Int_t mult) const;
-    void Initialize();
-    Bool_t FindBins(TObjArray * const eventGammas,AliVEvent *fInputEvent,Int_t &zbin,Int_t &mbin);
-    Bool_t FindBins(TList * const eventGammas,AliVEvent *fInputEvent,Int_t &zbin,Int_t &mbin);
-
-    AliGammaConversionPhotonVector* GetBGGoodGammas(TObjArray * const eventGammas,AliVEvent *fInputEvent,Int_t event);
-    AliGammaConversionPhotonVector* GetBGGoodGammas(TList * const eventGammas,AliVEvent *fInputEvent,Int_t event);
-    void AddEvent(TObjArray * const eventGammas,AliVEvent *fInputEvent);
-    void AddEvent(TList * const eventGammas,AliVEvent *fInputEvent);
-    Int_t GetNBGEvents()const {return fNEvents;} // Size of the Pool (20)
-    Int_t GetNBGEvents(TObjArray * const eventGammas,AliVEvent *fInputEvent);
-    Int_t GetNBGEvents(TList * const eventGammas,AliVEvent *fInputEvent);
-    Int_t GetNZBins()const{return fNBinsZ;};
-    Int_t GetNMultiplicityBins()const{return fNBinsMultiplicity;};
-
-private:
-    Bool_t fIsHeavyIon;
-    Bool_t fUseChargedTrackMult;
-    Int_t fNEvents;
-    Int_t **fBGEventCounter; //! bg counter
-    Int_t **fNBGEvents;
-    Int_t fNBinsZ; //n z bins
-    Int_t fNBinsMultiplicity; //n bins multiplicity
-    Double_t *fBinLimitsArrayZ;//! bin limits z array
-    Double_t *fBinLimitsArrayMultiplicity;//! bin limit multiplicity array
-    AliGammaConversionBGVector fBGPool; //background events
-
-    AliConversionAODBGHandlerRP(AliConversionAODBGHandlerRP &original);
-    AliConversionAODBGHandlerRP &operator=(const AliConversionAODBGHandlerRP &ref);
-
- ClassDef(AliConversionAODBGHandlerRP,0);
+       public:
+
+               AliConversionAODBGHandlerRP(Bool_t IsHeavyIon=kFALSE,Bool_t UseChargedTrackMult=kTRUE,Int_t NEvents=10);
+               
+               virtual ~AliConversionAODBGHandlerRP();
+
+               Int_t GetZBinIndex(Double_t z) const;
+               Int_t GetMultiplicityBinIndex(Int_t mult) const;
+               void Initialize();
+               Bool_t FindBins(TObjArray * const eventGammas,AliVEvent *fInputEvent,Int_t &zbin,Int_t &mbin);
+               Bool_t FindBins(TList * const eventGammas,AliVEvent *fInputEvent,Int_t &zbin,Int_t &mbin);
+
+       
+               AliGammaConversionPhotonVector* GetBGGoodGammas(TObjArray * const eventGammas,AliVEvent *fInputEvent,Int_t event);
+               AliGammaConversionPhotonVector* GetBGGoodGammas(TList * const eventGammas,AliVEvent *fInputEvent,Int_t event);
+               void AddEvent(TObjArray * const eventGammas,AliVEvent *fInputEvent);
+               void AddEvent(TList * const eventGammas,AliVEvent *fInputEvent);
+               Int_t GetNBGEvents()const {return fNEvents;} // Size of the Pool (20)
+               Int_t GetNBGEvents(TObjArray * const eventGammas,AliVEvent *fInputEvent);
+               Int_t GetNBGEvents(TList * const eventGammas,AliVEvent *fInputEvent);
+               Int_t GetNZBins()const{return fNBinsZ;};
+               Int_t GetNMultiplicityBins()const{return fNBinsMultiplicity;};
+
+       private:
+               Bool_t fIsHeavyIon;
+               Bool_t fUseChargedTrackMult;
+               Int_t fNEvents;
+               Int_t **fBGEventCounter; //! bg counter
+               Int_t **fNBGEvents;
+               Int_t fNBinsZ; //n z bins
+               Int_t fNBinsMultiplicity; //n bins multiplicity
+               Double_t *fBinLimitsArrayZ;//! bin limits z array
+               Double_t *fBinLimitsArrayMultiplicity;//! bin limit multiplicity array
+               AliGammaConversionBGVector fBGPool; //background events
+
+               AliConversionAODBGHandlerRP(AliConversionAODBGHandlerRP &original);
+               AliConversionAODBGHandlerRP &operator=(const AliConversionAODBGHandlerRP &ref);
+
+       ClassDef(AliConversionAODBGHandlerRP,0);
 
 };
 #endif
index dd611f3..5a6599d 100644 (file)
@@ -1,7 +1,8 @@
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
- * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                        *
+ * Author: Martin Wilde, Friederike Bock, Daniel Lohner, Svein Lindal     *
+ * based on previous version by Kenneth Aamodt and Ana Marin                     *
  * Version 1.0                                                            *
  *                                                                        *
  * Permission to use, copy, modify and distribute this software and its   *
@@ -28,586 +29,661 @@ using namespace std;
 
 ClassImp(AliGammaConversionAODBGHandler)
 
+//_____________________________________________________________________________________________________________________________
 AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler() :
-  TObject(),
-  fNEvents(10),
-  fBGEventCounter(NULL),
-  fBGEventENegCounter(NULL),
-  fBGProbability(NULL),
-  fBGEventVertex(NULL),
-  fNBinsZ(0),
-  fNBinsMultiplicity(0),
-  fBinLimitsArrayZ(NULL),
-  fBinLimitsArrayMultiplicity(NULL),
-  fBGEvents(),
-  fBGEventsENeg()
+       TObject(),
+       fNEvents(10),
+       fBGEventCounter(NULL),
+       fBGEventENegCounter(NULL),
+       fBGEventMesonCounter(NULL),
+       fBGProbability(NULL),
+       fBGEventVertex(NULL),
+       fNBinsZ(0),
+       fNBinsMultiplicity(0),
+       fBinLimitsArrayZ(NULL),
+       fBinLimitsArrayMultiplicity(NULL),
+       fBGEvents(),
+       fBGEventsENeg(),
+       fBGEventsMeson()
 {
-  // constructor
+       // constructor
 }
 
+//_____________________________________________________________________________________________________________________________
 AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t nEvents) :
-  TObject(),
-  fNEvents(nEvents),
-  fBGEventCounter(NULL),
-  fBGEventENegCounter(NULL),
-  fBGProbability(NULL),
-  fBGEventVertex(NULL),
-  fNBinsZ(binsZ),
-  fNBinsMultiplicity(binsMultiplicity),
-  fBinLimitsArrayZ(NULL),
-  fBinLimitsArrayMultiplicity(NULL),
-  fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
-  fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents)))
+       TObject(),
+       fNEvents(nEvents),
+       fBGEventCounter(NULL),
+       fBGEventENegCounter(NULL),
+       fBGEventMesonCounter(NULL),
+       fBGProbability(NULL),
+       fBGEventVertex(NULL),
+       fNBinsZ(binsZ),
+       fNBinsMultiplicity(binsMultiplicity),
+       fBinLimitsArrayZ(NULL),
+       fBinLimitsArrayMultiplicity(NULL),
+       fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
+       fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
+       fBGEventsMeson(binsZ,AliGammaConversionMotherMultipicityVector(binsMultiplicity,AliGammaConversionMotherBGEventVector(nEvents)))
 {
-  // constructor
+       // constructor
 }
 
 
+//_____________________________________________________________________________________________________________________________
 AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(UInt_t collisionSystem,UInt_t centMin,UInt_t centMax,UInt_t nEvents, Bool_t useTrackMult) :
-  TObject(),
-  fNEvents(nEvents),
-  fBGEventCounter(NULL),
-  fBGEventENegCounter(NULL),
-  fBGProbability(NULL),
-  fBGEventVertex(NULL),
-  fNBinsZ(8),
-  fNBinsMultiplicity(5),
-  fBinLimitsArrayZ(NULL),
-  fBinLimitsArrayMultiplicity(NULL),
-  fBGEvents(fNBinsZ,AliGammaConversionMultipicityVector(fNBinsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
-  fBGEventsENeg(fNBinsZ,AliGammaConversionMultipicityVector(fNBinsMultiplicity,AliGammaConversionBGEventVector(nEvents)))
+       TObject(),
+       fNEvents(nEvents),
+       fBGEventCounter(NULL),
+       fBGEventENegCounter(NULL),
+       fBGEventMesonCounter(NULL),
+       fBGProbability(NULL),
+       fBGEventVertex(NULL),
+       fNBinsZ(8),
+       fNBinsMultiplicity(5),
+       fBinLimitsArrayZ(NULL),
+       fBinLimitsArrayMultiplicity(NULL),
+       fBGEvents(fNBinsZ,AliGammaConversionMultipicityVector(fNBinsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
+       fBGEventsENeg(fNBinsZ,AliGammaConversionMultipicityVector(fNBinsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
+       fBGEventsMeson(fNBinsZ,AliGammaConversionMotherMultipicityVector(fNBinsMultiplicity,AliGammaConversionMotherBGEventVector(nEvents)))
 {
-  // constructor
-   
-   fBinLimitsArrayZ= new Double_t[8] ;
-   if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
-      fBinLimitsArrayZ[0] = -50.00;
-      fBinLimitsArrayZ[1] = -5.5;
-      fBinLimitsArrayZ[2] = -2.9;
-      fBinLimitsArrayZ[3] = -0.65;
-      fBinLimitsArrayZ[4] = 1.45;
-      fBinLimitsArrayZ[5] = 3.65;
-      fBinLimitsArrayZ[6] = 6.15;
-      fBinLimitsArrayZ[7] = 50;
-   }
-   else if(collisionSystem == 0){
-      fBinLimitsArrayZ[0] = -50.00;
-      fBinLimitsArrayZ[1] = -3.375;
-      fBinLimitsArrayZ[2] = -1.605;
-      fBinLimitsArrayZ[3] = -0.225;
-      fBinLimitsArrayZ[4] = 1.065;
-      fBinLimitsArrayZ[5] = 2.445;
-      fBinLimitsArrayZ[6] = 4.245;
-      fBinLimitsArrayZ[7] = 50.00;
-   }
-   else{ 
-      fBinLimitsArrayZ[0] = -50.00;
-      fBinLimitsArrayZ[1] = -5.85;
-      fBinLimitsArrayZ[2] = -3.35;
-      fBinLimitsArrayZ[3] = -1.15;
-      fBinLimitsArrayZ[4] = 0.85;
-      fBinLimitsArrayZ[5] = 2.95;
-      fBinLimitsArrayZ[6] = 5.55;
-      fBinLimitsArrayZ[7] = 50.00;
-   }
-
-
-
-   fBinLimitsArrayMultiplicity= new Double_t[5];
-   if(useTrackMult){ // pp
-      fBinLimitsArrayMultiplicity[0] = 0;
-      fBinLimitsArrayMultiplicity[1] = 8.5;
-      fBinLimitsArrayMultiplicity[2] = 16.5;
-      fBinLimitsArrayMultiplicity[3] = 27.5;
-      fBinLimitsArrayMultiplicity[4] = 200.;
-      if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
-         if(centMin == 0 && centMax == 5){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 1540.;
-            fBinLimitsArrayMultiplicity[2] = 1665.;
-            fBinLimitsArrayMultiplicity[3] = 1780.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 0 && centMax == 10){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 1360.;
-            fBinLimitsArrayMultiplicity[2] = 1520.;
-            fBinLimitsArrayMultiplicity[3] = 1685.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 0 && centMax == 20){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 1110.;
-            fBinLimitsArrayMultiplicity[2] = 1360.;
-            fBinLimitsArrayMultiplicity[3] = 1600.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 0 && centMax == 80){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 890.;
-            fBinLimitsArrayMultiplicity[2] = 1240.;
-            fBinLimitsArrayMultiplicity[3] = 1540.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 5 && centMax == 10){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 1250.;
-            fBinLimitsArrayMultiplicity[2] = 1345.;
-            fBinLimitsArrayMultiplicity[3] = 1445.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 10 && centMax == 20){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 915.;
-            fBinLimitsArrayMultiplicity[2] = 1020.;
-            fBinLimitsArrayMultiplicity[3] = 1130.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 20 && centMax == 40){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 510.;
-            fBinLimitsArrayMultiplicity[2] = 625.;
-            fBinLimitsArrayMultiplicity[3] = 730.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 40 && centMax == 80){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 185.;
-            fBinLimitsArrayMultiplicity[2] = 250.;
-            fBinLimitsArrayMultiplicity[3] = 300.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else if(centMin == 60 && centMax == 80){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 55.;
-            fBinLimitsArrayMultiplicity[2] = 80.;
-            fBinLimitsArrayMultiplicity[3] = 100.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-         else{ // Std 20-40
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 510.;
-            fBinLimitsArrayMultiplicity[2] = 625.;
-            fBinLimitsArrayMultiplicity[3] = 730.;
-            fBinLimitsArrayMultiplicity[4] = 5000.;
-         }
-      }
-
-      else if(collisionSystem == 8 || collisionSystem == 9){ //pPb
-
-         fBinLimitsArrayMultiplicity[0] = 0.;
-         fBinLimitsArrayMultiplicity[1] = 7.5;
-         fBinLimitsArrayMultiplicity[2] = 16.5;
-         fBinLimitsArrayMultiplicity[3] = 29.5;
-         fBinLimitsArrayMultiplicity[4] = 500.;        
-         
-         if(centMin == 0 && centMax == 20){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 31.5;
-            fBinLimitsArrayMultiplicity[2] = 40.5;
-            fBinLimitsArrayMultiplicity[3] = 50.5;
-            fBinLimitsArrayMultiplicity[4] = 500.;
-         } else if(centMin == 20 && centMax == 40){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 19.5;
-            fBinLimitsArrayMultiplicity[2] = 25.5;
-            fBinLimitsArrayMultiplicity[3] = 32.5;
-            fBinLimitsArrayMultiplicity[4] = 500.;
-         } else if(centMin == 40 && centMax == 60){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 12.5;
-            fBinLimitsArrayMultiplicity[2] = 16.5;
-            fBinLimitsArrayMultiplicity[3] = 22.5;
-            fBinLimitsArrayMultiplicity[4] = 500.;
-         } else if(centMin == 60 && centMax == 80){ 
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 5.5;
-            fBinLimitsArrayMultiplicity[2] = 9.5;
-            fBinLimitsArrayMultiplicity[3] = 13.5;
-            fBinLimitsArrayMultiplicity[4] = 500.;
-          } else if(centMin == 60 && centMax == 100){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 2.5;
-            fBinLimitsArrayMultiplicity[2] = 6.5;
-            fBinLimitsArrayMultiplicity[3] = 11.5;
-            fBinLimitsArrayMultiplicity[4] = 500.;
-          }  
-      }
-   }
-   else{// pp or pPb V0 Mult
-      fBinLimitsArrayMultiplicity[0] = 2;
-      fBinLimitsArrayMultiplicity[1] = 3;
-      fBinLimitsArrayMultiplicity[2] = 4;
-      fBinLimitsArrayMultiplicity[3] = 5;
-      fBinLimitsArrayMultiplicity[4] = 9999;
-      if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
-         if(centMin == 0 && centMax == 5){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 27.;
-            fBinLimitsArrayMultiplicity[2] = 31.;
-            fBinLimitsArrayMultiplicity[3] = 36.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 0 && centMax == 10){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 25.;
-            fBinLimitsArrayMultiplicity[2] = 30.;
-            fBinLimitsArrayMultiplicity[3] = 36.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 0 && centMax == 20){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 22.;
-            fBinLimitsArrayMultiplicity[2] = 27.;
-            fBinLimitsArrayMultiplicity[3] = 33.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 0 && centMax == 80){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 18.;
-            fBinLimitsArrayMultiplicity[2] = 25.;
-            fBinLimitsArrayMultiplicity[3] = 32.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 5 && centMax == 10){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 23.;
-            fBinLimitsArrayMultiplicity[2] = 27.;
-            fBinLimitsArrayMultiplicity[3] = 32.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 10 && centMax == 20){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 18.;
-            fBinLimitsArrayMultiplicity[2] = 22.;
-            fBinLimitsArrayMultiplicity[3] = 27.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 20 && centMax == 40){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 11.;
-            fBinLimitsArrayMultiplicity[2] = 14.;
-            fBinLimitsArrayMultiplicity[3] = 18.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 40 && centMax == 80){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 5.;
-            fBinLimitsArrayMultiplicity[2] = 7.;
-            fBinLimitsArrayMultiplicity[3] = 11.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else if(centMin == 60 && centMax == 80){
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 2.;
-            fBinLimitsArrayMultiplicity[2] = 3.;
-            fBinLimitsArrayMultiplicity[3] = 5.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-         else{ // Std 20-40
-            fBinLimitsArrayMultiplicity[0] = 0.;
-            fBinLimitsArrayMultiplicity[1] = 11.;
-            fBinLimitsArrayMultiplicity[2] = 14.;
-            fBinLimitsArrayMultiplicity[3] = 18.;
-            fBinLimitsArrayMultiplicity[4] = 100.;
-         }
-      }
-   }
-   
-   Initialize(fBinLimitsArrayZ,fBinLimitsArrayMultiplicity);
+       // constructor
+       
+       fBinLimitsArrayZ= new Double_t[8] ;
+       if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
+               fBinLimitsArrayZ[0] = -50.00;
+               fBinLimitsArrayZ[1] = -5.5;
+               fBinLimitsArrayZ[2] = -2.9;
+               fBinLimitsArrayZ[3] = -0.65;
+               fBinLimitsArrayZ[4] = 1.45;
+               fBinLimitsArrayZ[5] = 3.65;
+               fBinLimitsArrayZ[6] = 6.15;
+               fBinLimitsArrayZ[7] = 50;
+       }
+       else if(collisionSystem == 0){
+               fBinLimitsArrayZ[0] = -50.00;
+               fBinLimitsArrayZ[1] = -3.375;
+               fBinLimitsArrayZ[2] = -1.605;
+               fBinLimitsArrayZ[3] = -0.225;
+               fBinLimitsArrayZ[4] = 1.065;
+               fBinLimitsArrayZ[5] = 2.445;
+               fBinLimitsArrayZ[6] = 4.245;
+               fBinLimitsArrayZ[7] = 50.00;
+       }
+       else{ 
+               fBinLimitsArrayZ[0] = -50.00;
+               fBinLimitsArrayZ[1] = -5.85;
+               fBinLimitsArrayZ[2] = -3.35;
+               fBinLimitsArrayZ[3] = -1.15;
+               fBinLimitsArrayZ[4] = 0.85;
+               fBinLimitsArrayZ[5] = 2.95;
+               fBinLimitsArrayZ[6] = 5.55;
+               fBinLimitsArrayZ[7] = 50.00;
+       }
+
+
 
+       fBinLimitsArrayMultiplicity= new Double_t[5];
+       if(useTrackMult){ // pp
+               fBinLimitsArrayMultiplicity[0] = 0;
+               fBinLimitsArrayMultiplicity[1] = 8.5;
+               fBinLimitsArrayMultiplicity[2] = 16.5;
+               fBinLimitsArrayMultiplicity[3] = 27.5;
+               fBinLimitsArrayMultiplicity[4] = 200.;
+               if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
+                       if(centMin == 0 && centMax == 5){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 1540.;
+                               fBinLimitsArrayMultiplicity[2] = 1665.;
+                               fBinLimitsArrayMultiplicity[3] = 1780.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 0 && centMax == 10){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 1360.;
+                               fBinLimitsArrayMultiplicity[2] = 1520.;
+                               fBinLimitsArrayMultiplicity[3] = 1685.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 0 && centMax == 20){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 1110.;
+                               fBinLimitsArrayMultiplicity[2] = 1360.;
+                               fBinLimitsArrayMultiplicity[3] = 1600.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 0 && centMax == 80){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 890.;
+                               fBinLimitsArrayMultiplicity[2] = 1240.;
+                               fBinLimitsArrayMultiplicity[3] = 1540.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 5 && centMax == 10){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 1250.;
+                               fBinLimitsArrayMultiplicity[2] = 1345.;
+                               fBinLimitsArrayMultiplicity[3] = 1445.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 10 && centMax == 20){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 915.;
+                               fBinLimitsArrayMultiplicity[2] = 1020.;
+                               fBinLimitsArrayMultiplicity[3] = 1130.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 20 && centMax == 40){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 510.;
+                               fBinLimitsArrayMultiplicity[2] = 625.;
+                               fBinLimitsArrayMultiplicity[3] = 730.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 40 && centMax == 80){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 185.;
+                               fBinLimitsArrayMultiplicity[2] = 250.;
+                               fBinLimitsArrayMultiplicity[3] = 300.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else if(centMin == 60 && centMax == 80){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 55.;
+                               fBinLimitsArrayMultiplicity[2] = 80.;
+                               fBinLimitsArrayMultiplicity[3] = 100.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+                       else{ // Std 20-40
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 510.;
+                               fBinLimitsArrayMultiplicity[2] = 625.;
+                               fBinLimitsArrayMultiplicity[3] = 730.;
+                               fBinLimitsArrayMultiplicity[4] = 5000.;
+                       }
+               }
+
+               else if(collisionSystem == 8 || collisionSystem == 9){ //pPb
+
+                       fBinLimitsArrayMultiplicity[0] = 0.;
+                       fBinLimitsArrayMultiplicity[1] = 7.5;
+                       fBinLimitsArrayMultiplicity[2] = 16.5;
+                       fBinLimitsArrayMultiplicity[3] = 29.5;
+                       fBinLimitsArrayMultiplicity[4] = 500.;  
+                       
+                       if(centMin == 0 && centMax == 20){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 31.5;
+                               fBinLimitsArrayMultiplicity[2] = 40.5;
+                               fBinLimitsArrayMultiplicity[3] = 50.5;
+                               fBinLimitsArrayMultiplicity[4] = 500.;
+                       } else if(centMin == 20 && centMax == 40){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 19.5;
+                               fBinLimitsArrayMultiplicity[2] = 25.5;
+                               fBinLimitsArrayMultiplicity[3] = 32.5;
+                               fBinLimitsArrayMultiplicity[4] = 500.;
+                       } else if(centMin == 40 && centMax == 60){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 12.5;
+                               fBinLimitsArrayMultiplicity[2] = 16.5;
+                               fBinLimitsArrayMultiplicity[3] = 22.5;
+                               fBinLimitsArrayMultiplicity[4] = 500.;
+                       } else if(centMin == 60 && centMax == 80){ 
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 5.5;
+                               fBinLimitsArrayMultiplicity[2] = 9.5;
+                               fBinLimitsArrayMultiplicity[3] = 13.5;
+                               fBinLimitsArrayMultiplicity[4] = 500.;
+                       } else if(centMin == 60 && centMax == 100){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 2.5;
+                               fBinLimitsArrayMultiplicity[2] = 6.5;
+                               fBinLimitsArrayMultiplicity[3] = 11.5;
+                               fBinLimitsArrayMultiplicity[4] = 500.;
+                       }  
+               }
+       }
+       else{// pp or pPb V0 Mult
+               fBinLimitsArrayMultiplicity[0] = 2;
+               fBinLimitsArrayMultiplicity[1] = 3;
+               fBinLimitsArrayMultiplicity[2] = 4;
+               fBinLimitsArrayMultiplicity[3] = 5;
+               fBinLimitsArrayMultiplicity[4] = 9999;
+               if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
+                       if(centMin == 0 && centMax == 5){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 27.;
+                               fBinLimitsArrayMultiplicity[2] = 31.;
+                               fBinLimitsArrayMultiplicity[3] = 36.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 0 && centMax == 10){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 25.;
+                               fBinLimitsArrayMultiplicity[2] = 30.;
+                               fBinLimitsArrayMultiplicity[3] = 36.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 0 && centMax == 20){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 22.;
+                               fBinLimitsArrayMultiplicity[2] = 27.;
+                               fBinLimitsArrayMultiplicity[3] = 33.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 0 && centMax == 80){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 18.;
+                               fBinLimitsArrayMultiplicity[2] = 25.;
+                               fBinLimitsArrayMultiplicity[3] = 32.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 5 && centMax == 10){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 23.;
+                               fBinLimitsArrayMultiplicity[2] = 27.;
+                               fBinLimitsArrayMultiplicity[3] = 32.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 10 && centMax == 20){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 18.;
+                               fBinLimitsArrayMultiplicity[2] = 22.;
+                               fBinLimitsArrayMultiplicity[3] = 27.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 20 && centMax == 40){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 11.;
+                               fBinLimitsArrayMultiplicity[2] = 14.;
+                               fBinLimitsArrayMultiplicity[3] = 18.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 40 && centMax == 80){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 5.;
+                               fBinLimitsArrayMultiplicity[2] = 7.;
+                               fBinLimitsArrayMultiplicity[3] = 11.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else if(centMin == 60 && centMax == 80){
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 2.;
+                               fBinLimitsArrayMultiplicity[2] = 3.;
+                               fBinLimitsArrayMultiplicity[3] = 5.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+                       else{ // Std 20-40
+                               fBinLimitsArrayMultiplicity[0] = 0.;
+                               fBinLimitsArrayMultiplicity[1] = 11.;
+                               fBinLimitsArrayMultiplicity[2] = 14.;
+                               fBinLimitsArrayMultiplicity[3] = 18.;
+                               fBinLimitsArrayMultiplicity[4] = 100.;
+                       }
+               }
+       }
+       
+       Initialize(fBinLimitsArrayZ,fBinLimitsArrayMultiplicity);
 }
 
+//_____________________________________________________________________________________________________________________________
 AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(const AliGammaConversionAODBGHandler & original) :
-  TObject(original),
-  fNEvents(original.fNEvents),
-  fBGEventCounter(original.fBGEventCounter),
-  fBGEventENegCounter(original.fBGEventENegCounter),
-  fBGProbability(original.fBGProbability),
-  fBGEventVertex(original.fBGEventVertex),
-  fNBinsZ(original.fNBinsZ),
-  fNBinsMultiplicity(original.fNBinsMultiplicity),
-  fBinLimitsArrayZ(original.fBinLimitsArrayZ),
-  fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity),
-  fBGEvents(original.fBGEvents),
-  fBGEventsENeg(original.fBGEventsENeg)
+       TObject(original),
+       fNEvents(original.fNEvents),
+       fBGEventCounter(original.fBGEventCounter),
+       fBGEventENegCounter(original.fBGEventENegCounter),
+       fBGEventMesonCounter(original.fBGEventMesonCounter),
+       fBGProbability(original.fBGProbability),
+       fBGEventVertex(original.fBGEventVertex),
+       fNBinsZ(original.fNBinsZ),
+       fNBinsMultiplicity(original.fNBinsMultiplicity),
+       fBinLimitsArrayZ(original.fBinLimitsArrayZ),
+       fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity),
+       fBGEvents(original.fBGEvents),
+       fBGEventsENeg(original.fBGEventsENeg),
+       fBGEventsMeson(original.fBGEventsMeson)
 {
-  //copy constructor   
+       //copy constructor      
 }
 
+//_____________________________________________________________________________________________________________________________
 AliGammaConversionAODBGHandler & AliGammaConversionAODBGHandler::operator = (const AliGammaConversionAODBGHandler & /*source*/)
 {
-  // assignment operator
-  return *this;
+       // assignment operator
+       return *this;
 }
 
+//_____________________________________________________________________________________________________________________________
 AliGammaConversionAODBGHandler::~AliGammaConversionAODBGHandler(){
 
-  //Kenneth remember to clear memory!!!!!!!!!!!!!!!!!!!!!
-  if(fBGEventCounter){
-    for(Int_t z=0;z<fNBinsZ;z++){
-      delete[] fBGEventCounter[z];
-    }
-    delete[] fBGEventCounter;
-    fBGEventCounter = NULL;
-  }
-
-  if(fBGEventVertex){
-    for(Int_t z=0;z<fNBinsZ;z++){
-      for(Int_t m=0;m<fNBinsMultiplicity;m++){
-       delete [] fBGEventVertex[z][m];
-      }
-      delete [] fBGEventVertex[z];
-    }
-    delete [] fBGEventVertex;
-  }
-
-   if(fBGEventENegCounter){
-    for(Int_t z=0;z<fNBinsZ;z++){
-      delete[] fBGEventENegCounter[z];
-    }
-    delete[] fBGEventENegCounter;
-    fBGEventENegCounter = NULL;
-  }
-
-  if(fBinLimitsArrayZ){
-    delete[] fBinLimitsArrayZ;
-  }
-
-  if(fBinLimitsArrayMultiplicity){
-    delete[] fBinLimitsArrayMultiplicity;
-  }
+       if(fBGEventCounter){
+               for(Int_t z=0;z<fNBinsZ;z++){
+                       delete[] fBGEventCounter[z];
+               }
+               delete[] fBGEventCounter;
+               fBGEventCounter = NULL;
+       }
+
+       if(fBGEventVertex){
+               for(Int_t z=0;z<fNBinsZ;z++){
+                       for(Int_t m=0;m<fNBinsMultiplicity;m++){
+                               delete [] fBGEventVertex[z][m];
+                       }
+                       delete [] fBGEventVertex[z];
+               }
+               delete [] fBGEventVertex;
+       }
+
+       if(fBGEventENegCounter){
+               for(Int_t z=0;z<fNBinsZ;z++){
+                       delete[] fBGEventENegCounter[z];
+               }
+               delete[] fBGEventENegCounter;
+               fBGEventENegCounter = NULL;
+       }
+
+       if(fBGEventMesonCounter){
+               for(Int_t z=0;z<fNBinsZ;z++){
+                       delete[] fBGEventMesonCounter[z];
+               }
+               delete[] fBGEventMesonCounter;
+               fBGEventMesonCounter = NULL;
+       }
+
+       if(fBinLimitsArrayZ){
+               delete[] fBinLimitsArrayZ;
+       }
+
+       if(fBinLimitsArrayMultiplicity){
+               delete[] fBinLimitsArrayMultiplicity;
+       }
 }
 
+//_____________________________________________________________________________________________________________________________
 void AliGammaConversionAODBGHandler::Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray){
   // see header file for documantation  
 
-  if(zBinLimitsArray){
-    fBinLimitsArrayZ = zBinLimitsArray;
-  }
-  else{
-    //Print warning
-  }
-  
-  if(multiplicityBinLimitsArray){
-    fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ;
-  }
-  else{
-    //Print warning
-  }
-  if(fBGEventCounter == NULL){
-    fBGEventCounter= new Int_t*[fNBinsZ];
-  }
-  for(Int_t z=0;z<fNBinsZ;z++){
-    fBGEventCounter[z]=new Int_t[fNBinsMultiplicity];
-  }
-
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity;m++){
-      fBGEventCounter[z][m]=0;
-    }
-  }
-
-  if(fBGEventVertex == NULL){
-    fBGEventVertex = new GammaConversionVertex**[fNBinsZ];
-  }
-  for(Int_t z=0; z < fNBinsZ; z++){
-    fBGEventVertex[z]= new GammaConversionVertex*[fNBinsMultiplicity];
-  }
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity; m++){
-      fBGEventVertex[z][m]= new GammaConversionVertex[fNEvents];
-    }
-  }
-  if( fBGEventENegCounter == NULL){
-    fBGEventENegCounter = new Int_t*[fNBinsZ];
-  }
-
-  for(Int_t z=0; z < fNBinsZ; z++){
-    fBGEventENegCounter[z] = new Int_t[fNBinsMultiplicity];
-  }
-
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity; m++){
-      fBGEventENegCounter[z][m] = 0;
-    }
-  }
-
-  if(fBGProbability == NULL){
-    fBGProbability = new Double_t*[fNBinsZ];
-  }
-  for(Int_t z=0; z < fNBinsZ; z++){
-    fBGProbability[z] = new Double_t[fNBinsMultiplicity];
-  }
-
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity; m++){
-      fBGProbability[z][m] = 0;
-    }
-  }
-  //filling the probability
-  fBGProbability[0][0] = 0.243594;
-  fBGProbability[0][1] = 0.279477;
-  fBGProbability[0][2] = 0.305104;
-  fBGProbability[0][3] = 0.315927;
-  fBGProbability[1][0] = 0.241964;
-  fBGProbability[1][1] = 0.272995;
-  fBGProbability[1][2] = 0.307165;
-  fBGProbability[1][3] = 0.292248;
-  fBGProbability[2][0] = 0.241059;
-  fBGProbability[2][1] = 0.27509;
-  fBGProbability[2][2] = 0.283657;
-  fBGProbability[2][3] = 0.310512;
-  fBGProbability[3][0] = 0.23888;
-  fBGProbability[3][1] = 0.283418;
-  fBGProbability[3][2] = 0.297232;
-  fBGProbability[3][3] = 0.348188;
-  fBGProbability[4][0] = 0.245555;
-  fBGProbability[4][1] = 0.281218;
-  fBGProbability[4][2] = 0.317236;
-  fBGProbability[4][3] = 0.323495;
-  fBGProbability[5][0] = 0.244572;
-  fBGProbability[5][1] = 0.259498;
-  fBGProbability[5][2] = 0.278383;
-  fBGProbability[5][3] = 0.284696;
-  fBGProbability[6][0] = 0.24703;
-  fBGProbability[6][1] = 0.275265;
-  fBGProbability[6][2] = 0.284004;
-  fBGProbability[6][3] = 0.343584;
+       if(zBinLimitsArray){
+               fBinLimitsArrayZ = zBinLimitsArray;
+       }
+       else{
+               //Print warning
+       }
+       
+       if(multiplicityBinLimitsArray){
+               fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ;
+       }
+       else{
+               //Print warning
+       }
+       if(fBGEventCounter == NULL){
+               fBGEventCounter= new Int_t*[fNBinsZ];
+       }
+       for(Int_t z=0;z<fNBinsZ;z++){
+               fBGEventCounter[z]=new Int_t[fNBinsMultiplicity];
+       }
+       
+       for(Int_t z=0;z<fNBinsZ;z++){
+               for(Int_t m=0;m<fNBinsMultiplicity;m++){
+                       fBGEventCounter[z][m]=0;
+               }
+       }
+
+       if(fBGEventMesonCounter == NULL){
+               fBGEventMesonCounter= new Int_t*[fNBinsZ];
+       }
+       for(Int_t z=0;z<fNBinsZ;z++){
+               fBGEventMesonCounter[z]=new Int_t[fNBinsMultiplicity];
+       }
+       
+       for(Int_t z=0;z<fNBinsZ;z++){
+               for(Int_t m=0;m<fNBinsMultiplicity;m++){
+                       fBGEventMesonCounter[z][m]=0;
+               }
+       }
+
+       
+       if(fBGEventVertex == NULL){
+               fBGEventVertex = new GammaConversionVertex**[fNBinsZ];
+       }
+       for(Int_t z=0; z < fNBinsZ; z++){
+               fBGEventVertex[z]= new GammaConversionVertex*[fNBinsMultiplicity];
+       }
+       for(Int_t z=0;z<fNBinsZ;z++){
+               for(Int_t m=0;m<fNBinsMultiplicity; m++){
+                       fBGEventVertex[z][m]= new GammaConversionVertex[fNEvents];
+               }
+       }
+       if( fBGEventENegCounter == NULL){
+               fBGEventENegCounter = new Int_t*[fNBinsZ];
+       }
+
+       for(Int_t z=0; z < fNBinsZ; z++){
+               fBGEventENegCounter[z] = new Int_t[fNBinsMultiplicity];
+       }
+
+       for(Int_t z=0;z<fNBinsZ;z++){
+               for(Int_t m=0;m<fNBinsMultiplicity; m++){
+                       fBGEventENegCounter[z][m] = 0;
+               }
+       }
+
+       if(fBGProbability == NULL){
+               fBGProbability = new Double_t*[fNBinsZ];
+       }
+       for(Int_t z=0; z < fNBinsZ; z++){
+               fBGProbability[z] = new Double_t[fNBinsMultiplicity];
+       }
+
+       for(Int_t z=0;z<fNBinsZ;z++){
+               for(Int_t m=0;m<fNBinsMultiplicity; m++){
+                       fBGProbability[z][m] = 0;
+               }
+       }
+       //filling the probability
+       fBGProbability[0][0] = 0.243594;
+       fBGProbability[0][1] = 0.279477;
+       fBGProbability[0][2] = 0.305104;
+       fBGProbability[0][3] = 0.315927;
+       fBGProbability[1][0] = 0.241964;
+       fBGProbability[1][1] = 0.272995;
+       fBGProbability[1][2] = 0.307165;
+       fBGProbability[1][3] = 0.292248;
+       fBGProbability[2][0] = 0.241059;
+       fBGProbability[2][1] = 0.27509;
+       fBGProbability[2][2] = 0.283657;
+       fBGProbability[2][3] = 0.310512;
+       fBGProbability[3][0] = 0.23888;
+       fBGProbability[3][1] = 0.283418;
+       fBGProbability[3][2] = 0.297232;
+       fBGProbability[3][3] = 0.348188;
+       fBGProbability[4][0] = 0.245555;
+       fBGProbability[4][1] = 0.281218;
+       fBGProbability[4][2] = 0.317236;
+       fBGProbability[4][3] = 0.323495;
+       fBGProbability[5][0] = 0.244572;
+       fBGProbability[5][1] = 0.259498;
+       fBGProbability[5][2] = 0.278383;
+       fBGProbability[5][3] = 0.284696;
+       fBGProbability[6][0] = 0.24703;
+       fBGProbability[6][1] = 0.275265;
+       fBGProbability[6][2] = 0.284004;
+       fBGProbability[6][3] = 0.343584;
+       
 }
 
+//_____________________________________________________________________________________________________________________________
 Int_t AliGammaConversionAODBGHandler::GetZBinIndex(Double_t zvalue) const{
-  // see header file for documantation
-  if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){
-     return 0;
-  }
-
-  for(Int_t i=0; i<fNBinsZ-1 ;i++){
-    if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){
-      return i;
-    }
-  }
-  return fNBinsZ-1;
+       // see header file for documantation
+       if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){
+               return 0;
+       }
+
+       for(Int_t i=0; i<fNBinsZ-1 ;i++){
+               if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){
+                       return i;
+               }
+       }
+       return fNBinsZ-1;
 }
 
+//_____________________________________________________________________________________________________________________________
 Int_t AliGammaConversionAODBGHandler::GetMultiplicityBinIndex(Int_t multiplicity) const{
-  // see header file for documantation  
-  if(fNBinsMultiplicity<2){
-    return 0;
-  }
-
-  for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
-    if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
-      return i;
-    }
-  }
-  return fNBinsMultiplicity-1;
+       // see header file for documantation  
+       if(fNBinsMultiplicity<2){
+               return 0;
+       }
+
+       for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
+               if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
+                       return i;
+               }
+       }
+       return fNBinsMultiplicity-1;
 }
 
+//_____________________________________________________________________________________________________________________________
 void AliGammaConversionAODBGHandler::AddEvent(TList* const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
 
-  // see header file for documantation  
+       // see header file for documantation  
+
+       //  cout<<"Entering the AddEvent function"<<endl;
 
-  //  cout<<"Entering the AddEvent function"<<endl;
-
-  Int_t z = GetZBinIndex(zvalue);
-  Int_t m = GetMultiplicityBinIndex(multiplicity);
-
-  if(fBGEventCounter[z][m] >= fNEvents){
-    fBGEventCounter[z][m]=0;
-  }
-  Int_t eventCounter=fBGEventCounter[z][m];
-  
-  /*
-  if(fBGEventVertex[z][m][eventCounter]){
-    delete fBGEventVertex[z][m][eventCounter];
-  }
-  */
-  fBGEventVertex[z][m][eventCounter].fX = xvalue;
-  fBGEventVertex[z][m][eventCounter].fY = yvalue;
-  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
-  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
-
-  //first clear the vector
-  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  //  cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
-
-  //  cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
-    delete (AliAODConversionPhoton*)(fBGEvents[z][m][eventCounter][d]);
-  }
-  fBGEvents[z][m][eventCounter].clear();
-  
-  // add the gammas to the vector
-  for(Int_t i=0; i< eventGammas->GetEntries();i++){
-    //    AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
-    fBGEvents[z][m][eventCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventGammas->At(i))));
-  }
-  fBGEventCounter[z][m]++;
+       Int_t z = GetZBinIndex(zvalue);
+       Int_t m = GetMultiplicityBinIndex(multiplicity);
+
+       if(fBGEventCounter[z][m] >= fNEvents){
+               fBGEventCounter[z][m]=0;
+       }
+       Int_t eventCounter=fBGEventCounter[z][m];
+       
+       /*
+       if(fBGEventVertex[z][m][eventCounter]){
+               delete fBGEventVertex[z][m][eventCounter];
+       }
+       */
+       fBGEventVertex[z][m][eventCounter].fX = xvalue;
+       fBGEventVertex[z][m][eventCounter].fY = yvalue;
+       fBGEventVertex[z][m][eventCounter].fZ = zvalue;
+       fBGEventVertex[z][m][eventCounter].fEP = epvalue;
+
+       //first clear the vector
+       // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
+       //  cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
+
+       //  cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
+       for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
+               delete (AliAODConversionPhoton*)(fBGEvents[z][m][eventCounter][d]);
+       }
+       fBGEvents[z][m][eventCounter].clear();
+       
+       // add the gammas to the vector
+       for(Int_t i=0; i< eventGammas->GetEntries();i++){
+               //    AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
+               fBGEvents[z][m][eventCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventGammas->At(i))));
+       }
+       fBGEventCounter[z][m]++;
 }
-void AliGammaConversionAODBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){
 
-  Int_t z = GetZBinIndex(zvalue);
-  Int_t m = GetMultiplicityBinIndex(multiplicity);
+//_____________________________________________________________________________________________________________________________
+void AliGammaConversionAODBGHandler::AddMesonEvent(TList* const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
 
-  if(fBGEventENegCounter[z][m] >= fNEvents){
-     fBGEventENegCounter[z][m]=0;
-  }
+       // see header file for documantation  
+       //  cout<<"Entering the AddEvent function"<<endl;
+       Int_t z = GetZBinIndex(zvalue);
+       Int_t m = GetMultiplicityBinIndex(multiplicity);
 
-   Int_t eventENegCounter=fBGEventENegCounter[z][m];
-  
-  //first clear the vector
-  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  //  cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
+       if(fBGEventMesonCounter[z][m] >= fNEvents){
+               fBGEventMesonCounter[z][m]=0;
+       }
+       Int_t eventCounter=fBGEventMesonCounter[z][m];
+       
+       fBGEventVertex[z][m][eventCounter].fX = xvalue;
+       fBGEventVertex[z][m][eventCounter].fY = yvalue;
+       fBGEventVertex[z][m][eventCounter].fZ = zvalue;
+       fBGEventVertex[z][m][eventCounter].fEP = epvalue;
+
+       //first clear the vector
+       for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
+               delete (AliAODConversionMother*)(fBGEventsMeson[z][m][eventCounter][d]);
+       }
+       fBGEventsMeson[z][m][eventCounter].clear();
+       
+       // add the gammas to the vector
+       for(Int_t i=0; i< eventMothers->GetEntries();i++){
+               fBGEventsMeson[z][m][eventCounter].push_back(new AliAODConversionMother(*(AliAODConversionMother*)(eventMothers->At(i))));
+       }
+       fBGEventMesonCounter[z][m]++;
+}
 
-  //  cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  for(UInt_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){
-    delete (AliAODConversionPhoton*)(fBGEventsENeg[z][m][eventENegCounter][d]);
-  }
 
-  fBGEventsENeg[z][m][eventENegCounter].clear();
+//_____________________________________________________________________________________________________________________________
+void AliGammaConversionAODBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){
 
-  // add the electron to the vector
-  for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){
-    //    AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
-    fBGEventsENeg[z][m][eventENegCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventENeg->At(i))));
-  }
+       Int_t z = GetZBinIndex(zvalue);
+       Int_t m = GetMultiplicityBinIndex(multiplicity);
 
-  fBGEventENegCounter[z][m]++;
+       if(fBGEventENegCounter[z][m] >= fNEvents){
+               fBGEventENegCounter[z][m]=0;
+       }
+       Int_t eventENegCounter=fBGEventENegCounter[z][m];
+       
+       //first clear the vector
+       // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
+       //  cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
+
+       //  cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
+       for(UInt_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){
+               delete (AliAODConversionPhoton*)(fBGEventsENeg[z][m][eventENegCounter][d]);
+       }
 
+       fBGEventsENeg[z][m][eventENegCounter].clear();
 
+       // add the electron to the vector
+       for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){
+               //    AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
+               fBGEventsENeg[z][m][eventENegCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventENeg->At(i))));
+       }
+       fBGEventENegCounter[z][m]++;
 }
+
+//_____________________________________________________________________________________________________________________________
 AliGammaConversionAODVector* AliGammaConversionAODBGHandler::GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event){
-  //see headerfile for documentation
-  return &(fBGEvents[zbin][mbin][event]);
+       //see headerfile for documentation
+       return &(fBGEvents[zbin][mbin][event]);
 }
-AliGammaConversionAODVector* AliGammaConversionAODBGHandler::GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity){
-
-
-  //see headerfile for documentation
-  Int_t z = GetZBinIndex(zvalue);
-  Int_t m = GetMultiplicityBinIndex(multiplicity);
-  return &(fBGEventsENeg[z][m][event]);
 
+//_____________________________________________________________________________________________________________________________
+AliGammaConversionMotherAODVector* AliGammaConversionAODBGHandler::GetBGGoodMesons(Int_t zbin, Int_t mbin, Int_t event){
+       //see headerfile for documentation
+       return &(fBGEventsMeson[zbin][mbin][event]);
+}
 
+//_____________________________________________________________________________________________________________________________
+AliGammaConversionAODVector* AliGammaConversionAODBGHandler::GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity){
+       //see headerfile for documentation
+       Int_t z = GetZBinIndex(zvalue);
+       Int_t m = GetMultiplicityBinIndex(multiplicity);
+       return &(fBGEventsENeg[z][m][event]);
 }
+
+//_____________________________________________________________________________________________________________________________
 void AliGammaConversionAODBGHandler::PrintBGArray(){
-  //see headerfile for documentation
-  for(Int_t z=0;z<fNBinsZ;z++){
-    if(z==2){
-      cout<<"Getting the data for z bin: "<<z<<endl;
-      for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){
-       if(multiplicity==2){
-         cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl;  
-         for(Int_t event=0;event<fNEvents;event++){
-           if(fBGEvents[z][multiplicity][event].size()>0){
-             cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl;
-           }
-         }
-       }
-      }
-    }
-  }
+       //see headerfile for documentation
+       for(Int_t z=0;z<fNBinsZ;z++){
+               if(z==2){
+                       cout<<"Getting the data for z bin: "<<z<<endl;
+                       for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){
+                               if(multiplicity==2){
+                                       cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl;    
+                                       for(Int_t event=0;event<fNEvents;event++){
+                                               if(fBGEvents[z][multiplicity][event].size()>0){
+                                               cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
 }
index 2332767..a655abe 100644 (file)
@@ -26,62 +26,76 @@ using namespace std;
 #endif
 
 typedef vector<AliAODConversionPhoton*> AliGammaConversionAODVector;
+typedef vector<AliAODConversionMother*> AliGammaConversionMotherAODVector;
 
 class AliGammaConversionAODBGHandler : public TObject {
 
-public: 
-   struct GammaConversionVertex
-   {
-      Double_t fX;
-      Double_t fY;
-      Double_t fZ;
-      Double_t fEP;
-   };
-   typedef struct GammaConversionVertex GammaConversionVertex; //!
-
-   typedef vector<AliGammaConversionAODVector> AliGammaConversionBGEventVector;
-   typedef vector<AliGammaConversionBGEventVector> AliGammaConversionMultipicityVector;
-   typedef vector<AliGammaConversionMultipicityVector> AliGammaConversionBGVector;
-
-   AliGammaConversionAODBGHandler();                                                        //constructor
-   AliGammaConversionAODBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t nEvents); // constructor
-   AliGammaConversionAODBGHandler(UInt_t collisionSystem,UInt_t centMin,UInt_t centMax,UInt_t nEvents, Bool_t useTrackMult);
-   AliGammaConversionAODBGHandler(const AliGammaConversionAODBGHandler & g);                   //copy constructor
-   AliGammaConversionAODBGHandler & operator = (const AliGammaConversionAODBGHandler & g);     //assignment operator
-   virtual ~AliGammaConversionAODBGHandler();                                               //virtual destructor
-
-   void Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray);
-
-   Int_t GetZBinIndex(Double_t z) const;
-
-   Int_t GetMultiplicityBinIndex(Int_t mult) const;
-
-   void AddEvent(TList* const eventGammas, Double_t xvalue,Double_t yvalue,Double_t zvalue, Int_t multiplicity, Double_t epvalue = -100);
-   void AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity);
-
-   Int_t GetNBGEvents()const {return fNEvents;}
-
-   AliGammaConversionAODVector* GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event);
-   AliGammaConversionAODVector* GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity);
-   void PrintBGArray();
-
-   GammaConversionVertex * GetBGEventVertex(Int_t zbin, Int_t mbin, Int_t event){return &fBGEventVertex[zbin][mbin][event];}
-
-   Double_t GetBGProb(Int_t z, Int_t m){return fBGProbability[z][m];}
-
-private:
-
-   Int_t fNEvents; // number of events
-   Int_t ** fBGEventCounter; //! bg counter
-   Int_t ** fBGEventENegCounter;//! bg electron counter
-   Double_t ** fBGProbability; //! prob per bin
-   GammaConversionVertex *** fBGEventVertex;//! array of event vertex
-   Int_t fNBinsZ; //n z bins
-   Int_t fNBinsMultiplicity; //n bins multiplicity
-   Double_t *fBinLimitsArrayZ;//! bin limits z array
-   Double_t *fBinLimitsArrayMultiplicity;//! bin limit multiplicity array
-   AliGammaConversionBGVector fBGEvents; //background events
-   AliGammaConversionBGVector fBGEventsENeg; //background electron events
-   ClassDef(AliGammaConversionAODBGHandler,3)
+       public: 
+       struct GammaConversionVertex{
+               Double_t fX;
+               Double_t fY;
+               Double_t fZ;
+               Double_t fEP;
+       };
+       
+       typedef struct GammaConversionVertex GammaConversionVertex;                                                                                                                             //!
+
+       typedef vector<AliGammaConversionAODVector> AliGammaConversionBGEventVector;
+       typedef vector<AliGammaConversionBGEventVector> AliGammaConversionMultipicityVector;
+       typedef vector<AliGammaConversionMultipicityVector> AliGammaConversionBGVector;
+
+       typedef vector<AliGammaConversionMotherAODVector> AliGammaConversionMotherBGEventVector;
+       typedef vector<AliGammaConversionMotherBGEventVector> AliGammaConversionMotherMultipicityVector;
+       typedef vector<AliGammaConversionMotherMultipicityVector> AliGammaConversionMotherBGVector;
+       
+       AliGammaConversionAODBGHandler();                                                                                                                                                                                       //constructor
+       AliGammaConversionAODBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t nEvents);                                                                            // constructor
+       AliGammaConversionAODBGHandler(UInt_t collisionSystem,UInt_t centMin,UInt_t centMax,UInt_t nEvents, Bool_t useTrackMult);
+       AliGammaConversionAODBGHandler(const AliGammaConversionAODBGHandler & g);                                                                                                       //copy constructor
+       AliGammaConversionAODBGHandler & operator = (const AliGammaConversionAODBGHandler & g);                                                                         //assignment operator
+       virtual ~AliGammaConversionAODBGHandler();                                                                                                                                                                      //virtual destructor
+
+       void Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray);
+
+       Int_t GetZBinIndex(Double_t z) const;
+
+       Int_t GetMultiplicityBinIndex(Int_t mult) const;
+
+       void AddEvent(TList* const eventGammas, Double_t xvalue,Double_t yvalue,Double_t zvalue, Int_t multiplicity, Double_t epvalue = -100);
+       void AddMesonEvent(TList* const eventMothers, Double_t xvalue,Double_t yvalue,Double_t zvalue, Int_t multiplicity, Double_t epvalue = -100);
+       void AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity);
+
+       Int_t GetNBGEvents()const {return fNEvents;}
+
+       // Get BG photons
+       AliGammaConversionAODVector* GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event);
+       // Get BG mesons
+       AliGammaConversionMotherAODVector* GetBGGoodMesons(Int_t zbin, Int_t mbin, Int_t event);
+       // Get BG electron
+       AliGammaConversionAODVector* GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity);
+       
+       void PrintBGArray();
+
+       GammaConversionVertex * GetBGEventVertex(Int_t zbin, Int_t mbin, Int_t event){return &fBGEventVertex[zbin][mbin][event];}
+
+       Double_t GetBGProb(Int_t z, Int_t m){return fBGProbability[z][m];}
+
+       private:
+
+               Int_t                                                           fNEvents;                                               // number of events
+               Int_t **                                                        fBGEventCounter;                                //! bg counter
+               Int_t **                                                        fBGEventENegCounter;                    //! bg electron counter
+               Int_t **                                                        fBGEventMesonCounter;                   //! bg counter
+               Double_t **                                             fBGProbability;                                 //! prob per bin
+               GammaConversionVertex ***                       fBGEventVertex;                                 //! array of event vertex
+               Int_t                                                           fNBinsZ;                                                //n z bins
+               Int_t                                                           fNBinsMultiplicity;                     //n bins multiplicity
+               Double_t *                                                      fBinLimitsArrayZ;                               //! bin limits z array
+               Double_t *                                                      fBinLimitsArrayMultiplicity;    //! bin limit multiplicity array
+               AliGammaConversionBGVector                      fBGEvents;                                              // photon background events
+               AliGammaConversionBGVector                      fBGEventsENeg;                                  // electron background electron events
+               AliGammaConversionMotherBGVector        fBGEventsMeson;                                 // neutral meson background events
+               
+       ClassDef(AliGammaConversionAODBGHandler,4)
 };
 #endif