updated GammaConv software to estimate pileup
authorfbock <fbock@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Aug 2013 13:54:12 +0000 (13:54 +0000)
committerfbock <fbock@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Aug 2013 13:54:12 +0000 (13:54 +0000)
25 files changed:
PWGGA/GammaConv/AliAODConversionMother.cxx
PWGGA/GammaConv/AliAODConversionMother.h
PWGGA/GammaConv/AliAODConversionPhoton.cxx
PWGGA/GammaConv/AliAODConversionPhoton.h
PWGGA/GammaConv/AliAnalysisTaskConversionQA.cxx
PWGGA/GammaConv/AliAnalysisTaskConversionQA.h
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitzV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitzV1.h
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.h
PWGGA/GammaConv/AliConversionCuts.cxx
PWGGA/GammaConv/AliConversionCuts.h
PWGGA/GammaConv/AliConversionMesonCuts.cxx
PWGGA/GammaConv/AliConversionMesonCuts.h
PWGGA/GammaConv/AliConversionPhotonBase.cxx
PWGGA/GammaConv/AliConversionPhotonBase.h
PWGGA/GammaConv/AliDalitzElectronCuts.cxx
PWGGA/GammaConv/AliDalitzElectronCuts.h
PWGGA/GammaConv/AliV0ReaderV1.cxx
PWGGA/GammaConv/AliV0ReaderV1.h
PWGGA/GammaConv/macros/AddTask_ConversionAODProduction.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_PbPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_pPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_pp.C

index 216f402..2d68bb5 100644 (file)
@@ -15,11 +15,21 @@ AliAODConversionParticle(),
     fChi2(-1),
     fOpeningAngle(-1),
     fAlpha(-1),
-    fWeight(1)
+    fWeight(1),
+    fdcaBetweenPhotons(1),
+    fdcaZPrimVtx(100),
+    fdcaRPrimVtx(100),
+    fQuality(0)
+   
 {
        fLabel[0] = -1;
        fLabel[1] = -1;
        fLabel[2] = 0;
+   
+   fProductionVtx[0]=0;
+   fProductionVtx[1]=0;
+   fProductionVtx[2]=0;
+  
 }
 
 AliAODConversionMother::AliAODConversionMother(AliKFConversionMother *kf):
@@ -28,11 +38,19 @@ fMCLabel(kf->GetMCLabel()),
 fChi2(kf->GetChi2()),
 fOpeningAngle(kf->GetOpeningAngle()),
 fAlpha(kf->GetAlpha()),
-fWeight(1)
+fWeight(1),
+fdcaBetweenPhotons(100),
+fdcaZPrimVtx(100),
+fdcaRPrimVtx(100),
+fQuality(0)
 {
     // Set 4momentu
     SetPxPyPzE(kf->GetPx(),kf->GetPy(),kf->GetPz(),kf->GetE());
 
+   fProductionVtx[0]=0;
+   fProductionVtx[1]=0;
+   fProductionVtx[2]=0;
+  
      //Set Decay Photon Labels
     fLabel[0]=kf->GetGammaLabel(0);
     fLabel[1]=kf->GetGammaLabel(1);
@@ -45,7 +63,11 @@ fMCLabel(-1),
 fChi2(-1),
 fOpeningAngle(-1),
 fAlpha(-1),
-fWeight(1)
+fWeight(1),
+fdcaBetweenPhotons(1),
+fdcaZPrimVtx(100),
+fdcaRPrimVtx(100),
+fQuality(0)
 {
     // Set 4momentum
     SetPxPyPzE(y1->Px()+y2->Px(),y1->Py()+y2->Py(),y1->Pz()+y2->Pz(),y1->E()+y2->E());
@@ -54,7 +76,8 @@ fWeight(1)
     TVector3 v1(y1->Px(),y1->Py(),y1->Pz());
     TVector3 v2(y2->Px(),y2->Py(),y2->Pz());
     fOpeningAngle=v1.Angle(v2);
-
+    fdcaBetweenPhotons = CalculateDistanceBetweenPhotons(y1,y2,fProductionVtx);
+    DetermineMesonQuality(y1,y2);
     // Calculate Alpha
     if((y1->E()+y2->E()) != 0){
        fAlpha=TMath::Abs((y1->E()-y2->E())/(y1->E()+y2->E()));
@@ -94,3 +117,115 @@ Bool_t AliAODConversionMother::IsTrueMeson(AliStack *fMCStack,Int_t pdgcode){
     return kFALSE;
 }
 
+Float_t AliAODConversionMother::CalculateDistanceBetweenPhotons(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2 , Double_t prodPoint[3]){
+
+   TVector3 a(y1->GetConversionX(),y1->GetConversionY(),y1->GetConversionZ());
+   TVector3 b(y1->GetPx(),y1->GetPy(),y1->GetPz());
+   TVector3 c(y2->GetConversionX(),y2->GetConversionY(),y2->GetConversionZ());
+   TVector3 d(y2->GetPx(),y2->GetPy(),y2->GetPz());
+   
+   TVector3 n = b.Cross(d);
+   TVector3 nn = n.Unit();
+   
+   Double_t dist = 0;
+   if (n.Mag() == 0){
+      TVector3 e = a-c;
+      if (d.Mag() != 0){
+         dist = TMath::Abs((e.Cross(d)).Mag())/TMath::Abs(d.Mag());
+      }
+      prodPoint[0] = 0;
+      prodPoint[1] = 0;
+      prodPoint[2] = 0;
+   } else {   
+      dist = TMath::Abs(n.Dot(c-a))/TMath::Abs(n.Mag());
+      Double_t lambda = (b.Dot(d) * (a-c).Dot(d) - d.Dot(d) * (a-c).Dot(b))/(b.Dot(b) * d.Dot(d) - TMath::Power(b.Dot(d),2));
+      Double_t mu = ((a-c).Dot(d) * b.Dot(b) - (a-c).Dot(b) * b.Dot(d) )/(b.Dot(b) * d.Dot(d) - TMath::Power(b.Dot(d),2));
+      
+      TVector3 S1 = a + lambda* b;
+      TVector3 S2 = c + mu* d;
+      TVector3 Prod = S1 + 0.5*dist*(S2-S1).Unit();
+      prodPoint[0] = Prod(0);
+      prodPoint[1] = Prod(1);
+      prodPoint[2] = Prod(2);
+      
+   }
+   return dist;
+}
+
+///________________________________________________________________________
+void AliAODConversionMother::CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex){
+
+   Double_t primCo[3] = {primVertex->GetX(),primVertex->GetY(),primVertex->GetZ()};
+
+   Double_t absoluteP = TMath::Sqrt(TMath::Power(Px(),2) + TMath::Power(Py(),2) + TMath::Power(Pz(),2));   
+   Double_t p[3] = {Px()/absoluteP,Py()/absoluteP,Pz()/absoluteP};
+   Double_t CP[3];
+   
+   CP[0] =  fProductionVtx[0] - primCo[0];
+   CP[1] =  fProductionVtx[1] - primCo[1];
+   CP[2] =  fProductionVtx[2] - primCo[2];
+   
+   Double_t Lambda = - (CP[0]*p[0]+CP[1]*p[1]+CP[2]*p[2])/(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
+   
+   Double_t S[3];
+   S[0] = fProductionVtx[0] + p[0]*Lambda;
+   S[1] = fProductionVtx[1] + p[1]*Lambda;
+   S[2] = fProductionVtx[2] + p[2]*Lambda;
+   
+   fdcaRPrimVtx = TMath::Sqrt( TMath::Power(primCo[0]-S[0],2) + TMath::Power(primCo[1]-S[1],2));
+   fdcaZPrimVtx = primCo[2]-S[2];
+   
+   
+//    cout << "DCA z: " << dca[1] << "\t DCA r: " << dca[0] << "\t DCA 3d: " << TMath::Sqrt(dca[1]*dca[1] + dca[0]*dca[0]) << endl;
+   
+   
+   return;
+}
+
+///________________________________________________________________________
+void AliAODConversionMother::DetermineMesonQuality(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2){
+   UChar_t photonQA1 = y1->GetPhotonQuality();
+   UChar_t photonQA2 = y2->GetPhotonQuality();
+   
+   if (photonQA1 == 0 || photonQA2 == 0){
+      fQuality = 0;
+      return;
+   } 
+   if (photonQA1 == 1 && photonQA2 == 1){
+      fQuality = 1;
+      return;
+   }               
+   if (photonQA1 == 2 && photonQA2 == 2){
+      fQuality = 4;
+      return;
+   }               
+   if (photonQA1 == 3 && photonQA2 == 3){
+      fQuality = 6;
+      return;
+   }         
+   if (photonQA1 == 1){
+       if (photonQA2 == 2){
+        fQuality = 2;  
+        return;
+       }
+       if (photonQA2 == 3){
+        fQuality = 3;  
+        return;
+       }
+   }
+   if (photonQA2 == 1){
+       if (photonQA1 == 2){
+        fQuality = 2;  
+        return;
+       }
+       if (photonQA1 == 3){
+        fQuality = 3;  
+        return;
+       }
+   }
+   if ((photonQA1 == 2 && photonQA2 == 3)|| (photonQA1 == 3 && photonQA2 == 2)){
+        fQuality = 5;  
+        return;
+   }
+   
+}
index 6993989..eecc4ef 100644 (file)
@@ -55,8 +55,18 @@ class AliAODConversionMother : public AliAODConversionParticle{
      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];}
+     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;}
@@ -64,6 +74,10 @@ class AliAODConversionMother : public AliAODConversionParticle{
      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
@@ -71,8 +85,21 @@ private:
     Double_t fOpeningAngle;
     Double_t fAlpha;
     Double_t fWeight; // Weight for BG Calculation
-
-    ClassDef(AliAODConversionMother,3)
+    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)
 };
 
 #endif
index aaac331..f69f7ba 100644 (file)
@@ -7,14 +7,18 @@ ClassImp(AliAODConversionPhoton)
 
 AliAODConversionPhoton::AliAODConversionPhoton() :
 AliAODConversionParticle(),
-AliConversionPhotonBase()
+AliConversionPhotonBase(),
+fDCArPrimVtx(0),
+fDCAzPrimVtx(0)
 {
   //Standard constructor
 }
 
 AliAODConversionPhoton::AliAODConversionPhoton(AliKFConversionPhoton *kfphoton) :
 AliAODConversionParticle(kfphoton),
-AliConversionPhotonBase(*((AliConversionPhotonBase*)kfphoton))
+AliConversionPhotonBase(*((AliConversionPhotonBase*)kfphoton)),
+fDCArPrimVtx(0),
+fDCAzPrimVtx(0)
 {
     //Constructor from kfphoton
 
@@ -25,7 +29,9 @@ AliConversionPhotonBase(*((AliConversionPhotonBase*)kfphoton))
 
 AliAODConversionPhoton::AliAODConversionPhoton(TLorentzVector *vec) :
 AliAODConversionParticle(vec),
-AliConversionPhotonBase()
+AliConversionPhotonBase(),
+fDCArPrimVtx(0),
+fDCAzPrimVtx(0)
 {
     //Constructor from TLorentzVector
 }
@@ -34,7 +40,9 @@ AliConversionPhotonBase()
 
 AliAODConversionPhoton::AliAODConversionPhoton(const AliAODConversionPhoton & original) :
 AliAODConversionParticle(original),
-AliConversionPhotonBase(original)
+AliConversionPhotonBase(original),
+fDCArPrimVtx(original.fDCArPrimVtx),
+fDCAzPrimVtx(original.fDCAzPrimVtx)
 {
   //Copy constructor
 }
@@ -49,3 +57,30 @@ AliAODConversionPhoton & AliAODConversionPhoton::operator = (const AliAODConvers
   // assignment operator
   return *this;
 }
+
+///________________________________________________________________________
+void AliAODConversionPhoton::CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex ){
+
+   Double_t primCo[3] = {primVertex->GetX(),primVertex->GetY(),primVertex->GetZ()};
+
+   Double_t absoluteP = TMath::Sqrt(TMath::Power(GetPx(),2) + TMath::Power(GetPy(),2) + TMath::Power(GetPz(),2));   
+   Double_t p[3] = {GetPx()/absoluteP,GetPy()/absoluteP,GetPz()/absoluteP};
+   Double_t CP[3];
+   
+   CP[0] =  fConversionPoint[0] - primCo[0];
+   CP[1] =  fConversionPoint[1] - primCo[1];
+   CP[2] =  fConversionPoint[2] - primCo[2];
+   
+   Double_t Lambda = - (CP[0]*p[0]+CP[1]*p[1]+CP[2]*p[2])/(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
+   
+   Double_t S[3];
+   S[0] = fConversionPoint[0] + p[0]*Lambda;
+   S[1] = fConversionPoint[1] + p[1]*Lambda;
+   S[2] = fConversionPoint[2] + p[2]*Lambda;
+  
+   fDCArPrimVtx = TMath::Sqrt( TMath::Power(primCo[0]-S[0],2) + TMath::Power(primCo[1]-S[1],2));
+   fDCAzPrimVtx = primCo[2]-S[2];
+    
+   return;
+}
+
index 06e7ae1..15bbd1f 100644 (file)
@@ -36,9 +36,16 @@ class AliAODConversionPhoton : public AliAODConversionParticle, public AliConver
   virtual Double_t GetPx() const { return AliAODConversionParticle::Px();}
   virtual Double_t GetPy() const { return AliAODConversionParticle::Py();}
   virtual Double_t GetPz() const { return AliAODConversionParticle::Pz();}
+  void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex);
   void SetMassToZero() { SetE(P()); }
-
-  ClassDef(AliAODConversionPhoton,1)
+  Float_t GetDCAzToPrimVtx()const {return fDCAzPrimVtx;}
+  Float_t GetDCArToPrimVtx()const {return fDCArPrimVtx;}
+  
+  Float_t fDCArPrimVtx;
+  Float_t fDCAzPrimVtx;
+  
+  
+  ClassDef(AliAODConversionPhoton,2)
 };
 
 
index c7c2b58..adab435 100644 (file)
@@ -71,6 +71,7 @@ AliAnalysisTaskConversionQA::AliAnalysisTaskConversionQA() : AliAnalysisTaskSE()
    hElecPhi(NULL),
    hElecNfindableClsTPC(NULL),
    hPosiNfindableClsTPC(NULL),
+   hElecAsymP(NULL),
    fTrueList(NULL),
    hTrueResolutionR(NULL),
    hTrueResolutionZ(NULL),
@@ -90,6 +91,7 @@ AliAnalysisTaskConversionQA::AliAnalysisTaskConversionQA() : AliAnalysisTaskSE()
    hTrueElecPhi(NULL),
    hTrueElecNfindableClsTPC(NULL),
    hTruePosiNfindableClsTPC(NULL),
+   hTrueElecAsymP(NULL),
    fIsMC(kFALSE),
    fnGammaCandidates(1),
    fMCStackPos(NULL),
@@ -130,6 +132,7 @@ AliAnalysisTaskConversionQA::AliAnalysisTaskConversionQA(const char *name) : Ali
    hElecPhi(NULL),
    hElecNfindableClsTPC(NULL),
    hPosiNfindableClsTPC(NULL),
+   hElecAsymP(NULL),
    fTrueList(NULL),
    hTrueResolutionR(NULL),
    hTrueResolutionZ(NULL),
@@ -149,6 +152,7 @@ AliAnalysisTaskConversionQA::AliAnalysisTaskConversionQA(const char *name) : Ali
    hTrueElecPhi(NULL),
    hTrueElecNfindableClsTPC(NULL),
    hTruePosiNfindableClsTPC(NULL),
+   hTrueElecAsymP(NULL),
    fIsMC(kFALSE),
    fnGammaCandidates(1),
    fMCStackPos(NULL),
@@ -232,6 +236,8 @@ void AliAnalysisTaskConversionQA::UserCreateOutputObjects()
       fESDList->Add(hElecNfindableClsTPC);
       hPosiNfindableClsTPC = new TH1F("Positron_findableClusterTPC","Positron_findableClusterTPC",100,0,1);
       fESDList->Add(hPosiNfindableClsTPC);
+      hElecAsymP = new TH2F("Electron_Asym_vs_P", "Electron_Asym_vs_P",200,0.,20.,200,0.,1.); 
+      fESDList->Add(hElecAsymP);
 
       if(fIsMC){
          fTrueList = new TList();
@@ -277,6 +283,8 @@ void AliAnalysisTaskConversionQA::UserCreateOutputObjects()
          fTrueList->Add(hTrueElecNfindableClsTPC);
          hTruePosiNfindableClsTPC = new TH1F("True_Positron_findableClusterTPC","True_Positron_findableClusterTPC",100,0,1);
          fTrueList->Add(hTruePosiNfindableClsTPC);
+                                hTrueElecAsymP = new TH2F("True_Electron_Asym_vs_P", "True_Electron_Asym_vs_P",200,0.,20.,200,0.,1.); 
+                                fTrueList->Add(hTrueElecAsymP);
       }
       if(fConversionCuts->GetCutHistograms()){
          fOutputList->Add(fConversionCuts->GetCutHistograms());
@@ -383,6 +391,9 @@ void AliAnalysisTaskConversionQA::ProcessQATree(AliAODConversionPhoton *gamma){
 
    // Fill Histograms for QA and MC
    AliVEvent* event = (AliVEvent*) InputEvent();
+   
+   
+   
    AliPIDResponse* pidResonse = ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
 
    Float_t gammaPt = gamma->GetPhotonPt();
@@ -393,6 +404,9 @@ void AliAnalysisTaskConversionQA::ProcessQATree(AliAODConversionPhoton *gamma){
    Float_t gammaAlpha = gamma->GetArmenterosAlpha();
    Float_t gammaPsiPair = gamma->GetPsiPair();
    Float_t gammaCosPointing = fConversionCuts->GetCosineOfPointingAngle(gamma,event);
+       Float_t gammaMass = gamma->GetMass();
+   Float_t dcaToPrim[2];
+   gamma->GetDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex(),dcaToPrim);
    TVectorF conversionPoint(3);
    conversionPoint(0) = gamma->GetConversionX();
    conversionPoint(1) = gamma->GetConversionY();
@@ -401,10 +415,11 @@ void AliAnalysisTaskConversionQA::ProcessQATree(AliAODConversionPhoton *gamma){
    AliVTrack * negTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelNegative());
    AliVTrack * posTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelPositive());
 
+   
    if(!negTrack||!posTrack)return;
 
-   Bool_t isTruePhoton = kFALSE;
-   if(fMCEvent && fInputEvent->IsA()==AliVEvent::Class()){
+   UInt_t isTruePhoton = 9;
+   if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
       isTruePhoton = IsTruePhotonESD(gamma);
    } else if (fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
       isTruePhoton = IsTruePhotonAOD(gamma);   
@@ -483,6 +498,9 @@ void AliAnalysisTaskConversionQA::ProcessQATree(AliAODConversionPhoton *gamma){
                      << "alpha=" << gammaAlpha
                      << "psipair=" << gammaPsiPair
                      << "cosPoint=" << gammaCosPointing
+                                                       << "mass="<< gammaMass
+                                                       << "dcaR="<< dcaToPrim[0]
+                                                       << "dcaZ="<< dcaToPrim[1]
                      << "TruePhoton=" << isTruePhoton
                      << "conversionPoint=" << &conversionPoint
                      << "daugtherProp.=" << &daughterProp
@@ -498,6 +516,9 @@ void AliAnalysisTaskConversionQA::ProcessQATree(AliAODConversionPhoton *gamma){
                      << "alpha=" << gammaAlpha
                      << "psipair=" << gammaPsiPair
                      << "cosPoint=" << gammaCosPointing
+                                                       << "mass="<< gammaMass
+                                                       << "dcaR="<< dcaToPrim[0]
+                     << "dcaZ="<< dcaToPrim[1]
                      << "conversionPoint=" << &conversionPoint
                      << "daugtherProp.=" << &daughterProp
                      << "\n";
@@ -543,7 +564,9 @@ void AliAnalysisTaskConversionQA::ProcessQA(AliAODConversionPhoton *gamma){
 
    hElecNfindableClsTPC->Fill((Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
    hPosiNfindableClsTPC->Fill((Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
-
+   if(gamma->P()!=0){
+                hElecAsymP->Fill(gamma->P(),negTrack->P()/gamma->P());
+        }
    // hElecNfindableClsTPC->Fill((Float_t)negTrack->GetNcls(1)/(Float_t)negTrack->GetTPCNclsF());
    // hPosiNfindableClsTPC->Fill((Float_t)posTrack->GetNcls(1)/(Float_t)posTrack->GetTPCNclsF());
    if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
@@ -556,7 +579,9 @@ void AliAnalysisTaskConversionQA::ProcessQA(AliAODConversionPhoton *gamma){
 //________________________________________________________________________
 void AliAnalysisTaskConversionQA::ProcessTrueQAESD(AliAODConversionPhoton *TruePhotonCandidate, AliESDtrack *elec, AliESDtrack *posi)
 {
-   if(!IsTruePhotonESD(TruePhotonCandidate)) return;
+
+   if(IsTruePhotonESD(TruePhotonCandidate)!=0 && IsTruePhotonESD(TruePhotonCandidate)!=5  ) return;
+
    TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
    TParticle *mcPhoton = TruePhotonCandidate->GetMCParticle(fMCStack);
    // True Photon
@@ -583,6 +608,10 @@ void AliAnalysisTaskConversionQA::ProcessTrueQAESD(AliAODConversionPhoton *TrueP
       ->Fill((Float_t)elec->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(TruePhotonCandidate->GetConversionRadius())));
    hTruePosiNfindableClsTPC
       ->Fill((Float_t)posi->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(TruePhotonCandidate->GetConversionRadius())));
+   if(TruePhotonCandidate->P()!=0){
+                hTrueElecAsymP->Fill(TruePhotonCandidate->P(),elec->P()/TruePhotonCandidate->P());
+        }
+
    // hTrueElecNfindableClsTPC->Fill((Float_t)elec->GetNcls(1)/(Float_t)elec->GetTPCNclsF());
    // hTruePosiNfindableClsTPC->Fill((Float_t)posi->GetNcls(1)/(Float_t)posi->GetTPCNclsF());
 }
@@ -590,7 +619,8 @@ void AliAnalysisTaskConversionQA::ProcessTrueQAESD(AliAODConversionPhoton *TrueP
 //________________________________________________________________________
 void AliAnalysisTaskConversionQA::ProcessTrueQAAOD(AliAODConversionPhoton *TruePhotonCandidate, AliAODTrack *elec, AliAODTrack *posi)
 {
-   if(!IsTruePhotonAOD(TruePhotonCandidate)) return;
+
+   if(IsTruePhotonAOD(TruePhotonCandidate)!=0 && IsTruePhotonESD(TruePhotonCandidate)!=5 ) return;
 
    TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
    AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
@@ -660,6 +690,7 @@ void AliAnalysisTaskConversionQA::CountTracks(){
    return;
 }
 //________________________________________________________________________
+/*
 Bool_t AliAnalysisTaskConversionQA::IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate)
 {
    TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
@@ -679,30 +710,119 @@ Bool_t AliAnalysisTaskConversionQA::IsTruePhotonESD(AliAODConversionPhoton *True
 
    return kTRUE;
 }
+*/
+UInt_t AliAnalysisTaskConversionQA::IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate)
+{
+
+
+       UInt_t kind = 9;
+       TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
+       TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
+       TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
+       Int_t motherLabelPhoton; 
+       Int_t pdgCodePos; 
+       Int_t pdgCodeNeg; 
+       Int_t pdgCode; 
+
+
+       if(posDaughter == NULL || negDaughter == NULL) {
+               kind = 9;
+               //              return kFALSE; // One particle does not exist
+   
+  } else if( posDaughter->GetMother(0) != negDaughter->GetMother(0)  || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) {
+               //              kind = 1;
+         return 1;
+               pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
+               pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
+               if(pdgCodePos==11 && pdgCodeNeg==11) return 10; //Electron Combinatorial
+               if(pdgCodePos==11 && pdgCodeNeg==11 && 
+                       (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) return 15; //direct Electron Combinatorial
+                               
+               if(pdgCodePos==211 && pdgCodeNeg==211) return 11; //Pion Combinatorial
+               if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211))       return 12; //Pion, Proton Combinatorics
+               if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) return 13; //Pion, Electron Combinatorics
+               if(pdgCodePos==321 || pdgCodeNeg==321) return 14; //Kaon combinatorics
+       }else{          
+               pdgCodePos=posDaughter->GetPdgCode();
+               pdgCodeNeg=negDaughter->GetPdgCode();
+         motherLabelPhoton= Photon->GetMother(0);
+               if ( TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode()) pdgCode = TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode(); 
+
+               if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) return 2; // true from hadronic decays
+               else if ( !(pdgCodeNeg==pdgCodePos)){
+                       if(pdgCode == 111) return 3; // pi0 Dalitz
+                       else if (pdgCode == 221) return 4; // eta Dalitz
+                       else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
+                               if(pdgCode == 22 && motherLabelPhoton < fMCStack->GetNprimary()){
+                                       return 0; // primary photons
+                               } else if (pdgCode == 22){
+                                       return 5; //secondary photons
+                               }
+                       }
+               }
+       }
+
+       return kind;
+}
 
 //________________________________________________________________________
-Bool_t AliAnalysisTaskConversionQA::IsTruePhotonAOD(AliAODConversionPhoton *TruePhotonCandidate)
+UInt_t AliAnalysisTaskConversionQA::IsTruePhotonAOD(AliAODConversionPhoton *TruePhotonCandidate)
 {   
-   TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
-   AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
-   AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
-   
-   if(posDaughter == NULL || negDaughter == NULL) return kFALSE; // One particle does not exist
-   Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
-   if(posDaughter->GetMother() != negDaughter->GetMother()) return kFALSE;
-   else if(posDaughter->GetMother() == -1) return kFALSE;
-      
-   if(pdgCode[0]!=11 || pdgCode[1]!=11) return kFALSE; //One Particle is not a electron
 
-   if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return kFALSE; // Same Charge
+       UInt_t kind = 9;
+
+  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
+       AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
+       AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
+       Int_t motherLabelPhoton = Photon->GetMother();
+       Int_t pdgCodePos; 
+       Int_t pdgCodeNeg; 
+       Int_t pdgCode; 
 
-   if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5) return kFALSE;// check if the daughters come from a conversion 
-   // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
+       if(posDaughter == NULL || negDaughter == NULL) {
+               kind = 9;
+               //              return kFALSE; // One particle does not exist
    
-   AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
-   if(Photon->GetPdgCode() != 22) return kFALSE; // Mother is no Photon
+  } else if( posDaughter->GetMother() != negDaughter->GetMother()  || (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1)) {
+               kind = 1;
+
+               pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
+               pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
+               if(pdgCodePos==11 && pdgCodeNeg==11)    kind = 10; //Electron Combinatorial
+               if(pdgCodePos==11 && pdgCodeNeg==11 && 
+                       (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1))kind = 15; //direct Electron Combinatorial
+                               
+               if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
+               if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211))       kind = 12; //Pion, Proton Combinatorics
+               if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
+               if(pdgCodePos==321 || pdgCodeNeg==321) kind = 14; //Kaon combinatorics
+       }else{          
+               pdgCodePos=posDaughter->GetPdgCode();
+               pdgCodeNeg=negDaughter->GetPdgCode();
+
+               if ( TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode()) 
+                       pdgCode = TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode(); 
+               if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) kind = 2; // true from hadronic decays
+               else if ( !(pdgCodeNeg==pdgCodePos)){
+                       if(pdgCode == 111) kind = 3; // pi0 Dalitz
+                       else if (pdgCode == 221) kind = 4; // eta Dalitz
+                       else if (!(negDaughter->GetMCProcessCode() != 5 || posDaughter->GetMCProcessCode() !=5)){
+                               if(pdgCode == 22 && motherLabelPhoton < fMCStack->GetNprimary()){
+                                       kind = 0; // primary photons
+                               } else if (pdgCode == 22){
+                                       kind = 5; //secondary photons
+                               }
+                       }
+               }
+       }
+
+
+       return kind;
+
 
-   return kTRUE;
 }
 
 //________________________________________________________________________
index eb171ba..4b4fdb6 100644 (file)
@@ -52,8 +52,8 @@ class AliAnalysisTaskConversionQA : public AliAnalysisTaskSE{
    void RelabelAODPhotonCandidates(Bool_t mode);
    void ProcessTrueQAESD(AliAODConversionPhoton *TruePhotonCandidate, AliESDtrack *elec, AliESDtrack *posi);
    void ProcessTrueQAAOD(AliAODConversionPhoton *TruePhotonCandidate, AliAODTrack *elec, AliAODTrack *posi);
-   Bool_t IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate);
-   Bool_t IsTruePhotonAOD(AliAODConversionPhoton *TruePhotonCandidate);
+   UInt_t IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate);
+   UInt_t IsTruePhotonAOD(AliAODConversionPhoton *TruePhotonCandidate);
    void CountTracks();
    
        
@@ -89,6 +89,7 @@ class AliAnalysisTaskConversionQA : public AliAnalysisTaskSE{
    TH2F *hElecPhi;
    TH1F *hElecNfindableClsTPC;
    TH1F *hPosiNfindableClsTPC;
+   TH2F *hElecAsymP;
    TList *fTrueList;
    TH2F *hTrueResolutionR;
    TH2F *hTrueResolutionZ;
@@ -108,6 +109,7 @@ class AliAnalysisTaskConversionQA : public AliAnalysisTaskSE{
    TH2F *hTrueElecPhi;
    TH1F *hTrueElecNfindableClsTPC;
    TH1F *hTruePosiNfindableClsTPC;
+   TH2F *hTrueElecAsymP;
    Bool_t fIsMC;
    Int_t fnGammaCandidates;
    Int_t *fMCStackPos;     //[fnGammaCandidates]
index bf29c9f..6764450 100644 (file)
@@ -1,7 +1,7 @@
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
- * Author: Pedro González, Pedro Ladrón de Guevara, Ernesto López Torres, *
+ * Author: Pedro Gonz??lez, Pedro Ladr??n de Guevara, Ernesto L??pez Torres, *
  *         Eulogio Serradilla, Ana Marin, Friederike Bock                 *
  * Version 2                                                              *
  *                                                                        *
@@ -86,6 +86,19 @@ fV0Reader(NULL),
    hESDConvGammaPt(NULL),
    hESDDalitzElectronPt(NULL),
    hESDDalitzPositronPt(NULL),
+   hESDDalitzElectronPhi(NULL),
+   hESDDalitzPositronPhi(NULL),
+   hESDDalitzElectronAfterPt(NULL),
+   hESDDalitzPositronAfterPt(NULL),
+   hESDDalitzElectronAfterPhi(NULL),
+   hESDDalitzPositronAfterPhi(NULL),
+   hESDDalitzElectronAfterNFindClsTPC(NULL),
+   hESDDalitzPositronAfterNFindClsTPC(NULL),
+   hESDDalitzPosEleAfterDCAxy(NULL),
+   hESDDalitzPosEleAfterDCAz(NULL),
+   hESDDalitzPosEleAfterTPCdEdx(NULL),
+   hESDDalitzPosEleAfterTPCdEdxSignal(NULL),
+   hESDMotherPhi(NULL),
    hESDEposEnegPsiPairDPhi(NULL),
    hESDEposEnegInvMassPt(NULL),
    hESDEposEnegLikeSignBackInvMassPt(NULL),
@@ -119,6 +132,7 @@ fV0Reader(NULL),
    hESDTrueMotherChiCInvMassPt(NULL),
    hESDTrueMotherChiCDiffInvMassPt(NULL),
    hESDTrueMotherInvMassPt(NULL),
+   hESDTrueMotherDalitzInvMassPt(NULL),
    hESDTrueMotherPi0GGInvMassPt(NULL),
    hESDTruePrimaryMotherInvMassMCPt(NULL),
    hESDTruePrimaryPi0DalitzESDPtMCPt(NULL),
@@ -188,6 +202,19 @@ AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1( const char*
    hESDConvGammaPt(NULL),
    hESDDalitzElectronPt(NULL),
    hESDDalitzPositronPt(NULL),
+   hESDDalitzElectronPhi(NULL),
+   hESDDalitzPositronPhi(NULL),
+   hESDDalitzElectronAfterPt(NULL),
+   hESDDalitzPositronAfterPt(NULL),
+   hESDDalitzElectronAfterPhi(NULL),
+   hESDDalitzPositronAfterPhi(NULL),
+   hESDDalitzElectronAfterNFindClsTPC(NULL),
+   hESDDalitzPositronAfterNFindClsTPC(NULL),
+   hESDDalitzPosEleAfterDCAxy(NULL),
+   hESDDalitzPosEleAfterDCAz(NULL),
+   hESDDalitzPosEleAfterTPCdEdx(NULL),
+   hESDDalitzPosEleAfterTPCdEdxSignal(NULL),
+   hESDMotherPhi(NULL),
    hESDEposEnegPsiPairDPhi(NULL),
    hESDEposEnegInvMassPt(NULL),
    hESDEposEnegLikeSignBackInvMassPt(NULL),
@@ -221,6 +248,7 @@ AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1( const char*
    hESDTrueMotherChiCInvMassPt(NULL),
    hESDTrueMotherChiCDiffInvMassPt(NULL),
    hESDTrueMotherInvMassPt(NULL),
+   hESDTrueMotherDalitzInvMassPt(NULL),
    hESDTrueMotherPi0GGInvMassPt(NULL),
    hESDTruePrimaryMotherInvMassMCPt(NULL),
    hESDTruePrimaryPi0DalitzESDPtMCPt(NULL),
@@ -422,6 +450,19 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
    hESDConvGammaPt                 = new TH1F*[fnCuts];
    hESDDalitzElectronPt            = new TH1F*[fnCuts];
    hESDDalitzPositronPt            = new TH1F*[fnCuts];
+   hESDDalitzElectronPhi          = new TH1F*[fnCuts];
+   hESDDalitzPositronPhi          = new TH1F*[fnCuts];
+   hESDDalitzElectronAfterPt      = new TH1F*[fnCuts];
+   hESDDalitzPositronAfterPt       = new TH1F*[fnCuts];
+   hESDDalitzElectronAfterPhi      = new TH1F*[fnCuts];
+   hESDDalitzPositronAfterPhi      = new TH1F*[fnCuts];
+   hESDDalitzElectronAfterNFindClsTPC = new TH2F*[fnCuts];
+   hESDDalitzPositronAfterNFindClsTPC = new TH2F*[fnCuts];
+   hESDDalitzPosEleAfterDCAxy     = new TH2F*[fnCuts];
+   hESDDalitzPosEleAfterDCAz       = new TH2F*[fnCuts];
+   hESDDalitzPosEleAfterTPCdEdx    = new TH2F*[fnCuts];
+   hESDDalitzPosEleAfterTPCdEdxSignal = new TH2F*[fnCuts];
+   hESDMotherPhi                   = new TH1F*[fnCuts];
    hESDEposEnegPsiPairDPhi         = new TH2F*[fnCuts];
    hESDEposEnegInvMassPt           = new TH2F*[fnCuts];
    hESDEposEnegLikeSignBackInvMassPt = new TH2F*[fnCuts];
@@ -476,8 +517,47 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
 
       hESDDalitzPositronPt[iCut] = new TH1F("ESD_DalitzPositron_Pt","ESD_DalitzPositron_Pt",1000,0,25);
       fESDList[iCut]->Add(hESDDalitzPositronPt[iCut]);
+      
+      
+      hESDDalitzElectronPhi[iCut] = new TH1F("ESD_DalitzElectron_Phi","ESD_DalitzElectron_Phi",360,0,2*TMath::Pi());
+      fESDList[iCut]->Add(hESDDalitzElectronPhi[iCut]);
+
+      hESDDalitzPositronPhi[iCut] = new TH1F("ESD_DalitzPositron_Phi","ESD_DalitzPositron_Phi",360,0,2*TMath::Pi());
+      fESDList[iCut]->Add(hESDDalitzPositronPhi[iCut]);
+      
+      
+      
+      hESDDalitzElectronAfterPt[iCut] = new TH1F("ESD_DalitzElectron_After_Pt","ESD_DalitzElectron_After_Pt",1000,0,25);
+      fESDList[iCut]->Add(hESDDalitzElectronAfterPt[iCut]);
 
+      hESDDalitzPositronAfterPt[iCut] = new TH1F("ESD_DalitzPositron_After_Pt","ESD_DalitzPositron_After_Pt",1000,0,25);
+      fESDList[iCut]->Add(hESDDalitzPositronAfterPt[iCut]);
+      
+      
+      hESDDalitzElectronAfterPhi[iCut] = new TH1F("ESD_DalitzElectron_After_Phi","ESD_DalitzElectron_After_Phi",360,0,2*TMath::Pi());
+      fESDList[iCut]->Add(hESDDalitzElectronAfterPhi[iCut]);
 
+      hESDDalitzPositronAfterPhi[iCut] = new TH1F("ESD_DalitzPositron_After_Phi","ESD_DalitzPositron_After_Phi",360,0,2*TMath::Pi());
+      fESDList[iCut]->Add(hESDDalitzPositronAfterPhi[iCut]);
+      
+      hESDDalitzElectronAfterNFindClsTPC[iCut]  = new TH2F("ESD_DalitzElectron_After_NFindClsTPC","ESD_DalitzElectron_After_NFindClsTPC",100,0,1,400,0.,10.);
+      fESDList[iCut]->Add(hESDDalitzElectronAfterNFindClsTPC[iCut]);
+      
+      hESDDalitzPositronAfterNFindClsTPC[iCut]  = new TH2F("ESD_DalitzPositron_After_NFindClsTPC","ESD_DalitzPositron_After_NFindClsTPC",100,0,1,400,0.,10.);
+      fESDList[iCut]->Add(hESDDalitzPositronAfterNFindClsTPC[iCut]);
+      
+      hESDDalitzPosEleAfterDCAxy[iCut] = new TH2F("ESD_DalitzPosEle_After_DCAxy","ESD_DalitzPosEle_After_DCAxy",800,-4.0,4.0,400,0.,10.);
+      fESDList[iCut]->Add(hESDDalitzPosEleAfterDCAxy[iCut]);
+      
+      hESDDalitzPosEleAfterDCAz[iCut]  = new TH2F("ESD_DalitzPosEle_After_DCAz","ESD_DalitzPosEle_After_DCAz",800,-4.0,4.0,400,0.,10.);
+      fESDList[iCut]->Add(hESDDalitzPosEleAfterDCAz[iCut]);
+      
+      hESDDalitzPosEleAfterTPCdEdx[iCut] = new TH2F("ESD_DalitzPosEle_After_TPCdEdx","ESD_DalitzPosEle_After_TPCdEdx",150,0.05,20,400,-10,10);
+      fESDList[iCut]->Add(hESDDalitzPosEleAfterTPCdEdx[iCut]);
+      
+      hESDDalitzPosEleAfterTPCdEdxSignal[iCut] =new TH2F("ESD_DalitzPosEle_After_TPCdEdxSignal","ESD_DalitzPosEle_After_TPCdEdxSignal" ,150,0.05,20.0,800,0.0,200);
+      fESDList[iCut]->Add(hESDDalitzPosEleAfterTPCdEdxSignal[iCut]);  
+      
       hESDEposEnegPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_PsiPair_DPhi","ESD_EposEneg_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
       fESDList[iCut]->Add(hESDEposEnegPsiPairDPhi[iCut]);
 
@@ -487,10 +567,12 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
       hESDEposEnegLikeSignBackInvMassPt[iCut]  = new TH2F("ESD_EposEneg_LikeSignBack_InvMassPt","ESD_EposEneg_LikeSignBack_InvMassPt",5000,0.,5.,100,0.,10.);
       fESDList[iCut]->Add(hESDEposEnegLikeSignBackInvMassPt[iCut]);
 
-
       hESDMotherInvMassPt[iCut] = new TH2F("ESD_DalitzMother_InvMass_Pt","ESD_DalitzMother_InvMass_Pt",1000,0,1,250,0,25);
       fESDList[iCut]->Add(hESDMotherInvMassPt[iCut]);
-
+                                                                                 
+      hESDMotherPhi[iCut] = new TH1F("ESD_DalitzMother_Phi","ESD_DalitzMother_Phi",360,0,2*TMath::Pi());
+      fESDList[iCut]->Add(hESDMotherPhi[iCut]);
+                  
       hESDPi0MotherInvMassPt[iCut] = new TH2F("ESD_Pi0Mother_InvMass_Pt","ESD_Pi0Mother_InvMass_Pt",4000,0,4,250,0,25);
       fESDList[iCut]->Add(hESDPi0MotherInvMassPt[iCut]);
   
@@ -502,11 +584,27 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
 
       hESDMotherBackInvMassPt[iCut] = new TH2F("ESD_DalitzBackground_InvMass_Pt","ESD_DalitzBackground_InvMass_Pt",1000,0,1,250,0,25);
       fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
-      
 
-      fCutFolder[iCut]->Add(fESDList[iCut]);
 
 
+      TAxis *AxisAfter = hESDDalitzPosEleAfterTPCdEdx[iCut]->GetXaxis(); 
+      Int_t bins = AxisAfter->GetNbins();
+      Double_t from = AxisAfter->GetXmin();
+      Double_t to = AxisAfter->GetXmax();
+      Double_t *newBins = new Double_t[bins+1];
+      newBins[0] = from;
+      Double_t factor = TMath::Power(to/from, 1./bins);
+      for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
+
+      AxisAfter->Set(bins, newBins);
+      AxisAfter = hESDDalitzPosEleAfterTPCdEdxSignal[iCut]->GetXaxis(); 
+      AxisAfter->Set(bins, newBins);
+
+      delete [] newBins;
+
+            
+      
+      fCutFolder[iCut]->Add(fESDList[iCut]);
 
    }
 
@@ -559,6 +657,7 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
       hESDTrueMotherChiCInvMassPt = new TH2F*[fnCuts];
       hESDTrueMotherChiCDiffInvMassPt = new TH2F*[fnCuts];
       hESDTrueMotherInvMassPt = new TH2F*[fnCuts];
+      hESDTrueMotherDalitzInvMassPt = new TH2F*[fnCuts];
       hESDTrueMotherPi0GGInvMassPt = new TH2F*[fnCuts];
       hESDTruePrimaryPi0DalitzESDPtMCPt = new TH2F*[fnCuts];
       hESDTruePrimaryMotherInvMassMCPt = new TH2F*[fnCuts];
@@ -693,6 +792,13 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
 
          hESDTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",1000,0,1,250,0,25);
          fTrueList[iCut]->Add(hESDTrueMotherInvMassPt[iCut]);
+        
+        hESDTrueMotherDalitzInvMassPt[iCut] = new TH2F("ESD_TrueMother_Dalitz_InvMass_Pt","ESD_TrueMother_Dalitz_InvMass_Pt",1000,0,1,250,0,25);
+         fTrueList[iCut]->Add(hESDTrueMotherDalitzInvMassPt[iCut]);
+        
+        
+        
+        
 
          hESDTrueMotherPi0GGInvMassPt[iCut] = new TH2F("ESD_TrueMotherPi0GG_InvMass_Pt","ESD_TrueMotherPi0GG_InvMass_Pt",1000,0,1,250,0,25);
          fTrueList[iCut]->Add(hESDTrueMotherPi0GGInvMassPt[iCut]);
@@ -713,50 +819,6 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
 
       }
    }
-   
-   fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
-   if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
-     
-   fElecSelector=(AliDalitzElectronSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("ElectronSelector");
-   if(!fElecSelector){printf("Error: No ElectronSelector");return;} // GetV0Reader
-
-   
-  if( fElecSelector ){
-
-      if ( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() ){
-         fOutputContainer->Add( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() );
-      }
-   }
-
-  if ( fV0Reader ) {
-
-      if ( ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms() ){
-         fOutputContainer->Add(  ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms() );
-      }
-   }
-
-   for(Int_t iCut = 0; iCut<fnCuts;iCut++){
-
-      if( fCutElectronArray ){
-         if( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutHistograms() ) {
-            fCutFolder[iCut]->Add( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutHistograms() );
-         }
-      }
-
-      if( fCutMesonArray  ) {
-         if( ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutHistograms() ) {
-            fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutHistograms());
-         }
-      }
-
-      if( fCutGammaArray ) {
-         if( ((AliConversionCuts*)fCutGammaArray->At(iCut))->GetCutHistograms() ) {
-            fCutFolder[iCut]->Add( ((AliConversionCuts*)fCutGammaArray->At(iCut))->GetCutHistograms()  );
-         }
-      }
-   }
-
-
 
    PostData(1, fOutputContainer);
 
@@ -914,7 +976,7 @@ Bool_t AliAnalysisTaskGammaConvDalitzV1::Notify()
 void AliAnalysisTaskGammaConvDalitzV1::Terminate(const Option_t *)
 {
 
-   /*if( fElecSelector ){
+   if( fElecSelector ){
 
       if ( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() ){
          fOutputContainer->Add( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() );
@@ -947,7 +1009,7 @@ void AliAnalysisTaskGammaConvDalitzV1::Terminate(const Option_t *)
             fCutFolder[iCut]->Add( ((AliConversionCuts*)fCutGammaArray->At(iCut))->GetCutHistograms()  );
          }
       }
-   }*/
+   }
 
 }
 //________________________________________________________________________
@@ -1143,6 +1205,7 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessElectronCandidates(){
     if(! ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelected(electronCandidate) ) continue;
        lGoodElectronIndex.push_back(   fSelectorElectronIndex[i] );
        hESDDalitzElectronPt[fiCut]->Fill(electronCandidate->Pt());
+        hESDDalitzElectronPhi[fiCut]->Fill(electronCandidate->Phi());
          if( fMCEvent ) {
          Int_t labelelectron = TMath::Abs( electronCandidate->GetLabel() );
            if( labelelectron < fMCStack->GetNtrack() ){
@@ -1173,6 +1236,8 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessElectronCandidates(){
       if(! ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelected(positronCandidate) ) continue;
        lGoodPositronIndex.push_back(   fSelectorPositronIndex[i]  );
         hESDDalitzPositronPt[fiCut]->Fill( positronCandidate->Pt() );
+       hESDDalitzPositronPhi[fiCut]->Fill( positronCandidate->Phi() );
+      
         if( fMCEvent ) {
          Int_t labelpositron = TMath::Abs( positronCandidate->GetLabel() );
          if( labelpositron < fMCStack->GetNtrack() ) {
@@ -1390,7 +1455,8 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
 
    if( fGoodGammas->GetEntries() > 0 && fGoodVirtualGammas->GetEntries() > 0 ){
 
-
+      vector<Bool_t> lGoodVirtualGamma(fGoodVirtualGammas->GetEntries(), kFALSE);
+     
       for(Int_t GammaIndex=0; GammaIndex<fGoodGammas->GetEntries(); GammaIndex++){
 
          AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(GammaIndex));
@@ -1418,19 +1484,104 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
                   mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
                }
              
+             AliESDtrack *positronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelPositive() );
+             AliESDtrack *electronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelNegative() );
+             Double_t clsToFPos = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetNFindableClustersTPC(positronVgamma);
+             Double_t clsToFNeg = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetNFindableClustersTPC(electronVgamma);
+             
+             Float_t bPos[2];
+             Float_t bCovPos[3];
+             positronVgamma->GetImpactParameters(bPos,bCovPos);
+             if (bCovPos[0]<=0 || bCovPos[2]<=0) {
+               AliDebug(1, "Estimated b resolution lower or equal zero!");
+               bCovPos[0]=0; bCovPos[2]=0;
+             }
+             
+             Float_t bNeg[2];
+             Float_t bCovNeg[3];
+             positronVgamma->GetImpactParameters(bNeg,bCovNeg);
+             if (bCovNeg[0]<=0 || bCovNeg[2]<=0) {
+               AliDebug(1, "Estimated b resolution lower or equal zero!");
+               bCovNeg[0]=0; bCovNeg[2]=0;
+             }
              
+             Float_t dcaToVertexXYPos = bPos[0];
+             Float_t dcaToVertexZPos  = bPos[1];
+             Float_t dcaToVertexXYNeg = bNeg[0];
+             Float_t dcaToVertexZNeg  = bNeg[1];
+                     
              
               if(  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
-                if( Vgamma->GetMass()  <  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->GetMassCut() ){
+               
+               
+                if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( pi0cand->Pt() , Vgamma->GetMass() ) == kTRUE ){
+         
                 hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
+                hESDMotherPhi[fiCut]->Fill(pi0cand->Phi());
                 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
                  sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                
+                   if( lGoodVirtualGamma[virtualGammaIndex] == kFALSE ) {
+                
+                     hESDDalitzElectronAfterPt[fiCut]->Fill(  electronVgamma->Pt()  );
+                     hESDDalitzPositronAfterPt[fiCut]->Fill(  positronVgamma->Pt()  );
+                
+                     hESDDalitzElectronAfterPhi[fiCut]->Fill( electronVgamma->Phi() );
+                     hESDDalitzPositronAfterPhi[fiCut]->Fill( positronVgamma->Phi() );
+                     
+                     hESDDalitzElectronAfterNFindClsTPC[fiCut]->Fill(clsToFNeg,electronVgamma->Pt());
+                     hESDDalitzPositronAfterNFindClsTPC[fiCut]->Fill(clsToFPos,positronVgamma->Pt());
+                     
+                     
+                     hESDDalitzPosEleAfterDCAxy[fiCut]->Fill(  dcaToVertexXYNeg, electronVgamma->Pt() );
+                     hESDDalitzPosEleAfterDCAz[fiCut]->Fill(   dcaToVertexZNeg,  electronVgamma->Pt() );
+                     hESDDalitzPosEleAfterDCAxy[fiCut]->Fill(  dcaToVertexXYPos, positronVgamma->Pt() );
+                     hESDDalitzPosEleAfterDCAz[fiCut]->Fill(   dcaToVertexZPos,  positronVgamma->Pt() );
+                     
+                     hESDDalitzPosEleAfterTPCdEdx[fiCut]->Fill( positronVgamma->P(),((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(positronVgamma, AliPID::kElectron) );
+                     hESDDalitzPosEleAfterTPCdEdx[fiCut]->Fill( electronVgamma->P(),((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(electronVgamma, AliPID::kElectron) );
+                     
+                     hESDDalitzPosEleAfterTPCdEdxSignal[fiCut]->Fill( positronVgamma->P(), TMath::Abs(positronVgamma->GetTPCsignal()));
+                     hESDDalitzPosEleAfterTPCdEdxSignal[fiCut]->Fill( electronVgamma->P(), TMath::Abs(electronVgamma->GetTPCsignal()));
+                      
+                     
+                     lGoodVirtualGamma[virtualGammaIndex] = kTRUE;
+                   }
+      
+                
                }
              }
              else {
                 hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
                 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
                  sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                
+                 if( lGoodVirtualGamma[virtualGammaIndex] == kFALSE ) {
+                
+                     hESDDalitzElectronAfterPt[fiCut]->Fill(  electronVgamma->Pt()  );
+                     hESDDalitzPositronAfterPt[fiCut]->Fill(  positronVgamma->Pt()  );
+                
+                     hESDDalitzElectronAfterPhi[fiCut]->Fill( electronVgamma->Phi() );
+                     hESDDalitzPositronAfterPhi[fiCut]->Fill( positronVgamma->Phi() );
+                     
+                     hESDDalitzElectronAfterNFindClsTPC[fiCut]->Fill(clsToFNeg,electronVgamma->Pt());
+                     hESDDalitzPositronAfterNFindClsTPC[fiCut]->Fill(clsToFPos,positronVgamma->Pt());
+                     
+                     hESDDalitzPosEleAfterDCAxy[fiCut]->Fill(  dcaToVertexXYNeg, electronVgamma->Pt() );
+                     hESDDalitzPosEleAfterDCAz[fiCut]->Fill(   dcaToVertexZNeg,  electronVgamma->Pt() );
+                     hESDDalitzPosEleAfterDCAxy[fiCut]->Fill(  dcaToVertexXYPos, positronVgamma->Pt() );
+                     hESDDalitzPosEleAfterDCAz[fiCut]->Fill(   dcaToVertexZPos,  positronVgamma->Pt() );
+                     
+                     hESDDalitzPosEleAfterTPCdEdx[fiCut]->Fill( positronVgamma->P(),((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(positronVgamma, AliPID::kElectron) );
+                     hESDDalitzPosEleAfterTPCdEdx[fiCut]->Fill( electronVgamma->P(),((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(electronVgamma, AliPID::kElectron) );
+                     
+                     hESDDalitzPosEleAfterTPCdEdxSignal[fiCut]->Fill( positronVgamma->P(), TMath::Abs(positronVgamma->GetTPCsignal()));
+                     hESDDalitzPosEleAfterTPCdEdxSignal[fiCut]->Fill( electronVgamma->P(), TMath::Abs(electronVgamma->GetTPCsignal()));
+                     
+                     
+                     lGoodVirtualGamma[virtualGammaIndex] = kTRUE;
+                
+                 }
              }
               
               
@@ -1500,8 +1651,10 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculateBackground(){
                   AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
                   if( ( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE) ) ){
                      if(  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
-                       if( currentEventGoodV0.GetMass()  <  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->GetMassCut() ){
-                         
+                       
+                       if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.GetMass() ) == kTRUE ){
+                         
+                        // cout<<" Mass dalitz: "<<currentEventGoodV0.GetMass()<<endl;
                          hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                          Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
                          sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
@@ -1542,7 +1695,9 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculateBackground(){
                      if((((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
                       
                       if(  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
-                       if( currentEventGoodV0.GetMass()  <  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->GetMassCut() ){
+                       
+                         if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.GetMass() ) == kTRUE ){
+                       
                       
                          hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                          Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
@@ -1580,7 +1735,9 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculateBackground(){
             if((((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
              
               if(  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
-                 if( currentEventGoodV0.GetMass()  <  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->GetMassCut() ){
+               
+                   if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.GetMass() ) == kTRUE ){
+                 
                      
                  hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                  Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
@@ -1672,7 +1829,8 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
 
       if(  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
           
-           if( TrueVirtualGammaCandidate->GetMass()  <  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->GetMassCut() ){      
+           if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( Pi0Candidate->Pt() , TrueVirtualGammaCandidate->GetMass() ) == kTRUE ){
+             
               massCutAccept = kTRUE;
            }
       }
@@ -1760,7 +1918,10 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
       if( ( isTruePi0 || isTrueEta) && massCutAccept ){ // True Pion or Eta
        
          if ( virtualGamma == 1 ) { //True Dalitz
+          
             hESDTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+           hESDTrueMotherDalitzInvMassPt[fiCut]->Fill( TrueVirtualGammaCandidate->GetMass(),Pi0Candidate->Pt());
+           
             if(gammaMotherLabel < MCStack->GetNprimary()){ // Only primary pi0 for efficiency calculation
              
               Float_t weighted= 1;
@@ -2036,4 +2197,4 @@ Double_t AliAnalysisTaskGammaConvDalitzV1::GetPsiPair( const AliESDtrack *trackP
    Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );
 
    return psiAngle;
-}
\ No newline at end of file
+}
index 1bd65ea..a56d6a1 100644 (file)
@@ -108,6 +108,19 @@ class AliAnalysisTaskGammaConvDalitzV1: public AliAnalysisTaskSE
     TH1F **hESDConvGammaPt;
     TH1F **hESDDalitzElectronPt;
     TH1F **hESDDalitzPositronPt;
+    TH1F **hESDDalitzElectronPhi;
+    TH1F **hESDDalitzPositronPhi;
+    TH1F **hESDDalitzElectronAfterPt;
+    TH1F **hESDDalitzPositronAfterPt;
+    TH1F **hESDDalitzElectronAfterPhi;
+    TH1F **hESDDalitzPositronAfterPhi;
+    TH2F **hESDDalitzElectronAfterNFindClsTPC;
+    TH2F **hESDDalitzPositronAfterNFindClsTPC;
+    TH2F **hESDDalitzPosEleAfterDCAxy;
+    TH2F **hESDDalitzPosEleAfterDCAz;
+    TH2F **hESDDalitzPosEleAfterTPCdEdx;
+    TH2F **hESDDalitzPosEleAfterTPCdEdxSignal;
+    TH1F **hESDMotherPhi;
     TH2F **hESDEposEnegPsiPairDPhi;
     TH2F **hESDEposEnegInvMassPt;
     TH2F **hESDEposEnegLikeSignBackInvMassPt;
@@ -141,6 +154,7 @@ class AliAnalysisTaskGammaConvDalitzV1: public AliAnalysisTaskSE
     TH2F **hESDTrueMotherChiCInvMassPt;
     TH2F **hESDTrueMotherChiCDiffInvMassPt;
     TH2F **hESDTrueMotherInvMassPt;
+    TH2F **hESDTrueMotherDalitzInvMassPt;
     TH2F **hESDTrueMotherPi0GGInvMassPt;
     TH2F **hESDTruePrimaryMotherInvMassMCPt;
     TH2F **hESDTruePrimaryPi0DalitzESDPtMCPt;
index 01169d1..10b809f 100644 (file)
@@ -25,6 +25,8 @@
 ///////////////////////////////////////////////
 #include "TChain.h"
 #include "TTree.h"
+#include "TBranch.h"
+#include "TFile.h"
 #include "TH1F.h"
 #include "TH2F.h"
 #include "TH3F.h"
@@ -65,7 +67,8 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    fESDList(NULL),
    fBackList(NULL),
    fMotherList(NULL),
-   fMotherRapList(NULL),
+   fPhotonDCAList(NULL),
+   fMesonDCAList(NULL),        
    fTrueList(NULL),
    fTrueMotherRapList(NULL),
    fMCList(NULL),
@@ -78,10 +81,15 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    fMesonCutArray(NULL),
    fMesonCuts(NULL),
    hESDConvGammaPt(NULL),
-   hESDConvGammaR(NULL),
+   tESDConvGammaPtDcazCat(NULL),
+   fPtGamma(0),
+   fDCAzPhoton(0),
+   fRConvPhoton(0),
+   fEtaPhoton(0),
+   iCatPhoton(0),
+   iPhotonMCInfo(0),
    hESDMotherInvMassPt(NULL),
    sESDMotherInvMassPtZM(NULL),
-   sESDMotherInvMassPtY(NULL),
    hESDMotherBackInvMassPt(NULL),
    sESDMotherBackInvMassPtZM(NULL),
    hESDMotherInvMassEalpha(NULL),
@@ -116,7 +124,6 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    pESDTruePrimaryMotherWeightsInvMassPt(NULL),
    hESDTruePrimaryPi0MCPtResolPt(NULL),
    hESDTruePrimaryEtaMCPtResolPt(NULL),
-   sESDTruePrimaryMotherInvMassPtY(NULL),
    hESDTrueSecondaryMotherInvMassPt(NULL),
    hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
    hESDTrueK0sWithPi0DaughterMCPt(NULL),
@@ -128,18 +135,23 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    hESDTrueConvGammaPt(NULL),
    hESDCombinatorialPt(NULL),
    hESDTruePrimaryConvGammaPt(NULL),
-   hESDTruePrimaryConvGammaR(NULL),
-   hESDTruePrimaryConvGammaEta(NULL),
    hESDTruePrimaryConvGammaESDPtMCPt(NULL),
    hESDTruePrimaryConvGammaRSESDPtMCPt(NULL),
    hESDTrueSecondaryConvGammaPt(NULL),
-   hESDTrueSecondaryConvGammaR(NULL),
    hESDTrueSecondaryConvGammaFromXFromK0sPt(NULL),
+   hESDTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
    hNEvents(NULL),
    hNGoodESDTracks(NULL),
    hNGammaCandidates(NULL),
    hNV0Tracks(NULL),
    hEtaShift(NULL),
+   tESDMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
+   fInvMass(0),
+   fPt(0),
+   fDCAzGammaMin(0),
+   fDCAzGammaMax(0),
+   iFlag(0),
+   iMesonMCInfo(0),
    fRandom(0),
    fnGammaCandidates(0),
    fUnsmearedPx(NULL),
@@ -152,7 +164,6 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    fESDArrayNeg(NULL),
    fnCuts(0),
    fiCut(0),
-   fNumberOfESDTracks(0),
    fMoveParticleAccordingToVertex(kTRUE),
    fIsHeavyIon(kFALSE),
    fDoMesonAnalysis(kTRUE),
@@ -177,7 +188,8 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    fESDList(NULL),
    fBackList(NULL),
    fMotherList(NULL),
-   fMotherRapList(NULL),
+   fPhotonDCAList(NULL),
+   fMesonDCAList(NULL),
    fTrueList(NULL),
    fTrueMotherRapList(NULL),
    fMCList(NULL),
@@ -190,10 +202,15 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    fMesonCutArray(NULL),
    fMesonCuts(NULL),
    hESDConvGammaPt(NULL),
-   hESDConvGammaR(NULL),
+   tESDConvGammaPtDcazCat(NULL),
+   fPtGamma(0),
+   fDCAzPhoton(0),
+   fRConvPhoton(0),
+   fEtaPhoton(0),
+   iCatPhoton(0),
+   iPhotonMCInfo(0),
    hESDMotherInvMassPt(NULL),
    sESDMotherInvMassPtZM(NULL),
-   sESDMotherInvMassPtY(NULL),
    hESDMotherBackInvMassPt(NULL),
    sESDMotherBackInvMassPtZM(NULL),
    hESDMotherInvMassEalpha(NULL),
@@ -228,7 +245,6 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    pESDTruePrimaryMotherWeightsInvMassPt(NULL),
    hESDTruePrimaryPi0MCPtResolPt(NULL),
    hESDTruePrimaryEtaMCPtResolPt(NULL),
-   sESDTruePrimaryMotherInvMassPtY(NULL),
    hESDTrueSecondaryMotherInvMassPt(NULL),
    hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
    hESDTrueK0sWithPi0DaughterMCPt(NULL),
@@ -240,18 +256,23 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    hESDTrueConvGammaPt(NULL),
    hESDCombinatorialPt(NULL),
    hESDTruePrimaryConvGammaPt(NULL),
-   hESDTruePrimaryConvGammaR(NULL),
-   hESDTruePrimaryConvGammaEta(NULL),
    hESDTruePrimaryConvGammaESDPtMCPt(NULL),
    hESDTruePrimaryConvGammaRSESDPtMCPt(NULL),
    hESDTrueSecondaryConvGammaPt(NULL),
-   hESDTrueSecondaryConvGammaR(NULL),
    hESDTrueSecondaryConvGammaFromXFromK0sPt(NULL),
+   hESDTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
    hNEvents(NULL),
    hNGoodESDTracks(NULL),
    hNGammaCandidates(NULL),
    hNV0Tracks(NULL),
    hEtaShift(NULL),
+   tESDMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
+   fInvMass(0),
+   fPt(0),
+   fDCAzGammaMin(0),
+   fDCAzGammaMax(0),
+   iFlag(0),
+   iMesonMCInfo(0),
    fRandom(0),
    fnGammaCandidates(0),
    fUnsmearedPx(NULL),
@@ -264,7 +285,6 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    fESDArrayNeg(NULL),
    fnCuts(0),
    fiCut(0),
-   fNumberOfESDTracks(0),
    fMoveParticleAccordingToVertex(kTRUE),
    fIsHeavyIon(kFALSE),
    fDoMesonAnalysis(kTRUE),
@@ -299,7 +319,7 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
    Int_t nBins[nDim] = {800,250,7,4};
    Double_t xMin[nDim] = {0,0, 0,0};
    Double_t xMax[nDim] = {0.8,25,7,4};
-
+   
    sESDMotherInvMassPtZM = new THnSparseF*[fnCuts];
    sESDMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
 
@@ -387,31 +407,29 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
    hNGoodESDTracks = new TH1I*[fnCuts];
    hNGammaCandidates = new TH1I*[fnCuts];
    hNV0Tracks = new TH1I*[fnCuts];
-   hEtaShift = new TH1F*[fnCuts];
+   hEtaShift = new TProfile*[fnCuts];
    hESDConvGammaPt = new TH1F*[fnCuts];
 
    if (fDoPhotonQA){
-      hESDConvGammaR = new TH1F*[fnCuts];
+      fPhotonDCAList = new TList*[fnCuts];
+      tESDConvGammaPtDcazCat = new TTree*[fnCuts];
    }
-   const Int_t nDim = 3;
-   Int_t nBins[nDim] = {800,250,40};
-   Double_t xMin[nDim] = {0,0, -1};
-   Double_t xMax[nDim] = {0.8,25,1};
-
+   
    if(fDoMesonAnalysis){
       hESDMotherInvMassPt = new TH2F*[fnCuts];
       hESDMotherBackInvMassPt = new TH2F*[fnCuts];
       hESDMotherInvMassEalpha = new TH2F*[fnCuts];
       if (fDoMesonQA){
-         fMotherRapList = new TList*[fnCuts];
-         sESDMotherInvMassPtY = new THnSparseF*[fnCuts];
+         fMesonDCAList = new TList*[fnCuts];
+         tESDMesonsInvMassPtDcazMinDcazMaxFlag = new TTree*[fnCuts];
       }
    }
 
    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
 
       TString cutstring = ((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber();
-      TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
+      TString cutstringMeson = "NoMesonCut";
+      if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
 
       fCutFolder[iCut] = new TList();
       fCutFolder[iCut]->SetName(Form("Cut Number %s_%s",cutstring.Data(),cutstringMeson.Data()));
@@ -439,7 +457,7 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
       hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
       fESDList[iCut]->Add(hNEvents[iCut]);
-      if(fIsHeavyIon) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
+      if(fIsHeavyIon) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
       else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
       fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
       if(fIsHeavyIon) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
@@ -448,14 +466,28 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       if(fIsHeavyIon) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
       else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2000,0,2000);
       fESDList[iCut]->Add(hNV0Tracks[iCut]);
-      hEtaShift[iCut] = new TH1F("Eta Shift","Eta Shift",1, -0.5,0.5);
+      hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
       fESDList[iCut]->Add(hEtaShift[iCut]);
       hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
       fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
 
       if (fDoPhotonQA){
-         hESDConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
-         fESDList[iCut]->Add(hESDConvGammaR[iCut]);
+         fPhotonDCAList[iCut] = new TList();
+         fPhotonDCAList[iCut]->SetName(Form("%s_%s Photon DCA tree",cutstring.Data(),cutstringMeson.Data()));
+         fPhotonDCAList[iCut]->SetOwner(kTRUE);
+         fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
+            
+        tESDConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");   
+         tESDConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
+         tESDConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
+//          tESDConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
+//          tESDConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
+         
+         tESDConvGammaPtDcazCat[iCut]->Branch("cat",&iCatPhoton,"iCatPhoton/b");
+         if(fIsMC){
+            tESDConvGammaPtDcazCat[iCut]->Branch("photonMCInfo",&iPhotonMCInfo,"iPhotonMCInfo/b");
+         }
+         fPhotonDCAList[iCut]->Add(tESDConvGammaPtDcazCat[iCut]);
       }
 
       if(fDoMesonAnalysis){
@@ -465,13 +497,23 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
          fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
          hESDMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
          fESDList[iCut]->Add(hESDMotherInvMassEalpha[iCut]);
-         if (fDoMesonQA){
-            fMotherRapList[iCut] = new TList();
-            fMotherRapList[iCut]->SetName(Form("%s_%s Mother Y histograms",cutstring.Data(),cutstringMeson.Data()));
-            fMotherRapList[iCut]->SetOwner(kTRUE);
-            fCutFolder[iCut]->Add(fMotherRapList[iCut]);
-            sESDMotherInvMassPtY[iCut] = new THnSparseF("Mother_InvMass_Pt_Y","Mother_InvMass_Pt_Y",nDim,nBins,xMin,xMax);
-            fMotherRapList[iCut]->Add(sESDMotherInvMassPtY[iCut]);
+         if (fDoMesonQA){    
+            fMesonDCAList[iCut] = new TList();
+            fMesonDCAList[iCut]->SetName(Form("%s_%s Meson DCA tree",cutstring.Data(),cutstringMeson.Data()));
+            fMesonDCAList[iCut]->SetOwner(kTRUE);
+            fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
+            
+            tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");   
+            tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
+            tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
+            tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
+            tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
+            tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("kind",&iFlag,"iFlag/b");
+            if(fIsMC){
+               tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("mesonMCInfo",&iMesonMCInfo,"iMesonMCInfo/b");
+            }
+            fMesonDCAList[iCut]->Add(tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]);
+              
          }
       }
 
@@ -508,15 +550,13 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       hESDTrueSecondaryConvGammaPt = new TH1F*[fnCuts];
 
       hESDTrueSecondaryConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
+      hESDTrueSecondaryConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
 
       if (fDoPhotonQA){
          hMCConvGammaR = new TH1F*[fnCuts];
          hMCConvGammaEta = new TH1F*[fnCuts];
          hMCConvGammaRSR = new TH1F*[fnCuts];
          hMCConvGammaRSEta = new TH1F*[fnCuts];
-         hESDTruePrimaryConvGammaR = new TH1F*[fnCuts];
-         hESDTruePrimaryConvGammaEta = new TH1F*[fnCuts];
-         hESDTrueSecondaryConvGammaR = new TH1F*[fnCuts];
       }
 
       if(fDoMesonAnalysis){
@@ -547,13 +587,13 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
             hESDTrueBckContInvMassPt = new TH2F*[fnCuts];
             hESDTrueMotherDalitzInvMassPt = new TH2F*[fnCuts];
             fTrueMotherRapList = new TList*[fnCuts];
-            sESDTruePrimaryMotherInvMassPtY = new THnSparseF*[fnCuts];
          }
       }
 
       for(Int_t iCut = 0; iCut<fnCuts;iCut++){
          TString cutstring = ((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber();
-         TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
+         TString cutstringMeson = "NoMesonCut";
+         if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
 
          fMCList[iCut] = new TList();
          fMCList[iCut]->SetName(Form("%s_%s MC histograms",cutstring.Data(),cutstringMeson.Data()));
@@ -664,21 +704,16 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
          hESDTrueSecondaryConvGammaFromXFromK0sPt[iCut]
             = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaFromXFromK0sPt[iCut]);
+         hESDTrueSecondaryConvGammaFromXFromLambdaPt[iCut]
+            = new TH1F("ESD_TrueSecondaryConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryConvGammaFromXFromLambda_Pt",250,0,25);
+         fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaFromXFromLambdaPt[iCut]);
+
          hESDTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",250,0,25,250,0,25);
          fTrueList[iCut]->Add(hESDTruePrimaryConvGammaESDPtMCPt[iCut]);
          hESDTruePrimaryConvGammaRSESDPtMCPt[iCut]
             = new TH2F("ESD_TruePrimaryConvGammaESD_RS_PtMCPt", "ESD_TruePrimaryConvGammaESD_RS_PtMCPt",250,0,25,250,0,25);
          fTrueList[iCut]->Add(hESDTruePrimaryConvGammaRSESDPtMCPt[iCut]);
 
-         if (fDoPhotonQA){
-            hESDTruePrimaryConvGammaR[iCut] = new TH1F("ESD_TruePrimaryConvGamma_R","ESD_TruePrimaryConvGamma_R",800,0,200);
-            fTrueList[iCut]->Add(hESDTruePrimaryConvGammaR[iCut]);
-            hESDTrueSecondaryConvGammaR[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_R","ESD_TrueSecondaryConvGamma_R",800,0,200);
-            fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaR[iCut]);
-            hESDTruePrimaryConvGammaEta[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Eta","ESD_TruePrimaryConvGamma_Eta",100,-4,4);
-            fTrueList[iCut]->Add(hESDTruePrimaryConvGammaEta[iCut]);
-         }
-
          if(fDoMesonAnalysis){
             hESDTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",800,0,0.8,250,0,25);
             fTrueList[iCut]->Add(hESDTrueMotherInvMassPt[iCut]);
@@ -705,7 +740,7 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
             hESDTrueSecondaryMotherFromEtaInvMassPt[iCut]
                = new TH2F("ESD_TrueSecondaryMotherFromEta_InvMass_Pt","ESD_TrueSecondaryMotherFromEta_InvMass_Pt",800,0,0.8,250,0,25);
             fTrueList[iCut]->Add(hESDTrueSecondaryMotherFromEtaInvMassPt[iCut]);
-
+         
             if (fDoMesonQA){
                hESDTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0,25,1000,-1.,1.);
                hESDTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
@@ -723,14 +758,6 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
                fTrueList[iCut]->Add(hESDTrueK0sWithPi0DaughterMCPt[iCut]);
                hESDTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
                fTrueList[iCut]->Add(hESDTrueEtaWithPi0DaughterMCPt[iCut]);
-
-               fTrueMotherRapList[iCut] = new TList();
-               fTrueMotherRapList[iCut]->SetName(Form("%s_%s True Mother Y histograms",cutstring.Data(),cutstringMeson.Data()));
-               fTrueMotherRapList[iCut]->SetOwner(kTRUE);
-               fCutFolder[iCut]->Add(fTrueMotherRapList[iCut]);
-               sESDTruePrimaryMotherInvMassPtY[iCut] = new THnSparseF("TruePrimaryMother_InvMass_Pt_Y","TruePrimaryMother_InvMass_Pt_Y",nDim,nBins,xMin,xMax);
-               fTrueMotherRapList[iCut]->Add(sESDTruePrimaryMotherInvMassPtY[iCut]);
-
             }
          }
       }
@@ -749,35 +776,38 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       if(((AliConversionCuts*)fCutArray->At(iCut))->GetCutHistograms()){
          fCutFolder[iCut]->Add(((AliConversionCuts*)fCutArray->At(iCut))->GetCutHistograms());
       }
-      if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
-      if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
-         fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
+      if(fDoMesonAnalysis){
+         if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
+            fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
+         }
       }
    }
-
    PostData(1, fOutputContainer);
 }
 //_____________________________________________________________________________
 Bool_t AliAnalysisTaskGammaConvV1::Notify()
 {
    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
-     if(!((AliConversionCuts*)fCutArray->At(iCut))->GetDoEtaShift()){ 
-       hEtaShift[iCut]->Fill(0.,0.);
-       continue; // No Eta Shift requested, continue
-     }
-
+      if(!((AliConversionCuts*)fCutArray->At(iCut))->GetDoEtaShift()){
+         if (((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift() != 0.){
+            printf("Error: Gamma Conversion Task %s :: Eta Shift not requested but set to %f, reset to 0. \n\n",
+                   (((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber()).Data(),((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift());
+            ((AliConversionCuts*)fCutArray->At(iCut))->SetEtaShift(0.);
+         }
+         hEtaShift[iCut]->Fill(0.,0.);
+         continue; // No Eta Shift requested, continue
+      }
       if(((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
-       ((AliConversionCuts*)fCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
-       hEtaShift[iCut]->Fill(0.,(((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift()));
-               //      hEtaShift[iCut]->Fill(0);
+         ((AliConversionCuts*)fCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
+          hEtaShift[iCut]->Fill(0.,(((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift()));
          ((AliConversionCuts*)fCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once   
          continue;
       }
       else{
          printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
                 (((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber()).Data(),((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift());
-        hEtaShift[iCut]->Fill(0.,(((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift()));
-               //      hEtaShift[iCut]->Fill(-0.5);
+          hEtaShift[iCut]->Fill(0.,(((AliConversionCuts*)fCutArray->At(iCut))->GetEtaShift()));
          ((AliConversionCuts*)fCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once   
       }
    }
@@ -799,24 +829,25 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
    }
 
    if(fIsMC) fMCEvent = MCEvent();
+   if(fMCEvent == NULL) fIsMC = kFALSE;
+   
    fInputEvent = InputEvent();
 
-   if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
+   if(fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
       fMCStack = fMCEvent->Stack();
+      if(fMCStack == NULL) fIsMC = kFALSE;
    }
 
    fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
-   CountTracks(); // Estimate Event Multiplicity
-
+   
    // ------------------- BeginEvent ----------------------------
 
-   if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
+   if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
       RelabelAODPhotonCandidates(kTRUE);    // In case of AODMC relabeling MC
       fV0Reader->RelabelAODs(kTRUE);
    }
    for(Int_t iCut = 0; iCut<fnCuts; iCut++){
       fiCut = iCut;
-
       Int_t eventNotAccepted =
          ((AliConversionCuts*)fCutArray->At(iCut))
          ->IsEventAcceptedByConversionCut(fV0Reader->GetConversionCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
@@ -833,11 +864,11 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
       }
 
       hNEvents[iCut]->Fill(eventQuality); // Should be 0 here
-      hNGoodESDTracks[iCut]->Fill(fNumberOfESDTracks);
+      hNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
       if(((AliConversionCuts*)fCutArray->At(iCut))->IsHeavyIon() == 2) hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
       else hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
 
-      if(fMCEvent){
+      if(fIsMC){
          // Process MC Particle
          if(((AliConversionCuts*)fCutArray->At(iCut))->GetSignalRejection() != 0){
             if(fInputEvent->IsA()==AliESDEvent::Class()){
@@ -851,18 +882,19 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
                                                                                   fInputEvent);
             }
 
-            for(Int_t i = 0;i<(((AliConversionCuts*)fCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
-               TString nameBin= hMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
-               if (nameBin.CompareTo("")== 0){
-                  TString nameHeader = ((TObjString*)((TList*)((AliConversionCuts*)fCutArray->At(iCut))
-                                                            ->GetAcceptedHeader())->At(i))->GetString();
-                  hMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
+            if(((AliConversionCuts*)fCutArray->At(iCut))->GetAcceptedHeader()){
+               for(Int_t i = 0;i<(((AliConversionCuts*)fCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
+                  TString nameBin= hMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
+                  if (nameBin.CompareTo("")== 0){
+                     TString nameHeader = ((TObjString*)((TList*)((AliConversionCuts*)fCutArray->At(iCut))
+                                                         ->GetAcceptedHeader())->At(i))->GetString();
+                     hMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
+                  }
                }
             }
          }
-
       }
-      if(fMCEvent){
+      if(fIsMC){
          if(fInputEvent->IsA()==AliESDEvent::Class())
             ProcessMCParticles();
          if(fInputEvent->IsA()==AliAODEvent::Class())
@@ -873,7 +905,7 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
 
       hNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
       if(fDoMesonAnalysis){ // Meson Analysis
-         if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fMCEvent){
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
             fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
             fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
             fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
@@ -899,7 +931,7 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
                fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
             }
          }
-         if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fMCEvent){
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
             for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
                ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
                ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
@@ -915,7 +947,7 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
       fGammaCandidates->Clear(); // delete this cuts good gammas
    }
 
-   if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
+   if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
       RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
       fV0Reader->RelabelAODs(kFALSE);
    }
@@ -933,7 +965,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
       AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
       if(!PhotonCandidate) continue;
       fIsFromMBHeader = kTRUE;
-      if(fMCEvent && ((AliConversionCuts*)fCutArray->At(fiCut))->GetSignalRejection() != 0){
+      if(fIsMC && ((AliConversionCuts*)fCutArray->At(fiCut))->GetSignalRejection() != 0){
          Int_t isPosFromMBHeader
             = ((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
          if(isPosFromMBHeader == 0 && ((AliConversionCuts*)fCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
@@ -951,21 +983,35 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
 
          if(fIsFromMBHeader){
             hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-            if (fDoPhotonQA)hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
          }
-         if(fMCEvent){
+         if(fIsMC){
             if(fInputEvent->IsA()==AliESDEvent::Class())
                ProcessTruePhotonCandidates(PhotonCandidate);
             if(fInputEvent->IsA()==AliAODEvent::Class())
                ProcessTruePhotonCandidatesAOD(PhotonCandidate);
          }
-      }
-      else if(((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
+         if (fIsFromMBHeader && fDoPhotonQA){
+            if (fIsHeavyIon && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
+               fPtGamma = PhotonCandidate->Pt();
+               fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
+               fRConvPhoton = PhotonCandidate->GetConversionRadius();
+               fEtaPhoton = PhotonCandidate->GetPhotonEta();
+               iCatPhoton = PhotonCandidate->GetPhotonQuality();
+               tESDConvGammaPtDcazCat[fiCut]->Fill();
+            } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
+               fPtGamma = PhotonCandidate->Pt();
+               fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
+               fRConvPhoton = PhotonCandidate->GetConversionRadius();
+               fEtaPhoton = PhotonCandidate->GetPhotonEta();
+               iCatPhoton = PhotonCandidate->GetPhotonQuality();
+               tESDConvGammaPtDcazCat[fiCut]->Fill();
+            }   
+         }   
+      } else if(((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
          ((AliConversionCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
          nV0++;
          GammaCandidatesStepOne->Add(PhotonCandidate);
-      }
-      else if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
+      } else if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
               ((AliConversionCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
          GammaCandidatesStepTwo->Add(PhotonCandidate);
       }
@@ -987,16 +1033,32 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
             fGammaCandidates->Add(PhotonCandidate);
             if(fIsFromMBHeader){
                hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-               if (fDoPhotonQA)hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
             }
          }
-         if(fMCEvent){
+         if(fIsMC){
             if(fInputEvent->IsA()==AliESDEvent::Class())
                ProcessTruePhotonCandidates(PhotonCandidate);
             if(fInputEvent->IsA()==AliAODEvent::Class())
                ProcessTruePhotonCandidatesAOD(PhotonCandidate);
+         } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
+         
+           if (fIsFromMBHeader && fDoPhotonQA){
+            if (fIsHeavyIon && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
+               fPtGamma = PhotonCandidate->Pt();
+               fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
+               fRConvPhoton = PhotonCandidate->GetConversionRadius();
+               fEtaPhoton = PhotonCandidate->GetPhotonEta();
+               iCatPhoton = PhotonCandidate->GetPhotonQuality();
+               tESDConvGammaPtDcazCat[fiCut]->Fill();
+            } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
+               fPtGamma = PhotonCandidate->Pt();
+               fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
+               fRConvPhoton = PhotonCandidate->GetConversionRadius();
+               fEtaPhoton = PhotonCandidate->GetPhotonEta();
+               iCatPhoton = PhotonCandidate->GetPhotonQuality();
+               tESDConvGammaPtDcazCat[fiCut]->Fill();
+            }
          }
-         else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
       }
    }
    if(((AliConversionCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
@@ -1015,14 +1077,30 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
          fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
          if(fIsFromMBHeader){
             hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-            if (fDoPhotonQA)hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
          }
-         if(fMCEvent){
+         if(fIsMC){
             if(fInputEvent->IsA()==AliESDEvent::Class())
                ProcessTruePhotonCandidates(PhotonCandidate);
             if(fInputEvent->IsA()==AliAODEvent::Class())
                ProcessTruePhotonCandidatesAOD(PhotonCandidate);
          }
+         if (fIsFromMBHeader){
+           if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
+               fPtGamma = PhotonCandidate->Pt();
+               fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
+               fRConvPhoton = PhotonCandidate->GetConversionRadius();
+               fEtaPhoton = PhotonCandidate->GetPhotonEta();
+               iCatPhoton = PhotonCandidate->GetPhotonQuality();
+               tESDConvGammaPtDcazCat[fiCut]->Fill();
+            } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
+               fPtGamma = PhotonCandidate->Pt();
+               fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
+               fRConvPhoton = PhotonCandidate->GetConversionRadius();
+               fEtaPhoton = PhotonCandidate->GetPhotonEta();
+               iCatPhoton = PhotonCandidate->GetPhotonQuality();
+               tESDConvGammaPtDcazCat[fiCut]->Fill();
+            }
+         }
       }
    }
 
@@ -1039,40 +1117,50 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidatesAOD(AliAODConversion
    TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
    AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
    AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
+   iPhotonMCInfo = 0;
    
    if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
    Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
 
    if(posDaughter->GetMother() != negDaughter->GetMother()){
       FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
+      iPhotonMCInfo = 1;
       return;
    }
    else if(posDaughter->GetMother() == -1){
       FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
+      iPhotonMCInfo = 1;
       return;
    }
 
-   if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
-
-   if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
-
-   if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5) return;// check if the daughters come from a conversion 
+   if(pdgCode[0]!=11 || pdgCode[1]!=11){
+      iPhotonMCInfo = 1;
+      return; //One Particle is not a electron
+   }
+   if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
+      iPhotonMCInfo = 1; 
+      return; // Same Charge
+   }
+   
+   if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
+      iPhotonMCInfo = 1;
+      return;// check if the daughters come from a conversion 
+   }   
    // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
    
    AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
-   if(Photon->GetPdgCode() != 22) return; // Mother is no Photon
-
+   if(Photon->GetPdgCode() != 22){
+      iPhotonMCInfo = 1;
+      return; // Mother is no Photon
+   }
    // True Photon
    if(fIsFromMBHeader)hESDTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
 
-   if(Photon->IsPrimary()){ // OR ISPHYSICALPRIMARY() ???????
+   if(Photon->IsPrimary()){ 
       // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
       if(fIsFromMBHeader){
+         iPhotonMCInfo = 6;
          hESDTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-         if (fDoPhotonQA){
-            hESDTruePrimaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
-            hESDTruePrimaryConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
-         }
          hESDTruePrimaryConvGammaRSESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
       }
       hESDTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
@@ -1081,14 +1169,24 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidatesAOD(AliAODConversion
    else{
       if(fIsFromMBHeader){
          hESDTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-         if (fDoPhotonQA) hESDTrueSecondaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
+         iPhotonMCInfo = 2;
+         if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
+            ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
+            iPhotonMCInfo = 5;
+            hESDTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+         }
          if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
             ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
+            iPhotonMCInfo = 4;
             hESDTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
          }
+         if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
+            ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221){
+            iPhotonMCInfo = 3;
+         }
       }
    }
-
+   
 }
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate)
@@ -1097,10 +1195,11 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
    TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
    TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
 
+   iPhotonMCInfo = 0;
+   
    if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
-
    Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
-
+   iPhotonMCInfo = 1;
    if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
       FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
       return;
@@ -1125,11 +1224,8 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
    if(posDaughter->GetMother(0) <= fMCStack->GetNprimary()){
       // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
       if(fIsFromMBHeader){
+         iPhotonMCInfo = 6;
          hESDTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-         if (fDoPhotonQA){
-            hESDTruePrimaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
-            hESDTruePrimaryConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
-         }
          hESDTruePrimaryConvGammaRSESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
       }
       hESDTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
@@ -1137,11 +1233,21 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
    }
    else{
       if(fIsFromMBHeader){
+         iPhotonMCInfo = 2;
          hESDTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-         if (fDoPhotonQA) hESDTrueSecondaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
+         if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
+            fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
+            hESDTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+            iPhotonMCInfo = 5;
+         }
          if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
             fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
             hESDTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+            iPhotonMCInfo = 4;
+         }
+         if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
+            fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
+            iPhotonMCInfo = 3;
          }
       }
    }
@@ -1225,7 +1331,8 @@ void AliAnalysisTaskGammaConvV1::ProcessAODMCParticles()
             if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
                mesonY=10.-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             } else{
-               mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
+               mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))
+                  -((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             }
             Float_t weightedK0s= 1;
             if(((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
@@ -1238,7 +1345,8 @@ void AliAnalysisTaskGammaConvV1::ProcessAODMCParticles()
             hMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
             hMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
          }         
-         if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+            ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
             AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
             AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
             Float_t weighted= 1;
@@ -1252,7 +1360,8 @@ void AliAnalysisTaskGammaConvV1::ProcessAODMCParticles()
             if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
                mesonY=10.-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             } else{
-               mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
+               mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))
+                  -((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             }
 
             if(particle->GetPdgCode() == 111){
@@ -1343,7 +1452,8 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
             if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
                mesonY=10.-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             } else{
-               mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
+               mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))
+                  -((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             }
             Float_t weightedK0s= 1;
             if(((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
@@ -1356,7 +1466,8 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
             hMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
             hMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
          }
-         if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+            ->MesonIsSelectedMC(particle,fMCStack,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
             TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
             TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
 
@@ -1371,7 +1482,8 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
             if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
                mesonY=10.-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             } else{
-               mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
+               mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))
+                  -((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift();
             }
 
             if(particle->GetPdgCode() == 111){
@@ -1417,14 +1529,12 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
             AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
             pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
 
-            if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
+            pi0cand->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+            if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                ->MesonIsSelected(pi0cand,kTRUE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
                hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
                if(pi0cand->GetAlpha()<0.1)
                   hESDMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
-               if (fDoMesonQA){
-                  Double_t sparesFill2[3] = {pi0cand->M(),pi0cand->Pt(),pi0cand->Rapidity()-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()};
-                  sESDMotherInvMassPtY[fiCut]->Fill(sparesFill2,1);
-               }
                if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
                   Int_t zbin = 0;
                   Int_t mbin = 0;
@@ -1432,7 +1542,7 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
                   if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
                      zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
                      if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-                        mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
+                        mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
                      } else {
                         mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
                      }
@@ -1440,7 +1550,7 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
                   else{
                      zbin = fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
                      if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-                        mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
+                        mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
                      } else {
                         mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
                      }
@@ -1450,12 +1560,32 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
                }
                
 
-               if(fMCEvent){
+               if(fIsMC){
                   if(fInputEvent->IsA()==AliESDEvent::Class())
                      ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1);
                   if(fInputEvent->IsA()==AliAODEvent::Class())
                      ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1);
                }
+               if (fDoMesonQA){
+                  fInvMass = pi0cand->M();
+                  fPt  = pi0cand->Pt();
+                  if (abs(gamma0->GetDCAzToPrimVtx()) < abs(gamma1->GetDCAzToPrimVtx())){
+                     fDCAzGammaMin = gamma0->GetDCAzToPrimVtx();
+                     fDCAzGammaMax = gamma1->GetDCAzToPrimVtx();
+                  } else {
+                     fDCAzGammaMin = gamma1->GetDCAzToPrimVtx();
+                     fDCAzGammaMax = gamma0->GetDCAzToPrimVtx();
+                  }
+                  iFlag = pi0cand->GetMesonQuality();
+//                   cout << "gamma 0: " << gamma0->GetV0Index()<< "\t" << gamma0->GetPx() << "\t" << gamma0->GetPy() << "\t" <<  gamma0->GetPz() << "\t" << endl; 
+//                   cout << "gamma 1: " << gamma1->GetV0Index()<< "\t"<< gamma1->GetPx() << "\t" << gamma1->GetPy() << "\t" <<  gamma1->GetPz() << "\t" << endl; 
+//                    cout << "pi0: "<<fInvMass << "\t" << fPt <<"\t" << fDCAzGammaMin << "\t" << fDCAzGammaMax << "\t" << (Int_t)iFlag << "\t" << (Int_t)iMesonMCInfo <<endl;
+                  if (fIsHeavyIon == 1 && fPt > 0.399 && fPt < 12. ) {
+                     if ( fInvMass > 0.08 && fInvMass < 0.2) tESDMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
+                  } else if (fPt > 0.299 && fPt < 12. )  {
+                     if ( (fInvMass > 0.08 && fInvMass < 0.2) || (fInvMass > 0.45 && fInvMass < 0.6)) tESDMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
+                  }   
+               }
             }
             delete pi0cand;
             pi0cand=0x0;
@@ -1468,7 +1598,7 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
 {
    // Process True Mesons
    AliStack *MCStack = fMCEvent->Stack();
-
+   iMesonMCInfo = 0;
    if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
       Bool_t isTruePi0 = kFALSE;
       Bool_t isTrueEta = kFALSE;
@@ -1524,8 +1654,7 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
             }
          }
          if(isTruePi0 || isTrueEta){// True Pion or Eta
-            hESDTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-
+            hESDTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt()); 
             if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
                Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0);
                Float_t weightedSec= 1;
@@ -1534,20 +1663,23 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                   //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
                }
                hESDTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
-               
+               iMesonMCInfo = 2;
                if (secMotherLabel >-1){
                   if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
+                     iMesonMCInfo = 4;
                      hESDTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                      if (fDoMesonQA)hESDTrueK0sWithPi0DaughterMCPt[fiCut]
                                        ->Fill(MCStack->Particle(secMotherLabel)->Pt());
                   }
                   if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221){
+                     iMesonMCInfo = 3;
                      hESDTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                      if (fDoMesonQA)hESDTrueEtaWithPi0DaughterMCPt[fiCut]
                                        ->Fill(MCStack->Particle(secMotherLabel)->Pt());
                   }
                }
             }else{ // Only primary pi0 for efficiency calculation
+               iMesonMCInfo = 6;
                Float_t weighted= 1;
                if(((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
                   if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
@@ -1559,8 +1691,6 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                hESDTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                pESDTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
                if (fDoMesonQA){
-                  Double_t sparesFill[3] = {Pi0Candidate->M(),Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()};
-                  sESDTruePrimaryMotherInvMassPtY[fiCut]->Fill(sparesFill,1);
                   if(isTruePi0){ // Only primary pi0 for resolution
                      hESDTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
                   }
@@ -1573,11 +1703,13 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
          else if(!isTruePi0 && !isTrueEta && fDoMesonQA){ // Background
             if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
                hESDTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+               iMesonMCInfo = 1;
             } else { // No photon or without mother
                hESDTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
             }
             if((gamma0MotherLabel==-111 || gamma1MotherLabel==-111 || gamma0MotherLabel==-221 || gamma1MotherLabel==-221) ){
                // Dalitz
+               iMesonMCInfo = 5;
                hESDTrueMotherDalitzInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
             }
          }
@@ -1596,6 +1728,7 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidatesAOD(AliAODConversionM
    AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
    AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
 
+   iMesonMCInfo = 0;
    Int_t gamma0MCLabel = -1;
    Int_t gamma0MotherLabel = -1;
    if(!positiveMC||!negativeMC)
@@ -1669,14 +1802,16 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidatesAOD(AliAODConversionM
             //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
          }
          hESDTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
-      
+         iMesonMCInfo = 2;   
          if (secMotherLabel >-1){
             if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
+               iMesonMCInfo = 4;
                hESDTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                if (fDoMesonQA)hESDTrueK0sWithPi0DaughterMCPt[fiCut]
                                  ->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
             }
             if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221){
+               iMesonMCInfo = 3;
                hESDTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                if (fDoMesonQA)hESDTrueEtaWithPi0DaughterMCPt[fiCut]
                                  ->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
@@ -1684,6 +1819,7 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidatesAOD(AliAODConversionM
          }
       }else{ // Only primary pi0 for efficiency calculation
          Float_t weighted= 1;
+         iMesonMCInfo = 6;
          if(((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
             if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
                weighted= ((AliConversionCuts*)fCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, 0x0, fInputEvent);
@@ -1691,10 +1827,10 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidatesAOD(AliAODConversionM
             }
          }
          hESDTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
-   
+         hESDTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+         pESDTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
+              
          if (fDoMesonQA){
-            Double_t sparesFill[3] = {Pi0Candidate->M(),Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()};
-            sESDTruePrimaryMotherInvMassPtY[fiCut]->Fill(sparesFill,1);
             if(isTruePi0){ // Only primary pi0 for resolution
                hESDTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
                                                           (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
@@ -1708,12 +1844,14 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidatesAOD(AliAODConversionM
    }
    else if(!isTruePi0 && !isTrueEta && fDoMesonQA){ // Background
       if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
+         iMesonMCInfo = 1;
          hESDTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
       } else { // No photon or without mother
          hESDTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
       }
       if((gamma0MotherLabel==-111 || gamma1MotherLabel==-111 || gamma0MotherLabel==-221 || gamma1MotherLabel==-221) ){
          // Dalitz
+         iMesonMCInfo = 5;
          hESDTrueMotherDalitzInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
       }
    }
@@ -1725,7 +1863,7 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
    Int_t mbin = 0;
 
    if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-      mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
+      mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
    } else {
       mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
    }
@@ -1753,7 +1891,9 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
 
                RotateParticle(&currentEventGoodV02);
                AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&currentEventGoodV02);
-               if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
+               backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+               if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                   ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
                   hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                   Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
                   sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
@@ -1782,7 +1922,9 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                   }
 
                   AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
-                  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
+                  backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+                  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                      ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
                      hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                      Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
                      sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
@@ -1811,8 +1953,9 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                      }
 
                      AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
-
-                     if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
+                     backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+                     if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                         ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift()))){
                         hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                         Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
                         sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
@@ -1832,7 +1975,7 @@ void AliAnalysisTaskGammaConvV1::CalculateBackgroundRP(){
    Int_t zbin= fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
    Int_t mbin = 0;
    if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-      mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
+      mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
    } else {
       mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
    }
@@ -1857,8 +2000,9 @@ void AliAnalysisTaskGammaConvV1::CalculateBackgroundRP(){
                RotateParticle(gamma1);
 
                AliAODConversionMother backgroundCandidate(gamma0,gamma1);
-
-               if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
+               backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+               if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                  ->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
                   hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
                   Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
                   sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
@@ -1891,8 +2035,9 @@ void AliAnalysisTaskGammaConvV1::CalculateBackgroundRP(){
                   AliAODConversionPhoton *gamma1 = (AliAODConversionPhoton*)(previousEventGammas->at(iPrevious));
 
                   AliAODConversionMother backgroundCandidate(gamma0,gamma1);
-
-                  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
+                  backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+                  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                     ->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConversionCuts*)fCutArray->At(fiCut))->GetEtaShift())){
                      hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
                      Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
                      sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
@@ -1926,7 +2071,7 @@ void AliAnalysisTaskGammaConvV1::UpdateEventByEventData(){
    //see header file for documentation
    if(fGammaCandidates->GetEntries() >0 ){
       if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-         fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fNumberOfESDTracks);
+         fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks());
       }
       else{ // means we use #V0s for multiplicity
          fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGammaCandidates->GetEntries());
@@ -1934,42 +2079,7 @@ void AliAnalysisTaskGammaConvV1::UpdateEventByEventData(){
    }
 }
 
-//________________________________________________________________________
-void AliAnalysisTaskGammaConvV1::CountTracks(){
-
-   if(fInputEvent->IsA()==AliESDEvent::Class()){
-   // Using standard function for setting Cuts
-   Bool_t selectPrimaries=kTRUE;
-   AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
-   EsdTrackCuts->SetMaxDCAToVertexZ(2);
-   EsdTrackCuts->SetEtaRange(-0.8, 0.8);
-   EsdTrackCuts->SetPtRange(0.15);
-      fNumberOfESDTracks = 0;
-      for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
-         AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
-         if(!curTrack) continue;
-         // if(fMCEvent && ((AliConversionCuts*)fCutArray->At(fiCut))->GetSignalRejection() != 0){
-         //    if(!((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(abs(curTrack->GetLabel()), fMCStack)) continue;
-         // }
-         if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTracks++;
-      }
-      delete EsdTrackCuts;
-      EsdTrackCuts=0x0;
-   }
-   else if(fInputEvent->IsA()==AliAODEvent::Class()){
-      fNumberOfESDTracks = 0;
-      for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
-         AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
-         if(!curTrack->IsPrimaryCandidate()) continue;
-         if(abs(curTrack->Eta())>0.8) continue;
-         if(curTrack->Pt()<0.15) continue;
-         if(abs(curTrack->ZAtDCA())>2) continue;
-         fNumberOfESDTracks++;
-      }
-   }
 
-   return;
-}
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::FillPhotonCombinatorialBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode[])
 {
index 3803511..40c942c 100644 (file)
@@ -61,7 +61,6 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
 
    // BG HandlerSettings
    void SetMoveParticleAccordingToVertex(Bool_t flag){fMoveParticleAccordingToVertex = flag;}
-   void CountTracks();
    void FillPhotonCombinatorialBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode[]);
    void MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex);
    void UpdateEventByEventData();
@@ -77,7 +76,8 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    TList **fESDList;
    TList **fBackList;
    TList **fMotherList;
-   TList **fMotherRapList;
+   TList **fPhotonDCAList;
+   TList **fMesonDCAList;        
    TList **fTrueList;
    TList **fTrueMotherRapList;
    TList **fMCList;
@@ -90,10 +90,21 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    TList *fMesonCutArray;
    AliConversionMesonCuts *fMesonCuts;
    TH1F **hESDConvGammaPt;
-   TH1F **hESDConvGammaR;
+   TTree **tESDConvGammaPtDcazCat;
+   Float_t fPtGamma;
+   Float_t fDCAzPhoton;
+   Float_t fRConvPhoton;
+   Float_t fEtaPhoton;
+   UChar_t iCatPhoton;
+   UChar_t iPhotonMCInfo; // 0: garbage,
+                         // 1: background
+                         // 2: secondary photon not from eta or k0s,
+                         // 3: secondary photon from eta, 
+                         // 4: secondary photon from k0s, 
+                         // 5: dalitz
+                         // 6: primary gamma
    TH2F **hESDMotherInvMassPt;
    THnSparseF **sESDMotherInvMassPtZM;
-   THnSparseF **sESDMotherInvMassPtY;
    TH2F **hESDMotherBackInvMassPt;
    THnSparseF **sESDMotherBackInvMassPtZM;
    TH2F **hESDMotherInvMassEalpha;
@@ -128,7 +139,6 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    TProfile2D **pESDTruePrimaryMotherWeightsInvMassPt;
    TH2F **hESDTruePrimaryPi0MCPtResolPt;
    TH2F **hESDTruePrimaryEtaMCPtResolPt;
-   THnSparseF **sESDTruePrimaryMotherInvMassPtY;
    TH2F **hESDTrueSecondaryMotherInvMassPt;
    TH2F **hESDTrueSecondaryMotherFromK0sInvMassPt;
    TH1F **hESDTrueK0sWithPi0DaughterMCPt;
@@ -140,19 +150,29 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    TH1F **hESDTrueConvGammaPt;
    TH2F **hESDCombinatorialPt;
    TH1F **hESDTruePrimaryConvGammaPt;
-   TH1F **hESDTruePrimaryConvGammaR;
-   TH1F **hESDTruePrimaryConvGammaEta;
    TH2F **hESDTruePrimaryConvGammaESDPtMCPt;
    TH2F **hESDTruePrimaryConvGammaRSESDPtMCPt;
    TH1F **hESDTrueSecondaryConvGammaPt;
-   TH1F **hESDTrueSecondaryConvGammaR;
    TH1F **hESDTrueSecondaryConvGammaFromXFromK0sPt;
+   TH1F **hESDTrueSecondaryConvGammaFromXFromLambdaPt;
    TH1I **hNEvents;
    TH1I **hNGoodESDTracks;
    TH1I **hNGammaCandidates;
    TH1I **hNV0Tracks;
-   TH1F **hEtaShift;
-   
+   TProfile **hEtaShift;
+   TTree **tESDMesonsInvMassPtDcazMinDcazMaxFlag;
+   Float_t fInvMass;
+   Float_t fPt;
+   Float_t fDCAzGammaMin;
+   Float_t fDCAzGammaMax;
+   UChar_t iFlag;
+   UChar_t iMesonMCInfo; // 0: garbage,
+                         // 1: background
+                         // 2: secondary meson not from eta or k0s,
+                         // 3: secondary meson from eta, 
+                         // 4: secondary meson from k0s, 
+                         // 5: dalitz
+                         // 6: primary meson gamma-gamma-channel
    TRandom3 fRandom;
    Int_t fnGammaCandidates;
    Double_t *fUnsmearedPx; //[fnGammaCandidates]
@@ -165,7 +185,6 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    Int_t *fESDArrayNeg;    //[fnGammaCandidates]
    Int_t fnCuts;
    Int_t fiCut;
-   Int_t fNumberOfESDTracks;
    Bool_t fMoveParticleAccordingToVertex;
    Bool_t fIsHeavyIon;
    Bool_t fDoMesonAnalysis;
index fa6101d..7e907d2 100644 (file)
@@ -58,31 +58,33 @@ ClassImp(AliConversionCuts)
 
 
 const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
-   "HeavyIon",
-   "CentralityMin",
-   "CentralityMax",
-   "SelectV0AND",
-   "MultiplicityMethod",
-   "RemovePileUp",
-   "RejectExtraSignals",
-   "V0FinderType",
-   "EtaCut",
-   "MinRCut",
-   "SinglePtCut",
-   "ClsTPCCut",
-   "ededxSigmaCut",
-   "pidedxSigmaCut",
-   "piMomdedxSigmaCut",
-   "piMaxMomdedxSigmaCut",
-   "LowPRejectionSigmaCut",
-   "TOFelectronPID",
-   "QtMaxCut",
-   "Chi2GammaCut",
-   "PsiPair",
-   "DoPhotonAsymmetryCut",
-   "CosinePointingAngle",
-   "SharedElectronCuts",
-   "RejectToCloseV0s"
+   "HeavyIon",//0
+   "CentralityMin",//1
+   "CentralityMax",//2
+   "SelectV0AND",//3
+   "MultiplicityMethod",//4
+   "RemovePileUp",//5
+   "RejectExtraSignals",//6
+   "V0FinderType",//7
+   "EtaCut",//8
+   "MinRCut",//9
+   "SinglePtCut",//10
+   "ClsTPCCut", //11
+   "ededxSigmaCut",//12
+   "pidedxSigmaCut",//13
+   "piMomdedxSigmaCut",//14
+   "piMaxMomdedxSigmaCut",//15
+   "LowPRejectionSigmaCut",//16
+   "TOFelectronPID",//17
+   "QtMaxCut",//18
+   "Chi2GammaCut", //19
+   "PsiPair", //20
+   "DoPhotonAsymmetryCut",//21
+   "CosinePointingAngle", //22
+   "SharedElectronCuts", //23
+   "RejectToCloseV0s", //24
+   "DcaRPrimVtx", //25
+   "DcaZPrimVtx" //26
 };
 
 
@@ -168,6 +170,8 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
    fRandom(0),
    fElectronArraySize(500),
    fElectronLabelArray(NULL),
+   fDCAZPrimVtxCut(1000),
+   fDCARPrimVtxCut(1000),
    fConversionPointXArray(0.0),
    fConversionPointYArray(0.0),
    fConversionPointZArray(0.0),
@@ -204,6 +208,7 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
    hCutIndex(NULL),
    hV0EventCuts(NULL),
    hCentrality(NULL),
+   hCentralityVsNumberOfPrimaryTracks(NULL),
    hVertexZ(NULL),
    hTriggerClass(NULL),
    hTriggerClassSelected(NULL),
@@ -309,6 +314,8 @@ AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
    fRandom(ref.fRandom),
    fElectronArraySize(ref.fElectronArraySize),
    fElectronLabelArray(NULL),
+   fDCAZPrimVtxCut(ref.fDCAZPrimVtxCut),
+   fDCARPrimVtxCut(ref.fDCAZPrimVtxCut),
    fConversionPointXArray(ref.fConversionPointXArray),
    fConversionPointYArray(ref.fConversionPointYArray),
    fConversionPointZArray(ref.fConversionPointZArray),
@@ -345,6 +352,7 @@ AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
    hCutIndex(NULL),
    hV0EventCuts(NULL),
    hCentrality(NULL),
+   hCentralityVsNumberOfPrimaryTracks(NULL),
    hVertexZ(NULL),
    hTriggerClass(NULL),
    hTriggerClassSelected(NULL),
@@ -445,7 +453,7 @@ void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
    fHistograms->Add(hTrackCuts);
 
    // Photon Cuts
-   hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",12,-0.5,11.5);
+   hPhotonCuts=new TH1F(Form("PhotonCuts %s",GetCutNumber().Data()),"PhotonCuts",14,-0.5,13.5);
    hPhotonCuts->GetXaxis()->SetBinLabel(1,"in");
    hPhotonCuts->GetXaxis()->SetBinLabel(2,"qtcut");
    hPhotonCuts->GetXaxis()->SetBinLabel(3,"chi2");
@@ -455,7 +463,9 @@ void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
    hPhotonCuts->GetXaxis()->SetBinLabel(7,"cortpcclinfo");
    hPhotonCuts->GetXaxis()->SetBinLabel(8,"PsiPair");
    hPhotonCuts->GetXaxis()->SetBinLabel(9,"CosPAngle");
-   hPhotonCuts->GetXaxis()->SetBinLabel(10,"out");
+   hPhotonCuts->GetXaxis()->SetBinLabel(10,"DCA R");
+   hPhotonCuts->GetXaxis()->SetBinLabel(11,"DCA Z");
+   hPhotonCuts->GetXaxis()->SetBinLabel(12,"out");
    fHistograms->Add(hPhotonCuts);
 
    if(preCut){
@@ -556,8 +566,10 @@ void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
       hV0EventCuts->GetXaxis()->SetBinLabel(7,"out");
       fHistograms->Add(hV0EventCuts);
 
-      hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",100,0,100);
+      hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",1000,0,100);
       fHistograms->Add(hCentrality);
+      hCentralityVsNumberOfPrimaryTracks=new TH2F(Form("Centrality vs Primary Tracks %s",GetCutNumber().Data()),"Centrality vs Primary Tracks ",100,0,100,3000,0,3000);
+      fHistograms->Add(hCentralityVsNumberOfPrimaryTracks);
       hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
       fHistograms->Add(hVertexZ);
 
@@ -686,6 +698,7 @@ Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMC
    }
 
    // Event Trigger
+//    cout << "before event trigger" << endl;
    if(!IsTriggerSelected(fInputEvent)){
       if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
       fEventQuality = 3;
@@ -740,7 +753,10 @@ Bool_t AliConversionCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMC
    if(hV0EventCuts)hV0EventCuts->Fill(cutindex);
    if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
    if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent));
-
+   if(hCentralityVsNumberOfPrimaryTracks)
+      hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(fInputEvent),
+                                               ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
+                                                ->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks());
    fEventQuality = 0;
    return kTRUE;
 }
@@ -997,14 +1013,32 @@ Bool_t AliConversionCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *
       return kFALSE;
    }
 
-   cutIndex++; //9
-   if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
+   AliAODConversionPhoton* photonAOD = dynamic_cast<AliAODConversionPhoton*>(photon);
+   if (photonAOD){
+      photonAOD->CalculateDistanceOfClossetApproachToPrimVtx(event->GetPrimaryVertex());
+      
+      cutIndex++; //9
+      if(photonAOD->GetDCArToPrimVtx() > fDCARPrimVtxCut) { //DCA R cut of photon to primary vertex
+         if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //9
+         return kFALSE;
+      }
+      
+      cutIndex++; //10
+      if(abs(photonAOD->GetDCAzToPrimVtx()) > fDCAZPrimVtxCut) { //DCA Z cut of photon to primary vertex
+         if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //10
+         return kFALSE;
+      }
+   } else {
+      cutIndex++; //9
+      cutIndex++; //10
+   }
+   cutIndex++; //11
+   if(hPhotonCuts)hPhotonCuts->Fill(cutIndex); //11
 
    // Histos after Cuts
    if(hInvMassafter)hInvMassafter->Fill(photon->GetMass());
    if(hArmenterosafter)hArmenterosafter->Fill(photon->GetArmenterosAlpha(),photon->GetArmenterosQt());
-
-
+   
    return kTRUE;
 
 }
@@ -1072,13 +1106,13 @@ Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliV
       FillPhotonCutIndex(kNoTracks);
       return kFALSE;
    }
-
+   photon->DeterminePhotonQuality(negTrack,posTrack);
    // Track Cuts
    if(!TracksAreSelected(negTrack, posTrack)){
       FillPhotonCutIndex(kTrackCuts);
       return kFALSE;
    }
-
+   
    // dEdx Cuts
    if(!dEdxCuts(negTrack) || !dEdxCuts(posTrack)) {
       FillPhotonCutIndex(kdEdxCuts);
@@ -1193,7 +1227,7 @@ Bool_t AliConversionCuts::SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack
 
    AliAODVertex * NegVtxType=negTrack->GetProdVertex();
    AliAODVertex * PosVtxType=posTrack->GetProdVertex();
-   if((NegVtxType->GetType())==AliAODVertex::kKink  || (PosVtxType->GetType())==AliAODVertex::kKink) {
+   if( (NegVtxType->GetType())==AliAODVertex::kKink || (PosVtxType->GetType())==AliAODVertex::kKink) {
       if(hTrackCuts)hTrackCuts->Fill(cutIndex);
       return kFALSE;
    }
@@ -1237,6 +1271,8 @@ Bool_t AliConversionCuts::TracksAreSelected(AliVTrack * negTrack, AliVTrack * po
    cutIndex++;
 
    // Number of TPC Clusters
+   
+   
    if( negTrack->GetNcls(1) < fMinClsTPC || posTrack->GetNcls(1) < fMinClsTPC ) {
       if(hTrackCuts)hTrackCuts->Fill(cutIndex);
       return kFALSE;
@@ -1432,7 +1468,7 @@ Bool_t AliConversionCuts::AsymmetryCut(AliConversionPhotonBase * photon,AliVEven
          if (photon->GetPhotonP()!=0.){
             trackNegAsy= track->P()/photon->GetPhotonP();
          }
-
+         
          if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
             return kFALSE;
          }
@@ -1853,6 +1889,21 @@ Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
          return kTRUE;
       } else return kFALSE;
 
+   case kDcaRPrimVtx:
+      if( SetDCARPhotonPrimVtxCut(value)) {
+         fCuts[kDcaRPrimVtx] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
+
+   case kDcaZPrimVtx:
+      if( SetDCAZPhotonPrimVtxCut(value)) {
+         fCuts[kDcaZPrimVtx] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
+
+      
    case kNCuts:
       AliError("Cut id out of range");
       return kFALSE;
@@ -1900,7 +1951,7 @@ Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
       fDetectorCentrality=0;
       fModCentralityClass=3;
       break;
-   case 6: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
+   case 6: //allows to select centrality 0-45% in steps of 5% for track mult
       //strict cut on v0 tracks for MC
       fIsHeavyIon=1;
       fDetectorCentrality=0;
@@ -2832,6 +2883,90 @@ Bool_t AliConversionCuts::SetTRDElectronCut(Int_t TRDElectronCut)
 
    return kTRUE;
 }
+
+///________________________________________________________________________
+Bool_t AliConversionCuts::SetDCAZPhotonPrimVtxCut(Int_t DCAZPhotonPrimVtx){ 
+   // Set Cut
+   switch(DCAZPhotonPrimVtx){
+   case 0:  //
+      fDCAZPrimVtxCut   = 1000; 
+      break;
+   case 1:  //
+      fDCAZPrimVtxCut   = 10;
+      break;
+   case 2:  //
+      fDCAZPrimVtxCut   = 5;
+      break;
+   case 3:  //
+      fDCAZPrimVtxCut   = 4;
+      break;
+   case 4:  //
+      fDCAZPrimVtxCut   = 3;
+      break;
+   case 5:  //
+      fDCAZPrimVtxCut   = 2.5;
+      break;
+   case 6:  //
+      fDCAZPrimVtxCut   = 2;
+      break;
+   case 7:  //
+      fDCAZPrimVtxCut   = 1.5;
+      break;
+   case 8:  //
+      fDCAZPrimVtxCut   = 1;
+      break;
+   case 9:  //
+      fDCAZPrimVtxCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCAZPhotonPrimVtx not defined "<<DCAZPhotonPrimVtx<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliConversionCuts::SetDCARPhotonPrimVtxCut(Int_t DCARPhotonPrimVtx){ 
+   // Set Cut
+   switch(DCARPhotonPrimVtx){
+   case 0:  //
+      fDCARPrimVtxCut   = 1000; 
+      break;
+   case 1:  //
+      fDCARPrimVtxCut   = 10;
+      break;
+   case 2:  //
+      fDCARPrimVtxCut   = 5;
+      break;
+   case 3:  //
+      fDCARPrimVtxCut   = 4;
+      break;
+   case 4:  //
+      fDCARPrimVtxCut   = 3;
+      break;
+   case 5:  //
+      fDCARPrimVtxCut   = 2.5;
+      break;
+   case 6:  //
+      fDCARPrimVtxCut   = 2;
+      break;
+   case 7:  //
+      fDCARPrimVtxCut   = 1.5;
+      break;
+   case 8:  //
+      fDCARPrimVtxCut   = 1;
+      break;
+   case 9:  //
+      fDCARPrimVtxCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCARPhotonPrimVtx not defined "<<DCARPhotonPrimVtx<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+
 //-------------------------------------------------------------
 Double_t AliConversionCuts::GetCentrality(AliVEvent *event)
 {   // Get Event Centrality
@@ -2864,11 +2999,9 @@ Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCE
 {   // Centrality Selection
    if(!fIsHeavyIon)return kTRUE;
 
-   if(fCentralityMin == 0 && fCentralityMax == 0) return kTRUE;//0-100%
-   if(fCentralityMin >= fCentralityMax ){
-     if(fCentralityMax==0 && fModCentralityClass ==0) fCentralityMax=10; //CentralityRange = fCentralityMin-100%
-     else  return kTRUE;//0-100%
-   }
+   if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
+   else if(fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-100%
+         
    Double_t centrality=GetCentrality(event);
    if(centrality<0)return kFALSE;
 
@@ -2891,19 +3024,55 @@ Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCE
          return kTRUE;
       else return kFALSE;
    }
-
-   // Use strict V0 amplitude cut for MC centrality
-   Float_t nv0amplitude = event->GetVZEROData()->GetMTotV0A()+event->GetVZEROData()->GetMTotV0C();
-   Float_t V0Amplitude10[10] = {9999999.0,13670,9345,6209,3944,2352,1272,611,255, 83};
-   //                                   0    10   20   30   40   50   60  70  80  90%
-   Float_t V0Amplitude5a[10] = {9999999.0,16612,13670,11290,9345,7650,6209,4984,3944,3074};
-   //                                   0     5    10    15   20   25   30   35   40   45%
-   Float_t V0Amplitude5b[10] = {3074,2352,1725,1272,899,611,402,255,152,83};
-   //                             45   50   55   60  65  70  75  80  85 90%
    
+   Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks();
+   Int_t PrimaryTracks10[10][2] = 
+      {
+         {9999,9999}, //  0
+         {1210,1210}, // 10
+         { 817, 817}, // 20
+         { 536, 536}, // 30
+         { 337, 337}, // 40
+         { 197, 197}, // 50
+         { 106, 106}, // 60
+         {  51,  51}, // 70
+         {  21,  21}, // 80
+         {   0,   0}  // 90
+      };
+   Int_t PrimaryTracks5a[10][2] = 
+      {
+         {9999,9999}, // 0
+         {1485,2560}, // 5
+         {1210,2070}, // 10
+         { 995,1730}, // 15
+         { 817,1415}, // 20
+         { 666,1145}, // 25
+         { 536, 925}, // 30
+         { 428, 735}, // 35
+         { 337, 557}, // 40
+         { 260, 445}  // 45
+      };
+   Int_t PrimaryTracks5b[10][2] = 
+      {
+         { 260, 445}, // 45
+         { 197, 333}, // 50 // Below still ESDS for AODs
+         { 147, 147}, // 55
+         { 106, 106}, // 60
+         {  75,  75}, // 65
+         {  51,  51}, // 70
+         {  34,  34}, // 75
+         {  21,  21}, // 80
+         {  13,  13}, // 85
+         {   0,   0}  // 90
+      };
+
+   Int_t column = -1;
+   if(event->IsA()==AliESDEvent::Class()) column = 0;
+   if(event->IsA()==AliAODEvent::Class()) column = 1;
+      
    if (fModCentralityClass == 3){
       if(fMCEvent){
-         if(nv0amplitude > V0Amplitude10[fCentralityMax] && nv0amplitude <= V0Amplitude10[fCentralityMin])
+         if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column])
             return kTRUE;
          else return kFALSE;
       }
@@ -2916,7 +3085,7 @@ Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCE
    }
    else if (fModCentralityClass ==4){
       if(fMCEvent){
-         if(nv0amplitude > V0Amplitude5a[fCentralityMax] && nv0amplitude <= V0Amplitude5a[fCentralityMin])
+         if(nprimaryTracks > PrimaryTracks5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5a[fCentralityMin][column])
             return kTRUE;
          else return kFALSE;
       }
@@ -2929,7 +3098,7 @@ Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCE
    }
    else if (fModCentralityClass ==5){
       if(fMCEvent){
-         if(nv0amplitude > V0Amplitude5b[fCentralityMax] && nv0amplitude <= V0Amplitude5b[fCentralityMin])
+         if(nprimaryTracks > PrimaryTracks5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5b[fCentralityMin][column])
             return kTRUE;
          else return kFALSE;
       }
@@ -3273,6 +3442,8 @@ Bool_t AliConversionCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList
 ///________________________________________________________________________
 void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent){
 
+
+
    if(fNotRejectedStart){
       delete[] fNotRejectedStart;
       fNotRejectedStart = NULL;
@@ -3296,7 +3467,7 @@ void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLi
       cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
       if(cHeader) headerFound = kTRUE;
    }
-   if(MCEvent->IsA()==AliAODEvent::Class()){
+   if(MCEvent->IsA()==AliAODEvent::Class()){ // MCEvent is a AODEvent in case of AOD
       cHeaderAOD = dynamic_cast<AliAODMCHeader*>(MCEvent->FindListObject(AliAODMCHeader::StdBranchName()));
       if(cHeaderAOD) headerFound = kTRUE;
    }
@@ -3352,7 +3523,7 @@ void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLi
                fNotRejectedStart[nummer] = firstindex;
                fNotRejectedEnd[nummer] = lastindex;
                fGeneratorNames[nummer] = GeneratorName;
-//                cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
+               //cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
                nummer++;
                continue;
             }
@@ -3366,10 +3537,8 @@ void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLi
       fnHeaders = 1;
       fNotRejectedStart[0] = 0;
       fNotRejectedEnd[0] = static_cast<AliMCEvent*>(MCEvent)->Stack()->GetNprimary()-1;
-      //       if(rejection == 2){
       fGeneratorNames = new TString[1];
       fGeneratorNames[0] = "NoCocktailGeneratorFound";
-//       }
 
       AliGenPythiaEventHeader *mcHeaderPythia = dynamic_cast<AliGenPythiaEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
       if (mcHeaderPythia) fGeneratorNames[0] = "NoCocktailGeneratorFound_Pythia";
@@ -3406,6 +3575,7 @@ Int_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack, A
    else if(InputEvent->IsA()==AliAODEvent::Class()){
       TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
       AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
+      if(!aodMCParticle) return 1; // Photon Without a Mother ? --> Accepted
       if(!aodMCParticle->IsPrimary()){
          if( aodMCParticle->GetMother() < 0) return 1;// Secondary Particle without Mother??
          return IsParticleFromBGEvent(aodMCParticle->GetMother(),MCStack,InputEvent);
@@ -3547,6 +3717,7 @@ Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliSta
          e =1.85140;
       }
       functionResultMC = a*TMath::Power(mesonPt,-1.*(b+c/(TMath::Power(mesonPt,d)+e)))*1./mesonPt *1./1.6 *1./(2.* TMath::Pi());
+//       cout << functionResultMC << endl;
    } else if (kCaseGen == 3 ){ // HIJING
       if ( PDGCode ==  111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){
          functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt);
@@ -3571,6 +3742,7 @@ Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliSta
          tData = 0.13835;
       }
       functionResultData = dNdyData / ( 2 * TMath::Pi())*(nData-1.)*(nData-2.) / (nData*tData*(nData*tData+mesonMass*(nData-2.)))  * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nData*tData), -nData);
+//       cout << functionResultData << endl;
    } else {
       Float_t a = 0.;
       Float_t b = 0.;
@@ -3655,8 +3827,10 @@ Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliSta
    if (PDGCode ==  111 || PDGCode ==  221){
       if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){
          weight = functionResultData/functionResultMC;
-         if ( !(kCaseGen == 3 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode ==  111)){
-         weight = 1.;  
+         if ( kCaseGen == 3){
+            if (!(fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode ==  111)){
+               weight = 1.;  
+            }
          }
          if (!isfinite(functionResultData)) weight = 1.;  
          if (!isfinite(weight)) weight = 1.;  
@@ -3666,7 +3840,7 @@ Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliSta
    }
       
 //    if (fModCentralityClass == 0 && fCentralityMin == 4 && fCentralityMax == 6 && PDGCode ==  111){
-//       cout << period.Data() << "\t" << kCaseGen << "\t" <<fModCentralityClass<< "\t" <<fCentralityMin<< "\t" <<fCentralityMax << "\t" << mesonPt << "\t" <<mesonMass<< "\t"<<functionResultData << "\t"<< functionResultMC << "\t" << weight <<endl;
+//        cout << period.Data() << "\t" << kCaseGen << "\t" <<fModCentralityClass<< "\t" <<fCentralityMin<< "\t" <<fCentralityMax << "\t" << mesonPt << "\t" <<mesonMass<< "\t"<<functionResultData << "\t"<< functionResultMC << "\t" << weight <<endl;
 //    }
    return weight;
 }
index 2e09528..d3d6024 100644 (file)
@@ -63,6 +63,8 @@ class AliConversionCuts : public AliAnalysisCuts {
        kCosPAngle,
        kElecShare,
        kToCloseV0s,
+        kDcaRPrimVtx,
+        kDcaZPrimVtx,
        kNCuts
   };
 
@@ -241,8 +243,9 @@ class AliConversionCuts : public AliAnalysisCuts {
   Bool_t SetSharedElectronCut(Int_t sharedElec);
   Bool_t SetToCloseV0sCut(Int_t toClose);
   Bool_t SetRejectExtraSignalsCut(Int_t extraSignal);
-
-
+  Bool_t SetDCARPhotonPrimVtxCut(Int_t DCARPhotonPrimVtx);
+  Bool_t SetDCAZPhotonPrimVtxCut(Int_t DCAZPhotonPrimVtx);
+   
   // Request Flags
 
   Int_t IsHeavyIon(){return fIsHeavyIon;}
@@ -344,6 +347,8 @@ class AliConversionCuts : public AliAnalysisCuts {
   TRandom3 fRandom; //
   Int_t fElectronArraySize; // Size of electron array
   Int_t *fElectronLabelArray; //[fElectronArraySize]
+  Double_t fDCAZPrimVtxCut; // cut value for the maximum distance in Z between the photon & the primary vertex [cm]
+  Double_t fDCARPrimVtxCut; // cut value for the maximum distance in R between the photon & the primary vertex [cm]
   Float_t fConversionPointXArray; // Array with conversion Point x
   Float_t fConversionPointYArray; // Array with conversion Point y
   Float_t fConversionPointZArray; // Array with conversion Point z
@@ -381,6 +386,7 @@ class AliConversionCuts : public AliAnalysisCuts {
   TH1F *hCutIndex; // bookkeeping for cuts
   TH1F *hV0EventCuts; // bookkeeping for event selection cuts
   TH1F *hCentrality; // centrality distribution for selected events
+  TH2F *hCentralityVsNumberOfPrimaryTracks; // centrality distribution for selected events
   TH1F *hVertexZ; // vertex z distribution for selected events
   TH1F *hTriggerClass; //fired offline trigger class
   TH1F *hTriggerClassSelected; //selected fired offline trigger class
index b081698..a1c12f4 100644 (file)
@@ -14,7 +14,7 @@
  **************************************************************************/
 
 ////////////////////////////////////////////////
-//--------------------------------------------- 
+//---------------------------------------------
 // Class handling all kinds of selection cuts for
 // Gamma Conversion analysis
 //---------------------------------------------
@@ -62,6 +62,9 @@ const char* AliConversionMesonCuts::fgkCutNames[AliConversionMesonCuts::kNCuts]
    "SharedElectronCuts", //8
    "RejectToCloseV0s", //9
    "UseMCPSmearing", //10
+   "DcaGammaGamma", //11
+   "DcaRPrimVtx", //12
+   "DcaZPrimVtx" //13
 };
 
 
@@ -93,11 +96,20 @@ AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *titl
    fRandom(0),
    fElectronLabelArraySize(500),
    fElectronLabelArray(NULL),
+   fDCAGammaGammaCut(1000),
+   fDCAZMesonPrimVtxCut(1000),
+   fDCARMesonPrimVtxCut(1000),
    fBackgroundHandler(0),
    fCutString(NULL),
    hMesonCuts(NULL),
-   hMesonBGCuts(NULL)
-   
+   hMesonBGCuts(NULL),
+   hDCAGammaGammaMesonBefore(NULL),
+   hDCAZMesonPrimVtxBefore(NULL),
+   hDCARMesonPrimVtxBefore(NULL),
+   hDCAGammaGammaMesonAfter(NULL),
+   hDCAZMesonPrimVtxAfter(NULL),
+   hDCARMesonPrimVtxAfter(NULL)
+
 {
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
    fCutString=new TObjString((GetCutNumber()).Data());
@@ -139,11 +151,19 @@ AliConversionMesonCuts::AliConversionMesonCuts(const AliConversionMesonCuts &ref
    fRandom(ref.fRandom),
    fElectronLabelArraySize(ref.fElectronLabelArraySize),
    fElectronLabelArray(NULL),
+   fDCAGammaGammaCut(ref.fDCAGammaGammaCut),
+   fDCAZMesonPrimVtxCut(ref.fDCAZMesonPrimVtxCut),
+   fDCARMesonPrimVtxCut(ref.fDCARMesonPrimVtxCut),
    fBackgroundHandler(ref.fBackgroundHandler),
    fCutString(NULL),
    hMesonCuts(NULL),
-   hMesonBGCuts(NULL)
-   
+   hMesonBGCuts(NULL),
+   hDCAGammaGammaMesonBefore(NULL),
+   hDCAZMesonPrimVtxBefore(NULL),
+   hDCARMesonPrimVtxBefore(NULL),
+   hDCAGammaGammaMesonAfter(NULL),
+   hDCAZMesonPrimVtxAfter(NULL),
+   hDCARMesonPrimVtxAfter(NULL)
 {
    // Copy Constructor
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
@@ -173,11 +193,11 @@ AliConversionMesonCuts::~AliConversionMesonCuts() {
 }
 
 //________________________________________________________________________
-void AliConversionMesonCuts::InitCutHistograms(TString name){
+void AliConversionMesonCuts::InitCutHistograms(TString name, Bool_t additionalHists){
 
    // Initialize Cut Histograms for QA (only initialized and filled if function is called)
    TH1::AddDirectory(kFALSE);
-   
+
    if(fHistograms != NULL){
       delete fHistograms;
       fHistograms=NULL;
@@ -190,26 +210,54 @@ void AliConversionMesonCuts::InitCutHistograms(TString name){
    }
 
    // Meson Cuts
-   hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",10,-0.5,9.5);
+   hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",13,-0.5,12.5);
    hMesonCuts->GetXaxis()->SetBinLabel(1,"in");
    hMesonCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
    hMesonCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
    hMesonCuts->GetXaxis()->SetBinLabel(4,"opening angle");
    hMesonCuts->GetXaxis()->SetBinLabel(5,"alpha max");
    hMesonCuts->GetXaxis()->SetBinLabel(6,"alpha min");
-   hMesonCuts->GetXaxis()->SetBinLabel(7,"out");
+   hMesonCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
+   hMesonCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
+   hMesonCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
+   hMesonCuts->GetXaxis()->SetBinLabel(10,"out");
    fHistograms->Add(hMesonCuts);
 
-   hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",10,-0.5,9.5);
+   hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",13,-0.5,12.5);
    hMesonBGCuts->GetXaxis()->SetBinLabel(1,"in");
    hMesonBGCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
    hMesonBGCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
    hMesonBGCuts->GetXaxis()->SetBinLabel(4,"opening angle");
    hMesonBGCuts->GetXaxis()->SetBinLabel(5,"alpha max");
    hMesonBGCuts->GetXaxis()->SetBinLabel(6,"alpha min");
-   hMesonBGCuts->GetXaxis()->SetBinLabel(7,"out");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(10,"out");
+
    fHistograms->Add(hMesonBGCuts);
-   
+
+   if (additionalHists){
+      hDCAGammaGammaMesonBefore=new TH1F(Form("DCAGammaGammaMeson Before %s",GetCutNumber().Data()),"DCAGammaGammaMeson Before",200,0,10);
+      fHistograms->Add(hDCAGammaGammaMesonBefore);
+
+      hDCARMesonPrimVtxBefore=new TH1F(Form("DCARMesonPrimVtx Before %s",GetCutNumber().Data()),"DCARMesonPrimVtx Before",200,0,10);
+      fHistograms->Add(hDCARMesonPrimVtxBefore);
+
+      hDCAZMesonPrimVtxBefore=new TH1F(Form("DCAZMesonPrimVtx Before %s",GetCutNumber().Data()),"DCAZMesonPrimVtx Before",401,-10,10);
+      fHistograms->Add(hDCAZMesonPrimVtxBefore);
+
+   }
+
+   hDCAGammaGammaMesonAfter=new TH1F(Form("DCAGammaGammaMeson After %s",GetCutNumber().Data()),"DCAGammaGammaMeson After",200,0,10);
+   fHistograms->Add(hDCAGammaGammaMesonAfter);
+
+   hDCAZMesonPrimVtxAfter=new TH2F(Form("InvMassDCAZMesonPrimVtx After %s",GetCutNumber().Data()),"InvMassDCAZMesonPrimVtx After",800,0,0.8,401,-10,10);
+   fHistograms->Add(hDCAZMesonPrimVtxAfter);
+
+   hDCARMesonPrimVtxAfter=new TH1F(Form("DCARMesonPrimVtx After %s",GetCutNumber().Data()),"DCARMesonPrimVtx After",200,0,10);
+   fHistograms->Add(hDCARMesonPrimVtxAfter);
+
    TH1::AddDirectory(kTRUE);
 }
 
@@ -217,25 +265,25 @@ void AliConversionMesonCuts::InitCutHistograms(TString name){
 Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack, Double_t fRapidityShift){
    // Returns true for all pions within acceptance cuts for decay into 2 photons
    // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
-   
+
    if(!fMCStack)return kFALSE;
-   
-   if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){                   
+
+   if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
       if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
-      
+
       Double_t rapidity = 10.;
       if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
          rapidity=8.-fRapidityShift;
       } else{
          rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
-      }        
-      
+      }
+
       // Rapidity Cut
       if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
-      
+
       // Select only -> 2y decay channel
       if(fMCMother->GetNDaughters()!=2)return kFALSE;
-      
+
       for(Int_t i=0;i<2;i++){
          TParticle *MDaughter=fMCStack->Particle(fMCMother->GetDaughter(i));
          // Is Daughter a Photon?
@@ -288,59 +336,59 @@ Bool_t AliConversionMesonCuts::MesonIsSelectedAODMC(AliAODMCParticle *MCMother,T
 }
 //________________________________________________________________________
 Bool_t AliConversionMesonCuts::MesonIsSelectedMCDalitz(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelelectron, Int_t &labelpositron, Int_t &labelgamma, Double_t fRapidityShift){
-  
+
    // Returns true for all pions within acceptance cuts for decay into 2 photons
    // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
 
    if( !fMCStack )return kFALSE;
-       
+
    if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
-               
+
    if(  fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
 
    Double_t rapidity = 10.;
-   
+
    if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
-         rapidity=8.-fRapidityShift;
+      rapidity=8.-fRapidityShift;
    }
    else{
-         rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
-   }   
-               
-      // Rapidity Cut
+      rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
+   }
+
+   // Rapidity Cut
    if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
 
-      // Select only -> Dalitz decay channel
+   // Select only -> Dalitz decay channel
    if( fMCMother->GetNDaughters() != 3 )return kFALSE;
 
    TParticle *positron = 0x0;
    TParticle *electron = 0x0;
    TParticle    *gamma = 0x0;
-       
+
    for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
-    
-     TParticle* temp = (TParticle*)fMCStack->Particle( index );
-               
-               switch( temp->GetPdgCode() ) {
-               case ::kPositron:
-                       positron      =  temp;
-                       labelpositron = index;
-                       break;
-               case ::kElectron:
-                       electron      =  temp;
-                       labelelectron = index;
-                       break;
-               case ::kGamma:
-                       gamma         =  temp;
-                       labelgamma    = index;
-                       break;
-               }
-  }
-  
-  if( positron && electron && gamma) return kTRUE;  
-  return kFALSE;
-  
-  
+
+      TParticle* temp = (TParticle*)fMCStack->Particle( index );
+
+      switch( temp->GetPdgCode() ) {
+      case ::kPositron:
+         positron      =  temp;
+         labelpositron = index;
+         break;
+      case ::kElectron:
+         electron      =  temp;
+         labelelectron = index;
+         break;
+      case ::kGamma:
+         gamma         =  temp;
+         labelgamma    = index;
+         break;
+      }
+   }
+
+   if( positron && electron && gamma) return kTRUE;
+   return kFALSE;
+
+
 }
 //________________________________________________________________________
 Bool_t AliConversionMesonCuts::MesonIsSelectedMCChiC(TParticle *fMCMother,AliStack *fMCStack,Int_t & labelelectronChiC, Int_t & labelpositronChiC, Int_t & labelgammaChiC, Double_t fRapidityShift){
@@ -348,68 +396,68 @@ Bool_t AliConversionMesonCuts::MesonIsSelectedMCChiC(TParticle *fMCMother,AliSta
    // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
 
    if(!fMCStack)return kFALSE;
-        // if(fMCMother->GetPdgCode()==20443 ){
-        //      return kFALSE;
-        // }
+   // if(fMCMother->GetPdgCode()==20443 ){
+   //   return kFALSE;
+   // }
    if(fMCMother->GetPdgCode()==10441 || fMCMother->GetPdgCode()==10443 || fMCMother->GetPdgCode()==445 ){
-                if(fMCMother->R()>fMaxR)       return kFALSE; // cuts on distance from collision point
-
-                Double_t rapidity = 10.;
-                if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
-                        rapidity=8.-fRapidityShift;
-                }
-                else{
-                        rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
-                }      
-               
-                // Rapidity Cut
-                if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
-
-                // Select only -> ChiC radiative (JPsi+gamma) decay channel
+      if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
+
+      Double_t rapidity = 10.;
+      if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
+         rapidity=8.-fRapidityShift;
+      }
+      else{
+         rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
+      }
+
+      // Rapidity Cut
+      if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
+
+      // Select only -> ChiC radiative (JPsi+gamma) decay channel
       if(fMCMother->GetNDaughters()!=2)return kFALSE;
 
-                       TParticle *jpsi         = 0x0;
-                       TParticle *gamma        = 0x0;
-                       TParticle *positron = 0x0;
-                       TParticle *electron = 0x0;
-
-                       Int_t labeljpsiChiC = -1;
-       
-                       for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){                           
-                               
-                               TParticle* temp = (TParticle*)fMCStack->Particle( index );
-                               
-                               switch( temp->GetPdgCode() ) {
-                               case 443:
-                                       jpsi =  temp;
-                                       labeljpsiChiC = index;
-                                       break;
-                               case 22:
-                                       gamma    =  temp;
-                                       labelgammaChiC = index;
-                                       break;
-                               }
-                       }
+      TParticle *jpsi  = 0x0;
+      TParticle *gamma         = 0x0;
+      TParticle *positron = 0x0;
+      TParticle *electron = 0x0;
+
+      Int_t labeljpsiChiC = -1;
+
+      for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
+
+         TParticle* temp = (TParticle*)fMCStack->Particle( index );
+
+         switch( temp->GetPdgCode() ) {
+         case 443:
+            jpsi =  temp;
+            labeljpsiChiC = index;
+            break;
+         case 22:
+            gamma    =  temp;
+            labelgammaChiC = index;
+            break;
+         }
+      }
 
       if ( !jpsi || ! gamma) return kFALSE;
-                       if(jpsi->GetNDaughters()!=2)return kFALSE;
-                
-
-                       for(Int_t index= jpsi->GetFirstDaughter();index<= jpsi->GetLastDaughter();index++){                             
-                               TParticle* temp = (TParticle*)fMCStack->Particle( index );
-                               switch( temp->GetPdgCode() ) {
-                               case -11:
-                                       electron =  temp;
-                                       labelelectronChiC = index;
-                                       break;
-                               case 11:
-                                       positron =  temp;
-                                       labelpositronChiC = index;
-                                       break;
-                               }
-                       }
-                       if( !electron || !positron) return kFALSE;
-                       if( positron && electron && gamma) return kTRUE;
+      if(jpsi->GetNDaughters()!=2)return kFALSE;
+
+
+      for(Int_t index= jpsi->GetFirstDaughter();index<= jpsi->GetLastDaughter();index++){
+         TParticle* temp = (TParticle*)fMCStack->Particle( index );
+         switch( temp->GetPdgCode() ) {
+         case -11:
+            electron =  temp;
+            labelelectronChiC = index;
+            break;
+         case 11:
+            positron =  temp;
+            labelpositronChiC = index;
+            break;
+         }
+      }
+      if( !electron || !positron) return kFALSE;
+      if( positron && electron && gamma) return kTRUE;
    }
    return kFALSE;
 }
@@ -419,6 +467,7 @@ Bool_t AliConversionMesonCuts::MesonIsSelectedMCChiC(TParticle *fMCMother,AliSta
 ///________________________________________________________________________
 Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal, Double_t fRapidityShift)
 {
+
    // Selection of reconstructed Meson candidates
    // Use flag IsSignal in order to fill Fill different
    // histograms for Signal and Background
@@ -470,6 +519,35 @@ Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_
    }
    cutIndex++;
 
+   if (hDCAGammaGammaMesonBefore)hDCAGammaGammaMesonBefore->Fill(pi0->GetDCABetweenPhotons());
+   if (hDCARMesonPrimVtxBefore)hDCARMesonPrimVtxBefore->Fill(pi0->GetDCARMotherPrimVtx());
+
+   if (pi0->GetDCABetweenPhotons() > fDCAGammaGammaCut){
+      if(hist)hist->Fill(cutIndex);
+      return kFALSE;
+   }
+   cutIndex++;
+
+   if (pi0->GetDCARMotherPrimVtx() > fDCARMesonPrimVtxCut){
+      if(hist)hist->Fill(cutIndex);
+      return kFALSE;
+   }
+   cutIndex++;
+
+
+   if (hDCAZMesonPrimVtxBefore)hDCAZMesonPrimVtxBefore->Fill(pi0->GetDCAZMotherPrimVtx());
+
+   if (abs(pi0->GetDCAZMotherPrimVtx()) > fDCAZMesonPrimVtxCut){
+      if(hist)hist->Fill(cutIndex);
+      return kFALSE;
+   }
+   cutIndex++;
+
+
+   if (hDCAGammaGammaMesonAfter)hDCAGammaGammaMesonAfter->Fill(pi0->GetDCABetweenPhotons());
+   if (hDCARMesonPrimVtxAfter)hDCARMesonPrimVtxAfter->Fill(pi0->GetDCARMotherPrimVtx());
+   if (hDCAZMesonPrimVtxAfter)hDCAZMesonPrimVtxAfter->Fill(pi0->M(),pi0->GetDCAZMotherPrimVtx());
+
    if(hist)hist->Fill(cutIndex);
    return kTRUE;
 }
@@ -501,7 +579,7 @@ Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysi
       AliError("Cut selection contains characters");
       return kFALSE;
    }
-       
+
    const char *cutSelection = analysisCutSelection.Data();
 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
    for(Int_t ii=0;ii<kNCuts;ii++){
@@ -593,15 +671,33 @@ Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
          UpdateCutString();
          return kTRUE;
       } else return kFALSE;
+   case kDcaGammaGamma:
+      if( SetDCAGammaGammaCut(value)) {
+         fCuts[kDcaGammaGamma] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
+   case kDcaZPrimVtx:
+      if( SetDCAZMesonPrimVtxCut(value)) {
+         fCuts[kDcaZPrimVtx] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
+   case kDcaRPrimVtx:
+      if( SetDCARMesonPrimVtxCut(value)) {
+         fCuts[kDcaRPrimVtx] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
 
    case kNCuts:
       cout << "Error:: Cut id out of range"<< endl;
       return kFALSE;
    }
-  
+
    cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
    return kFALSE;
-  
+
 }
 
 
@@ -644,7 +740,7 @@ Bool_t AliConversionMesonCuts::SetRCut(Int_t rCut){
       fMaxR = 180.;
       break;
    case 3:
-      fMaxR = 70.;                     
+      fMaxR = 70.;
       break;
    case 4:
       fMaxR = 70.;
@@ -745,7 +841,7 @@ Bool_t AliConversionMesonCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
 }
 
 ///________________________________________________________________________
-Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){ 
+Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
    // Set Cut
    switch(RapidityMesonCut){
    case 0:  //
@@ -916,7 +1012,7 @@ Bool_t AliConversionMesonCuts::SetSharedElectronCut(Int_t sharedElec) {
       cout<<"Warning: Shared Electron Cut not defined "<<sharedElec<<endl;
       return kFALSE;
    }
-       
+
    return kTRUE;
 }
 
@@ -1018,6 +1114,132 @@ Bool_t AliConversionMesonCuts::SetMCPSmearing(Int_t useMCPSmearing)
    }
    return kTRUE;
 }
+
+
+///________________________________________________________________________
+Bool_t AliConversionMesonCuts::SetDCAGammaGammaCut(Int_t DCAGammaGamma){
+   // Set Cut
+   switch(DCAGammaGamma){
+   case 0:  //
+      fDCAGammaGammaCut   = 1000;
+      break;
+   case 1:  //
+      fDCAGammaGammaCut   = 10;
+      break;
+   case 2:  //
+      fDCAGammaGammaCut   = 5;
+      break;
+   case 3:  //
+      fDCAGammaGammaCut   = 4;
+      break;
+   case 4:  //
+      fDCAGammaGammaCut   = 3;
+      break;
+   case 5:  //
+      fDCAGammaGammaCut   = 2.5;
+      break;
+   case 6:  //
+      fDCAGammaGammaCut   = 2;
+      break;
+   case 7:  //
+      fDCAGammaGammaCut   = 1.5;
+      break;
+   case 8:  //
+      fDCAGammaGammaCut   = 1;
+      break;
+   case 9:  //
+      fDCAGammaGammaCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCAGammaGamma not defined "<<DCAGammaGamma<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliConversionMesonCuts::SetDCAZMesonPrimVtxCut(Int_t DCAZMesonPrimVtx){
+   // Set Cut
+   switch(DCAZMesonPrimVtx){
+   case 0:  //
+      fDCAZMesonPrimVtxCut   = 1000;
+      break;
+   case 1:  //
+      fDCAZMesonPrimVtxCut   = 10;
+      break;
+   case 2:  //
+      fDCAZMesonPrimVtxCut   = 5;
+      break;
+   case 3:  //
+      fDCAZMesonPrimVtxCut   = 4;
+      break;
+   case 4:  //
+      fDCAZMesonPrimVtxCut   = 3;
+      break;
+   case 5:  //
+      fDCAZMesonPrimVtxCut   = 2.5;
+      break;
+   case 6:  //
+      fDCAZMesonPrimVtxCut   = 2;
+      break;
+   case 7:  //
+      fDCAZMesonPrimVtxCut   = 1.5;
+      break;
+   case 8:  //
+      fDCAZMesonPrimVtxCut   = 1;
+      break;
+   case 9:  //
+      fDCAZMesonPrimVtxCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCAZMesonPrimVtx not defined "<<DCAZMesonPrimVtx<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliConversionMesonCuts::SetDCARMesonPrimVtxCut(Int_t DCARMesonPrimVtx){
+   // Set Cut
+   switch(DCARMesonPrimVtx){
+   case 0:  //
+      fDCARMesonPrimVtxCut   = 1000;
+      break;
+   case 1:  //
+      fDCARMesonPrimVtxCut   = 10;
+      break;
+   case 2:  //
+      fDCARMesonPrimVtxCut   = 5;
+      break;
+   case 3:  //
+      fDCARMesonPrimVtxCut   = 4;
+      break;
+   case 4:  //
+      fDCARMesonPrimVtxCut   = 3;
+      break;
+   case 5:  //
+      fDCARMesonPrimVtxCut   = 2.5;
+      break;
+   case 6:  //
+      fDCARMesonPrimVtxCut   = 2;
+      break;
+   case 7:  //
+      fDCARMesonPrimVtxCut   = 1.5;
+      break;
+   case 8:  //
+      fDCARMesonPrimVtxCut   = 1;
+      break;
+   case 9:  //
+      fDCARMesonPrimVtxCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCARMesonPrimVtx not defined "<<DCARMesonPrimVtx<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+
 ///________________________________________________________________________
 TString AliConversionMesonCuts::GetCutNumber(){
    // returns TString with current cut number
@@ -1030,10 +1252,10 @@ TString AliConversionMesonCuts::GetCutNumber(){
 
 ///________________________________________________________________________
 void AliConversionMesonCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
-       
+
    Int_t posLabel = photon->GetTrackLabelPositive();
    Int_t negLabel = photon->GetTrackLabelNegative();
-       
+
    fElectronLabelArray[nV0*2] = posLabel;
    fElectronLabelArray[(nV0*2)+1] = negLabel;
 }
@@ -1067,7 +1289,7 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
       Double_t posCompX = photonComp->GetConversionX();
       Double_t posCompY = photonComp->GetConversionY();
       Double_t posCompZ = photonComp->GetConversionZ();
-               
+
       Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
 
       if(dist < fminV0Dist*fminV0Dist){
@@ -1075,7 +1297,7 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
          else {
             return kFALSE;}
       }
-               
+
    }
    return kTRUE;
 }
@@ -1083,7 +1305,7 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
 ///________________________________________________________________________
 void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
 {
-   
+
    if (photon==NULL) return;
    Double_t facPBrem = 1.;
    Double_t facPSig = 0.;
@@ -1092,17 +1314,17 @@ void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
    Double_t theta=0.;
    Double_t P=0.;
 
-   
+
    P=photon->P();
    phi=photon->Phi();
    if( photon->P()!=0){
       theta=acos( photon->Pz()/ photon->P());
    }
 
-   if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){ 
+   if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
       facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
    }
-       
+
    if( fPBremSmearing != 1.){
       if(fBrem!=NULL){
          facPBrem = fBrem->GetRandom();
index aea4b99..a4b01e8 100644 (file)
@@ -48,6 +48,9 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
        kElecShare,
        kToCloseV0s,
        kuseMCPSmearing,
+   kDcaGammaGamma,
+   kDcaRPrimVtx,
+   kDcaZPrimVtx,
        kNCuts
   };
 
@@ -80,7 +83,7 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
   Bool_t MesonIsSelectedMCChiC(TParticle *fMCMother,AliStack *fMCStack, Int_t &, Int_t &, Int_t &, Double_t fRapidityShift=0. );
   void PrintCuts();
 
-  void InitCutHistograms(TString name="");
+  void InitCutHistograms(TString name="",Bool_t additionalHists=kFALSE);
   void SetFillCutHistograms(TString name=""){if(!fHistograms){InitCutHistograms(name);};}
   TList *GetCutHistograms(){return fHistograms;}
   void SmearParticle(AliAODConversionPhoton * photon);
@@ -99,7 +102,9 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
   Bool_t SetMCPSmearing(Int_t useMCPSmearing);
   Bool_t SetSharedElectronCut(Int_t sharedElec);
   Bool_t SetToCloseV0sCut(Int_t toClose);
-
+  Bool_t SetDCAGammaGammaCut(Int_t DCAGammaGamma);
+  Bool_t SetDCAZMesonPrimVtxCut(Int_t DCAZMesonPrimVtx);
+  Bool_t SetDCARMesonPrimVtxCut(Int_t DCARMesonPrimVtx);
 
   // Request Flags
   Bool_t UseRotationMethod(){return fUseRotationMethodInBG;}
@@ -140,12 +145,21 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
   TRandom3 fRandom; //
   Int_t fElectronLabelArraySize;
   Int_t *fElectronLabelArray; //[fElectronLabelArraySize] Array with elec/pos v0 label
+  Double_t fDCAGammaGammaCut; // cut value for the maximum distance between the two photons [cm]
+  Double_t fDCAZMesonPrimVtxCut; // cut value for the maximum distance in Z between the production point of the Meson & the primary vertex [cm]
+  Double_t fDCARMesonPrimVtxCut; // cut value for the maximum distance in R between the production point of the Meson & the primary vertex [cm]
   Int_t fBackgroundHandler; //
   
   // Histograms
   TObjString *fCutString; // cut number used for analysis
   TH1F *hMesonCuts; // bookkeeping for meson cuts
   TH1F *hMesonBGCuts; // bookkeeping for meson bg cuts
+  TH1F *hDCAGammaGammaMesonBefore;
+  TH1F *hDCAZMesonPrimVtxBefore;
+  TH1F *hDCARMesonPrimVtxBefore;
+  TH1F *hDCAGammaGammaMesonAfter;
+  TH2F *hDCAZMesonPrimVtxAfter;
+  TH1F *hDCARMesonPrimVtxAfter;
 
 private:
 
index c893ccd..708836d 100644 (file)
@@ -10,7 +10,8 @@ fV0Index(-1),
   fChi2perNDF(-1),
   fTagged(kFALSE),
   fIMass(-999),
-  fPsiPair(-999)
+  fPsiPair(-999),
+  fQuality(0)
 {
   //Default constructor
   fLabel[0] = -1;
@@ -34,7 +35,8 @@ fV0Index(original.fV0Index),
 fChi2perNDF(original.fChi2perNDF),
 fTagged(original.fTagged),
 fIMass(original.fIMass),
-fPsiPair(original.fPsiPair)
+fPsiPair(original.fPsiPair),
+fQuality(original.fQuality)
   {
   //Copy constructor
   fLabel[0] = original.fLabel[0];
@@ -114,3 +116,32 @@ TParticle *AliConversionPhotonBase::GetMCDaughter(AliStack *fMCStack,Int_t label
        return fMCDaughter;}
     else return 0x0;
 }
+
+///________________________________________________________________________
+void AliConversionPhotonBase::DeterminePhotonQuality(AliVTrack* negTrack, AliVTrack* posTrack){
+
+   
+   if(!negTrack || !posTrack) {
+        fQuality = 0;
+        return;
+   }
+   if(negTrack->Charge() == posTrack->Charge()){
+        fQuality = 0;
+        return;
+   }   
+   Int_t nClusterITSneg = negTrack->GetNcls(0);
+   Int_t nClusterITSpos = posTrack->GetNcls(0);
+   
+   if (nClusterITSneg > 1 && nClusterITSpos > 1){
+      fQuality = 3;
+      return;
+   } else if (nClusterITSneg > 1 || nClusterITSpos > 1){
+      fQuality = 2;
+      return;
+   } else {
+      fQuality = 1;
+      return;
+   }
+   return;
+   
+}
index e11be17..a7b1142 100644 (file)
@@ -48,6 +48,7 @@ class AliConversionPhotonBase {
   void SetChi2perNDF(Float_t chi2) {fChi2perNDF = chi2;}
   Float_t GetChi2perNDF() const {return fChi2perNDF;}
 
+  
   ///Track labels
   void SetLabelPositive(Int_t label){fLabel[0] = label;}
   void SetLabelNegative(Int_t label){fLabel[1] = label;}
@@ -88,7 +89,9 @@ class AliConversionPhotonBase {
   Double_t GetConversionX() const {return fConversionPoint[0];}
   Double_t GetConversionY() const {return fConversionPoint[1];}
   Double_t GetConversionZ() const {return fConversionPoint[2];}
-
+  void GetDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex, Float_t * dca);
+  void DeterminePhotonQuality(AliVTrack* negTrack, AliVTrack* posTrack);
+  UChar_t GetPhotonQuality() const {return fQuality;}
   // Armenteros Qt Alpha
   void GetArmenterosQtAlpha(Double_t qtalpha[2]){qtalpha[0]=fArmenteros[0];qtalpha[1]=fArmenteros[1];}
   Double_t GetArmenterosQt() const {return fArmenteros[0];}
@@ -105,7 +108,7 @@ class AliConversionPhotonBase {
   virtual Double_t GetPx() const = 0;
   virtual Double_t GetPy() const = 0;
   virtual Double_t GetPz() const = 0;
-
+  
 
   Float_t GetMass() const { return fIMass; }
   void SetMass( Float_t mass) { fIMass = mass; }
@@ -113,6 +116,7 @@ class AliConversionPhotonBase {
   Float_t GetPsiPair() const {return fPsiPair;}
   void SetPsiPair(Float_t PsiPair){fPsiPair=PsiPair;}
 
+  
  protected:
 
   Int_t fLabel[2]; // Electron/Positron Track Label
@@ -124,8 +128,12 @@ class AliConversionPhotonBase {
   Bool_t fTagged; // Is it tagged as decay pion (only for gammas)
   Float_t fIMass; // Invariant Mass of dilepton pair
   Float_t fPsiPair; // Psi Pair Value
-
-  ClassDef(AliConversionPhotonBase,3);
+  UChar_t fQuality; //Photon Quality: 
+                     //0: garbage,
+                     //1: both tracks TPC only,
+                     //2: 1 track TPC only
+                     //3: both tracks more than 1 ITS cluster
+  ClassDef(AliConversionPhotonBase,5);
 };
 
 
index 3aead79..5a0deb8 100644 (file)
@@ -113,7 +113,9 @@ AliDalitzElectronCuts::AliDalitzElectronCuts(const char *name,const char *title)
     fBKGMethod(0),\r
     fnumberOfRotationEventsForBG(0),\r
     fDoMassCut(kFALSE),\r
-    fMassCut(999.),\r
+    fMassCutLowPt(999.),\r
+    fMassCutHighPt(999.),\r
+    fMassCutPtMin(-100.0),\r
     fCutString(NULL),\r
     hCutIndex(NULL),\r
     hdEdxCuts(NULL),\r
@@ -125,10 +127,12 @@ AliDalitzElectronCuts::AliDalitzElectronCuts(const char *name,const char *title)
     hTPCdEdxSignalafter(NULL),\r
     hTOFbefore(NULL),\r
     hTOFafter(NULL),\r
-    hTrackDCAxybefore(NULL),\r
-    hTrackDCAxyafter(NULL),\r
-    hTrackDCAzbefore(NULL),\r
-    hTrackDCAzafter(NULL)\r
+    hTrackDCAxyPtbefore(NULL),\r
+    hTrackDCAxyPtafter(NULL),\r
+    hTrackDCAzPtbefore(NULL),\r
+    hTrackDCAzPtafter(NULL),\r
+    hTrackNFindClsPtTPCbefore(NULL),\r
+    hTrackNFindClsPtTPCafter(NULL)\r
    {\r
     InitPIDResponse();\r
     for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}\r
@@ -231,11 +235,16 @@ void AliDalitzElectronCuts::InitCutHistograms(TString name, Bool_t preCut,TStrin
        fHistograms->Add(hTOFbefore);\r
        AxisBeforeTOF = hTOFbefore->GetXaxis();\r
        \r
-       hTrackDCAxybefore = new TH1F(Form("hTrackDCAxy_before %s",cutName.Data()),"DCAxy of tracks before",2000,-10.0,10.0);\r
-       fHistograms->Add(hTrackDCAxybefore);    \r
+       hTrackDCAxyPtbefore = new TH2F(Form("hTrack_DCAxy_Pt_before %s",cutName.Data()),"DCAxy Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);\r
+       fHistograms->Add(hTrackDCAxyPtbefore);  \r
+       \r
+       hTrackDCAzPtbefore  = new TH2F(Form("hTrack_DCAz_Pt_before %s",cutName.Data()), "DCAz  Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);\r
+       fHistograms->Add(hTrackDCAzPtbefore); \r
+       \r
+       hTrackNFindClsPtTPCbefore = new TH2F(Form("hTrack_NFindCls_Pt_TPC_before %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt before",100,0,1,400,0.,10.);\r
+       fHistograms->Add(hTrackNFindClsPtTPCbefore); \r
+       \r
        \r
-       hTrackDCAzbefore  = new TH1F(Form("hTrackDCAz_before %s",cutName.Data()), "DCAz of tracks before",2000,-10.0,10.0);\r
-       fHistograms->Add(hTrackDCAzbefore); \r
 \r
     }\r
 \r
@@ -252,11 +261,14 @@ void AliDalitzElectronCuts::InitCutHistograms(TString name, Bool_t preCut,TStrin
     hTOFafter=new TH2F(Form("Electron_TOF_after %s",cutName.Data()),"TOF electron after" ,150,0.05,20,400,-6,10);\r
     fHistograms->Add(hTOFafter);\r
       \r
-    hTrackDCAxyafter  = new TH1F(Form("hTrackDCAxy_after %s",cutName.Data()),"DCAxy of tracks after",2000,-10.0,10.0);\r
-    fHistograms->Add(hTrackDCAxyafter); \r
+    hTrackDCAxyPtafter  = new TH2F(Form("hTrack_DCAxy_Pt_after %s",cutName.Data()),"DCAxy Vs Pt of tracks after",800,-4.0,4.0,400,0.,10.);\r
+    fHistograms->Add(hTrackDCAxyPtafter); \r
     \r
-    hTrackDCAzafter  = new TH1F(Form("hTrackDCAz_after %s",cutName.Data()), "DCAz of tracks  after",2000,-10.0,10.0);\r
-    fHistograms->Add(hTrackDCAzafter); \r
+    hTrackDCAzPtafter  = new TH2F(Form("hTrack_DCAz_Pt_after %s",cutName.Data()), "DCAz Vs Pt of tracks  after",800,-4.0,4.0,400,0.,10.);\r
+    fHistograms->Add(hTrackDCAzPtafter); \r
+    \r
+    hTrackNFindClsPtTPCafter = new TH2F(Form("hTrack_NFindCls_Pt_TPC_after %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt after",100,0,1,400,0.,10.);\r
+    fHistograms->Add(hTrackNFindClsPtTPCafter); \r
     \r
     \r
 \r
@@ -331,6 +343,28 @@ return kTRUE;
 Bool_t AliDalitzElectronCuts::ElectronIsSelected(AliESDtrack* lTrack)\r
 {\r
     //Selection of Reconstructed electrons\r
+    \r
+    \r
+    Float_t b[2];\r
+    Float_t bCov[3];\r
+    lTrack->GetImpactParameters(b,bCov);\r
+   \r
+    if (bCov[0]<=0 || bCov[2]<=0) {\r
+       AliDebug(1, "Estimated b resolution lower or equal zero!");\r
+       bCov[0]=0; bCov[2]=0;\r
+    }\r
+    \r
+    \r
+\r
+    Float_t dcaToVertexXY = b[0];\r
+    Float_t dcaToVertexZ  = b[1];\r
+    Double_t clsToF = GetNFindableClustersTPC(lTrack);\r
+   \r
+   if( hTrackDCAxyPtbefore) hTrackDCAxyPtbefore->Fill(dcaToVertexXY,lTrack->Pt());\r
+   if( hTrackDCAzPtbefore ) hTrackDCAzPtbefore->Fill( dcaToVertexZ, lTrack->Pt());\r
+   if( hTrackNFindClsPtTPCbefore ) hTrackNFindClsPtTPCbefore->Fill( clsToF, lTrack->Pt());\r
+   \r
+   \r
 \r
     if(hCutIndex)hCutIndex->Fill(kElectronIn);\r
 \r
@@ -361,6 +395,10 @@ Bool_t AliDalitzElectronCuts::ElectronIsSelected(AliESDtrack* lTrack)
 \r
     //Electron passed the cuts\r
     if(hCutIndex)hCutIndex->Fill(kElectronOut);\r
+    \r
+    if( hTrackDCAxyPtafter)       hTrackDCAxyPtafter->Fill(dcaToVertexXY,lTrack->Pt());\r
+    if( hTrackDCAzPtafter )       hTrackDCAzPtafter->Fill(dcaToVertexZ,lTrack->Pt());\r
+    if( hTrackNFindClsPtTPCafter ) hTrackNFindClsPtTPCafter->Fill( clsToF, lTrack->Pt());\r
 \r
 \r
     return kTRUE;\r
@@ -370,25 +408,9 @@ Bool_t AliDalitzElectronCuts::ElectronIsSelected(AliESDtrack* lTrack)
 Bool_t AliDalitzElectronCuts::TrackIsSelected(AliESDtrack* lTrack) {\r
     // Track Selection for Photon Reconstruction\r
     \r
+         \r
+    Double_t clsToF = GetNFindableClustersTPC(lTrack);\r
     \r
-   Float_t b[2];\r
-   Float_t bCov[3];\r
-   lTrack->GetImpactParameters(b,bCov);\r
-   if (bCov[0]<=0 || bCov[2]<=0) {\r
-     AliDebug(1, "Estimated b resolution lower or equal zero!");\r
-     bCov[0]=0; bCov[2]=0;\r
-    }\r
-\r
-\r
-  Float_t dcaToVertexXY = b[0];\r
-  Float_t dcaToVertexZ  = b[1];\r
-   \r
-    \r
-\r
-   if( hTrackDCAxybefore) hTrackDCAxybefore->Fill(dcaToVertexXY);\r
-   if( hTrackDCAzbefore ) hTrackDCAzbefore->Fill(dcaToVertexZ);\r
-   \r
-\r
 \r
     if( ! fesdTrackCuts->AcceptTrack(lTrack) ){\r
 \r
@@ -408,37 +430,35 @@ Bool_t AliDalitzElectronCuts::TrackIsSelected(AliESDtrack* lTrack) {
        \r
    }\r
 \r
-    if( lTrack->GetNcls(1) < fMinClsTPC ) {\r
+    /*if( lTrack->GetNcls(1) < fMinClsTPC ) {\r
 \r
         return kFALSE;\r
-    }\r
+    }*/\r
 \r
-    //Findable clusters\r
+        //Findable clusters\r
 \r
-    Double_t clsToF=0;\r
+       /*Double_t clsToF=0;\r
 \r
 \r
-    if (!fUseCorrectedTPCClsInfo ){\r
-        if(lTrack->GetTPCNclsF()!=0){\r
+           if (!fUseCorrectedTPCClsInfo ){\r
+               if(lTrack->GetTPCNclsF()!=0){\r
 \r
-              clsToF = (Double_t)lTrack->GetNcls(1)/(Double_t)lTrack->GetTPCNclsF();\r
-        }// Ncluster/Nfindablecluster\r
-    }\r
-    else {\r
+               clsToF = (Double_t)lTrack->GetNcls(1)/(Double_t)lTrack->GetTPCNclsF();\r
+               }// Ncluster/Nfindablecluster\r
+           }\r
+         else {\r
 \r
               //clsToF = lTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));\r
               clsToF = lTrack->GetTPCClusterInfo(2,1); //NOTE ask friederike\r
-                \r
-    }\r
+              \r
+         }*/\r
 \r
 \r
     if( clsToF < fMinClsTPCToF){\r
     return kFALSE;\r
     }\r
 \r
-    if( hTrackDCAxyafter) hTrackDCAxyafter->Fill(dcaToVertexXY);\r
-    if( hTrackDCAzafter ) hTrackDCAzafter->Fill(dcaToVertexZ);\r
-\r
+    \r
 \r
    return kTRUE;\r
 }\r
@@ -635,6 +655,50 @@ Bool_t AliDalitzElectronCuts::RejectSharedElecGamma(TList *photons, Int_t indexE
 \r
    return kTRUE;\r
 }\r
+Bool_t AliDalitzElectronCuts::MassCut(Double_t pi0CandidatePt , Double_t vphotonCandidateMass){\r
+  \r
+       if( pi0CandidatePt < fMassCutPtMin ){\r
+         \r
+             if( vphotonCandidateMass < fMassCutLowPt ){\r
+                   return kTRUE;\r
+             }\r
+               \r
+       }\r
+       else{\r
+         \r
+              if( vphotonCandidateMass < fMassCutHighPt ){\r
+                   return kTRUE;\r
+              }\r
+             \r
+       }\r
+       \r
+       return kFALSE;\r
+         \r
+}\r
+\r
+Double_t AliDalitzElectronCuts::GetNFindableClustersTPC(AliESDtrack* lTrack){\r
+  \r
+  \r
+  Double_t clsToF=0;\r
+\r
+\r
+    if ( !fUseCorrectedTPCClsInfo ){\r
+        if(lTrack->GetTPCNclsF()!=0){\r
+\r
+              clsToF = (Double_t)lTrack->GetNcls(1)/(Double_t)lTrack->GetTPCNclsF();\r
+        }// Ncluster/Nfindablecluster\r
+    }\r
+    else {\r
+\r
+              //clsToF = lTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));\r
+              clsToF = lTrack->GetTPCClusterInfo(2,1); //NOTE ask friederike\r
+                \r
+    }\r
+  \r
+  return clsToF;\r
+   \r
+}\r
+\r
 /*\r
 Double_t AliDalitzElectronCuts::GetPsiPair( const AliESDtrack *trackPos, const AliESDtrack *trackNeg )\r
 {\r
@@ -1130,32 +1194,50 @@ Bool_t AliDalitzElectronCuts::SetTPCClusterCut(Int_t clsTPCCut)
        switch(clsTPCCut){\r
        case 0: // 0\r
                fMinClsTPC= 0.;\r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                break;\r
        case 1:  // 70\r
                fMinClsTPC= 70.;\r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                break;\r
        case 2:  // 80\r
                fMinClsTPC= 80.;\r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                break;\r
        case 3:  // 100\r
                fMinClsTPC= 100.;\r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                break;\r
        case 4:  // 0% of findable clusters\r
+               fMinClsTPC= 70.;  \r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                fMinClsTPCToF= 0.0;\r
                fUseCorrectedTPCClsInfo=0;\r
                break;\r
        case 5:  // 35% of findable clusters\r
+               fMinClsTPC = 70.;  \r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                fMinClsTPCToF= 0.35;\r
                fUseCorrectedTPCClsInfo=0;\r
                break;\r
        case 6:  // 60% of findable clusters\r
+               fMinClsTPC= 70.;  \r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                fMinClsTPCToF= 0.6;\r
                fUseCorrectedTPCClsInfo=0;\r
                break;\r
        case 7:  // 70% of findable clusters\r
+               fMinClsTPC= 70.;  \r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
                fMinClsTPCToF= 0.7;\r
                fUseCorrectedTPCClsInfo=0;\r
                break;\r
+       case 8: fMinClsTPC = 0.;  \r
+               fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
+               fMinClsTPCToF= 0.35;\r
+               fUseCorrectedTPCClsInfo=0;\r
+               break;\r
+         \r
        default:\r
                cout<<"Warning: clsTPCCut not defined "<<clsTPCCut<<endl;\r
                return kFALSE;\r
@@ -1461,6 +1543,13 @@ Bool_t AliDalitzElectronCuts::SetPsiPairCut(Int_t psiCut) {
         fDeltaPhiCutMin = 0.;\r
         fDeltaPhiCutMax = 0.12;\r
         break;\r
+  case 2:\r
+       fDoPsiPairCut = kTRUE;\r
+        fPsiPairCut = 0.60; \r
+        fDeltaPhiCutMin = 0.;\r
+        fDeltaPhiCutMax = 0.12;\r
+        break;\r
+    \r
   default:\r
       cout<<"Warning: PsiPairCut not defined "<<fPsiPairCut<<endl;\r
       return kFALSE;\r
@@ -1589,32 +1678,61 @@ Bool_t AliDalitzElectronCuts::SetMassCut(Int_t massCut)
     switch(massCut){\r
       \r
     case 0:\r
-         fMassCut = 999.;\r
-         fDoMassCut = kFALSE;   \r
-        break;\r
+                       \r
+                       fMassCutPtMin  = -999.; //GeV\r
+                       fMassCutLowPt  =  999.; //GeV/c^2\r
+                       fMassCutHighPt =  999.; //GeV/c^2\r
+                       fDoMassCut = kFALSE;   \r
+                       break;\r
     case 1:\r
-         fMassCut = 0.135;      //GeV/c^2\r
-         fDoMassCut = kTRUE;\r
-        break; \r
+                       //fMassCut = 0.135;             //GeV/c^2\r
+                       fMassCutPtMin  = -999.; //GeV\r
+                       fMassCutLowPt  = 0.135; //GeV/c^2\r
+                       fMassCutHighPt = 0.135; //GeV/c^2\r
+                       fDoMassCut = kTRUE;\r
+                       break; \r
     case 2:\r
-         fMassCut = 0.100;    //GeV/c^2\r
-         fDoMassCut = kTRUE;\r
-         break;\r
+                       //fMassCut = 0.100;     //GeV/c^2\r
+                       fMassCutPtMin  = -999.; //GeV\r
+                       fMassCutLowPt  = 0.100; //GeV/c^2\r
+                       fMassCutHighPt = 0.100; //GeV/c^2\r
+                       fDoMassCut = kTRUE;\r
+                       break;\r
     case 3:\r
-         fMassCut = 0.075;    //GeV/c^2\r
-         fDoMassCut = kTRUE;\r
-         break;\r
+                       //fMassCut = 0.075;     //GeV/c^2\r
+                       fMassCutPtMin  = -999.; //GeV\r
+                       fMassCutLowPt  = 0.075; //GeV/c^2\r
+                       fMassCutHighPt = 0.075; //GeV/c^2\r
+                       fDoMassCut = kTRUE;\r
+                       break;\r
     case 4:\r
-         fMassCut = 0.050; //GeV/c^2\r
-         fDoMassCut = kTRUE;\r
-         break;\r
+                       //fMassCut = 0.050;     //GeV/c^2\r
+                       fMassCutPtMin  = -999.; //GeV\r
+                       fMassCutLowPt  = 0.050; //GeV/c^2\r
+                       fMassCutHighPt = 0.050; //GeV/c^2\r
+                       fDoMassCut = kTRUE;\r
+                       break;\r
     case 5:\r
-         fMassCut = 0.035; //GeV/c^2\r
-         fDoMassCut = kTRUE;\r
-         break;\r
+                       \r
+                       fMassCutPtMin  = -999.; //GeV\r
+                       fMassCutLowPt  = 0.035; //GeV/c^2\r
+                       fMassCutHighPt = 0.035; //GeV/c^2\r
+                       fDoMassCut = kTRUE;\r
+                       break;\r
+    case 6:\r
+                       fMassCutPtMin  = -999.; //GeV\r
+                       fMassCutLowPt  = 0.015; //GeV/c^2\r
+                       fMassCutHighPt = 0.015; //GeV/c^2\r
+                       fDoMassCut = kTRUE;\r
+                       break;\r
+    case 7:            fMassCutPtMin  = 1.0;   //GeV\r
+                       fMassCutLowPt  = 0.015; //GeV/c^2\r
+                       fMassCutHighPt = 0.035; //GeV/c^2\r
+                       fDoMassCut = kTRUE;\r
+                       break;\r
     default:\r
-        cout<<"Warning: MassCut not defined "<<massCut<<endl;\r
-        return kFALSE;\r
+                       cout<<"Warning: MassCut not defined "<<massCut<<endl;\r
+                       return kFALSE;\r
     }\r
     return kTRUE;\r
 }\r
index 8bd98e2..c96f1ed 100644 (file)
@@ -116,6 +116,7 @@ class AliDalitzElectronCuts : public AliAnalysisCuts {
   Bool_t PIDProbabilityCut(AliConversionPhotonBase *photon, AliVEvent * event);
   Bool_t RejectSharedElecGamma(TList *photons, Int_t indexEle);
   Bool_t IsFromGammaConversion( Double_t psiPair, Double_t deltaPhi );
+  Bool_t MassCut(Double_t pi0CandidatePt,Double_t vphotonCandidateMass);
 
   // Event Cuts
 
@@ -148,11 +149,14 @@ class AliDalitzElectronCuts : public AliAnalysisCuts {
   Double_t GetPsiPairCut(){ return fPsiPairCut; }
   Double_t DoRejectSharedElecGamma(){ return fDoRejectSharedElecGamma;}
   Double_t DoPsiPairCut(){return fDoPsiPairCut;}
+  Double_t GetNFindableClustersTPC(AliESDtrack* lTrack);
   Bool_t   UseTrackMultiplicity(){ return fUseTrackMultiplicityForBG;}
   Int_t    GetBKGMethod(){ return fBKGMethod; }
   Int_t    NumberOfRotationEvents(){return fnumberOfRotationEventsForBG;}
   Bool_t   DoMassCut(){return  fDoMassCut;}
-  Double_t GetMassCut(){return fMassCut;}
+  Double_t GetMassCutLowPt(){return fMassCutLowPt;}
+  Double_t GetMassCutHighPt(){return fMassCutHighPt;}
+  Double_t GetPtMinMassCut(){return fMassCutPtMin;}
   
 
   
@@ -204,7 +208,9 @@ class AliDalitzElectronCuts : public AliAnalysisCuts {
   Int_t    fBKGMethod;
   Int_t    fnumberOfRotationEventsForBG;
   Bool_t   fDoMassCut;
-  Double_t fMassCut;
+  Double_t fMassCutLowPt;
+  Double_t fMassCutHighPt;
+  Double_t fMassCutPtMin;
 
 
   // Histograms
@@ -219,10 +225,12 @@ class AliDalitzElectronCuts : public AliAnalysisCuts {
   TH2F *hTPCdEdxSignalafter; //TPC dEdx signal  after
   TH2F *hTOFbefore; // TOF after cuts
   TH2F *hTOFafter; // TOF after cuts
-  TH1F *hTrackDCAxybefore;
-  TH1F *hTrackDCAxyafter;
-  TH1F *hTrackDCAzbefore;
-  TH1F *hTrackDCAzafter;
+  TH2F *hTrackDCAxyPtbefore;
+  TH2F *hTrackDCAxyPtafter;
+  TH2F *hTrackDCAzPtbefore;
+  TH2F *hTrackDCAzPtafter;
+  TH2F *hTrackNFindClsPtTPCbefore;
+  TH2F *hTrackNFindClsPtTPCafter;
   
   
 
index e9a2765..c230ab7 100644 (file)
 //---------------------------------------------
 ////////////////////////////////////////////////
 
+// The AliAODConversionPhotons will return the Position (== ESDTrack->GetID())of the positive (negative) ESDTrack 
+// in the Array of ESDTracks stored in the ESDEvent via GetTrackLabelPositive() (GetTrackLabelNagative()).
+// Since it is the Position in the Array it is always positive.
+// After the conversion ESD --> AOD each AOD track will give you the former Position in the ESDArray via the
+// Function AODTrack->GetID(). AODTracks are stored for different TrackParameter (e.g. HybridTracks, TPC only ...). No Standard 
+// AODTracks (not copies of AliExternalTrackParam) will be stored with negative values of AODTrack->GetID() (Formula: (ESDTrack->GetID()+1)*-1)
+// This leads to the possibility of more than one AOD track with the same negative ID. For that reason all AOD tracks are additionally flaged.
+// In this analysis we should therefore only use AODTracks with positive values of AODTrack->GetID().
+
+// If you want to find the AODTrack corresponding to the daugher track of a AliAODConversionPhoton you have to find the AODTrack with
+// AODTrack->GetID() == GetTrackLabelPositive() (GetTrackLabelNagative()).
+
+
 #include "AliV0ReaderV1.h"
 #include "AliKFParticle.h"
 #include "AliAODv0.h"
@@ -64,113 +77,114 @@ ClassImp(AliV0ReaderV1)
 
 //________________________________________________________________________
 AliV0ReaderV1::AliV0ReaderV1(const char *name) : AliAnalysisTaskSE(name),
-    fConversionCuts(NULL),
-    fConversionGammas(NULL),
-    fUseImprovedVertex(kTRUE),
-    fUseOwnXYZCalculation(kTRUE),
-    fUseConstructGamma(kFALSE),
-    kUseAODConversionPhoton(kTRUE),
-    fCreateAOD(kFALSE),
-    fDeltaAODBranchName("GammaConv"),
-    fDeltaAODFilename("AliAODGammaConversion.root"),
-    fRelabelAODs(kFALSE),
-    fEventIsSelected(kFALSE),
-    fPeriodName("")
+   fConversionCuts(NULL),
+   fConversionGammas(NULL),
+   fUseImprovedVertex(kTRUE),
+   fUseOwnXYZCalculation(kTRUE),
+   fUseConstructGamma(kFALSE),
+   kUseAODConversionPhoton(kTRUE),
+   fCreateAOD(kFALSE),
+   fDeltaAODBranchName("GammaConv"),
+   fDeltaAODFilename("AliAODGammaConversion.root"),
+   fRelabelAODs(kFALSE),
+   fEventIsSelected(kFALSE),
+   fNumberOfPrimaryTracks(0),
+   fPeriodName("")
 {
-    // Default constructor
+   // Default constructor
 
-    DefineInput(0, TChain::Class());
+   DefineInput(0, TChain::Class());
 }
 
 //________________________________________________________________________
 AliV0ReaderV1::~AliV0ReaderV1()
 {
-    // default deconstructor
+   // default deconstructor
 
-    if(fConversionGammas){
-       fConversionGammas->Delete();// Clear Objects
-       delete fConversionGammas;
-       fConversionGammas=0x0;
-    }
+   if(fConversionGammas){
+      fConversionGammas->Delete();// Clear Objects
+      delete fConversionGammas;
+      fConversionGammas=0x0;
+   }
 }
 /*
 //________________________________________________________________________
 AliV0ReaderV1::AliV0ReaderV1(AliV0ReaderV1 &original) : AliAnalysisTaskSE(original),
-    fConversionCuts(NULL),
-    fConversionGammas(NULL),
-    fUseImprovedVertex(original.fUseImprovedVertex),
-    fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
-    fUseConstructGamma(original.fUseConstructGamma),
-    kUseAODConversionPhoton(original.kUseAODConversionPhoton),
-    fCreateAOD(original.fCreateAOD),
-    fDeltaAODBranchName(original.fDeltaAODBranchName),
-    fDeltaAODFilename(original.fDeltaAODFilename),
-    fEventIsSelected(original.fEventIsSelected)
+fConversionCuts(NULL),
+fConversionGammas(NULL),
+fUseImprovedVertex(original.fUseImprovedVertex),
+fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
+fUseConstructGamma(original.fUseConstructGamma),
+kUseAODConversionPhoton(original.kUseAODConversionPhoton),
+fCreateAOD(original.fCreateAOD),
+fDeltaAODBranchName(original.fDeltaAODBranchName),
+fDeltaAODFilename(original.fDeltaAODFilename),
+fEventIsSelected(original.fEventIsSelected)
 {
-    // Default constructor
+// Default constructor
 
-    DefineInput(0, TChain::Class());
+DefineInput(0, TChain::Class());
 }
 
 //____________________________________________________________
 AliV0ReaderV1 &AliV0ReaderV1::operator=(const AliV0ReaderV1 &ref){
-       //
-       // Assignment operator
-       // Only copies pointers, object is not the owner of the references
-       //
-    if(this != &ref){
-       AliAnalysisTaskSE::operator=(ref);
-       fUseImprovedVertex=ref.fUseImprovedVertex;
-       fUseOwnXYZCalculation=ref.fUseOwnXYZCalculation;
-       fUseConstructGamma=ref.fUseConstructGamma;
-       kUseAODConversionPhoton=ref.kUseAODConversionPhoton;
-       fCreateAOD=ref.fCreateAOD;
-       fDeltaAODBranchName=ref.fDeltaAODBranchName;
-       fDeltaAODFilename=ref.fDeltaAODFilename;
-       fEventIsSelected=ref.fEventIsSelected;
-    }
-    return *this;
+//
+// Assignment operator
+// Only copies pointers, object is not the owner of the references
+//
+if(this != &ref){
+AliAnalysisTaskSE::operator=(ref);
+fUseImprovedVertex=ref.fUseImprovedVertex;
+fUseOwnXYZCalculation=ref.fUseOwnXYZCalculation;
+fUseConstructGamma=ref.fUseConstructGamma;
+kUseAODConversionPhoton=ref.kUseAODConversionPhoton;
+fCreateAOD=ref.fCreateAOD;
+fDeltaAODBranchName=ref.fDeltaAODBranchName;
+fDeltaAODFilename=ref.fDeltaAODFilename;
+fEventIsSelected=ref.fEventIsSelected;
+}
+return *this;
 }
 */
 //________________________________________________________________________
 void AliV0ReaderV1::Init()
 {
-    // Initialize function to be called once before analysis
-    if(fConversionCuts==NULL){
-       if(fConversionCuts==NULL)AliError("No Cut Selection initialized");
-    }
-    if(fCreateAOD){kUseAODConversionPhoton=kTRUE;}
-
-    if(fConversionGammas != NULL){
-       delete fConversionGammas;
-       fConversionGammas=NULL;
-    }
-
-    if(fConversionGammas == NULL){
-       if(kUseAODConversionPhoton){
-           fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);}
-       else{
-           fConversionGammas = new TClonesArray("AliKFConversionPhoton",100);}
-    }
-    fConversionGammas->Delete();//Reset the TClonesArray
+   // Initialize function to be called once before analysis
+   if(fConversionCuts==NULL){
+      if(fConversionCuts==NULL)AliError("No Cut Selection initialized");
+   }
+   if(fCreateAOD){kUseAODConversionPhoton=kTRUE;}
+
+   if(fConversionGammas != NULL){
+      delete fConversionGammas;
+      fConversionGammas=NULL;
+   }
+
+   if(fConversionGammas == NULL){
+      if(kUseAODConversionPhoton){
+         fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);}
+      else{
+         fConversionGammas = new TClonesArray("AliKFConversionPhoton",100);}
+   }
+   fConversionGammas->Delete();//Reset the TClonesArray
 }
 
 //________________________________________________________________________
 void AliV0ReaderV1::UserCreateOutputObjects()
 {
-    // Create AODs
+   // Create AODs
 
-    if(fCreateAOD){
-       if(fConversionCuts){
-           fDeltaAODBranchName.Append("_");
-           fDeltaAODBranchName.Append(fConversionCuts->GetCutNumber());
-           fDeltaAODBranchName.Append("_gamma");
-       }
-       fConversionGammas->SetName(fDeltaAODBranchName.Data());
+   if(fCreateAOD){
+      if(fConversionCuts){
+         fDeltaAODBranchName.Append("_");
+         fDeltaAODBranchName.Append(fConversionCuts->GetCutNumber());
+         fDeltaAODBranchName.Append("_gamma");
+      }
+      fConversionGammas->SetName(fDeltaAODBranchName.Data());
 
-       AddAODBranch("TClonesArray", &fConversionGammas, fDeltaAODFilename.Data());
-       AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFilename.Data());
-    }
+      AddAODBranch("TClonesArray", &fConversionGammas, fDeltaAODFilename.Data());
+      AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFilename.Data());
+   }
 
 }
 //________________________________________________________________________
@@ -203,7 +217,7 @@ Bool_t AliV0ReaderV1::Notify()
       else{
          printf(" Gamma Conversion Reader %s :: Eta Shift Manually Set to %f \n\n",
                 (fConversionCuts->GetCutNumber()).Data(),fConversionCuts->GetEtaShift());
-         fConversionCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once   
+         fConversionCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
       }
    }
 
@@ -212,14 +226,14 @@ Bool_t AliV0ReaderV1::Notify()
 //________________________________________________________________________
 void AliV0ReaderV1::UserExec(Option_t *option){
 
-    // Check if correctly initialized
-    if(!fConversionGammas)Init();
+   // Check if correctly initialized
+   if(!fConversionGammas)Init();
 
-    // User Exec
-    fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
+   // User Exec
+   fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
 
-    // AOD Output
-    FillAODOutput();
+   // AOD Output
+   FillAODOutput();
 
 }
 
@@ -227,253 +241,260 @@ void AliV0ReaderV1::UserExec(Option_t *option){
 Bool_t AliV0ReaderV1::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
 {
 
-    //Reset the TClonesArray
-    fConversionGammas->Delete();
+   //Reset the TClonesArray
+   fConversionGammas->Delete();
 
-    fInputEvent=inputEvent;
-    fMCEvent=mcEvent;
+   fInputEvent=inputEvent;
+   fMCEvent=mcEvent;
 
-    if(!fInputEvent){
-       AliError("No Input event");
-       return kFALSE;
-    }
+   if(!fInputEvent){
+      AliError("No Input event");
+      return kFALSE;
+   }
+   if(!fConversionCuts){AliError("No ConversionCuts");return kFALSE;}
 
-    if(!fConversionCuts){AliError("No ConversionCuts");return kFALSE;}
+   // Count Primary Tracks Event
+   CountTracks();
 
-    // Event Cuts
-    if(!fConversionCuts->EventIsSelected(fInputEvent,fMCEvent))return kFALSE;
+   // Event Cuts
+   if(!fConversionCuts->EventIsSelected(fInputEvent,fMCEvent))return kFALSE;
 
-    // Set Magnetic Field
-    AliKFParticle::SetField(fInputEvent->GetMagneticField());
+   // Set Magnetic Field
+   AliKFParticle::SetField(fInputEvent->GetMagneticField());
 
-    if(fInputEvent->IsA()==AliESDEvent::Class()){
-       ProcessESDV0s();
-    }
-    if(fInputEvent->IsA()==AliAODEvent::Class()){
-       GetAODConversionGammas();
-    }
+   if(fInputEvent->IsA()==AliESDEvent::Class()){
+      ProcessESDV0s();
+   }
+   if(fInputEvent->IsA()==AliAODEvent::Class()){
+      GetAODConversionGammas();
+   }
 
-    return kTRUE;
+
+
+   return kTRUE;
 }
 ///________________________________________________________________________
 void AliV0ReaderV1::FillAODOutput()
 {
-    // Fill AOD Output with reconstructed Photons
-
-    if(fInputEvent->IsA()==AliESDEvent::Class()){
-       ///Make sure delta aod is filled if standard aod is filled (for synchronization when reading aod with standard aod)
-       if(fCreateAOD) {
-           AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
-            if (aodhandler && aodhandler->GetFillAOD()) {
-               AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
-             //PostData(0, fConversionGammas);
-
-           }
-       }
-    }
+   // Fill AOD Output with reconstructed Photons
+
+   if(fInputEvent->IsA()==AliESDEvent::Class()){
+      ///Make sure delta aod is filled if standard aod is filled (for synchronization when reading aod with standard aod)
+      if(fCreateAOD) {
+         AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
+         if (aodhandler && aodhandler->GetFillAOD()) {
+            AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
+            //PostData(0, fConversionGammas);
+
+         }
+      }
+   }
 }
 
 ///________________________________________________________________________
 const AliExternalTrackParam *AliV0ReaderV1::GetExternalTrackParam(AliESDv0 *fCurrentV0,Int_t &tracklabel,Int_t charge){
 
-    // Get External Track Parameter with given charge
-
-    if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;}
-
-    // Check for sign flip
-    if(fCurrentV0){
-       if(!fCurrentV0->GetParamN()||!fCurrentV0->GetParamP())return 0x0;
-       if(!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex())||!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))return 0x0;
-       if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==charge){
-           tracklabel=fCurrentV0->GetPindex();
-           return fCurrentV0->GetParamP();}
-       if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()==charge){
-           tracklabel=fCurrentV0->GetNindex();
-           return fCurrentV0->GetParamN();}
-    }
-    return 0x0;
+   // Get External Track Parameter with given charge
+
+   if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;}
+
+   // Check for sign flip
+   if(fCurrentV0){
+      if(!fCurrentV0->GetParamN()||!fCurrentV0->GetParamP())return 0x0;
+      if(!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex())||!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))return 0x0;
+      if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==charge){
+         tracklabel=fCurrentV0->GetPindex();
+         return fCurrentV0->GetParamP();}
+      if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()==charge){
+         tracklabel=fCurrentV0->GetNindex();
+         return fCurrentV0->GetParamN();}
+   }
+   return 0x0;
 }
 
 ///________________________________________________________________________
 Bool_t AliV0ReaderV1::ProcessESDV0s()
 {
-    // Process ESD V0s for conversion photon reconstruction
-    AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
+   // Process ESD V0s for conversion photon reconstruction
+   AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
+
+   AliKFConversionPhoton *fCurrentMotherKFCandidate=NULL;
+
+   if(fESDEvent){
+
+      for(Int_t currentV0Index=0;currentV0Index<fESDEvent->GetNumberOfV0s();currentV0Index++){
+         AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index));
+         if(!fCurrentV0){
+            printf("Requested V0 does not exist");
+            continue;
+         }
+
+         fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index);
 
-    AliKFConversionPhoton *fCurrentMotherKFCandidate=NULL;
+         if(fCurrentMotherKFCandidate){
+            // Add Gamma to the TClonesArray
 
-    if(fESDEvent){
+            if(kUseAODConversionPhoton){
+               new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(fCurrentMotherKFCandidate);
+               AliAODConversionPhoton * currentConversionPhoton = (AliAODConversionPhoton*)(fConversionGammas->At(fConversionGammas->GetEntriesFast()-1));
+               currentConversionPhoton->SetMass(fCurrentMotherKFCandidate->M());
+               currentConversionPhoton->SetMassToZero();
 
-       for(Int_t currentV0Index=0;currentV0Index<fESDEvent->GetNumberOfV0s();currentV0Index++){
-           AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index));
-           if(!fCurrentV0){
-               printf("Requested V0 does not exist");
-               continue;
+            }
+            else{
+               new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliKFConversionPhoton(*fCurrentMotherKFCandidate);
             }
 
-           fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index);
-
-           if(fCurrentMotherKFCandidate){
-               // Add Gamma to the TClonesArray
-
-               if(kUseAODConversionPhoton){
-                   new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(fCurrentMotherKFCandidate);
-                               AliAODConversionPhoton * currentConversionPhoton = (AliAODConversionPhoton*)(fConversionGammas->At(fConversionGammas->GetEntriesFast()-1));
-                               currentConversionPhoton->SetMass(fCurrentMotherKFCandidate->M());
-                               currentConversionPhoton->SetMassToZero();
-                               
-               }
-               else{
-                   new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliKFConversionPhoton(*fCurrentMotherKFCandidate);
-               }
-
-               delete fCurrentMotherKFCandidate;
-               fCurrentMotherKFCandidate=NULL;
-           }
-       }
-    }
-    return kTRUE;
+            delete fCurrentMotherKFCandidate;
+            fCurrentMotherKFCandidate=NULL;
+         }
+      }
+   }
+   return kTRUE;
 }
 
 ///________________________________________________________________________
 AliKFConversionPhoton *AliV0ReaderV1::ReconstructV0(AliESDv0 *fCurrentV0,Int_t currentV0Index)
 {
-       // Reconstruct conversion photon from ESD v0
-    fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonIn);
+   // Reconstruct conversion photon from ESD v0
+   fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonIn);
 
-    //checks if on the fly mode is set
-    if(!fConversionCuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
-       fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kOnFly);
-       return 0x0;
-    }
+   //checks if on the fly mode is set
+   if(!fConversionCuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
+      fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kOnFly);
+      return 0x0;
+   }
 
-    // TrackLabels
-    Int_t currentTrackLabels[2]={-1,-1};
+   // TrackLabels
+   Int_t currentTrackLabels[2]={-1,-1};
 
-    // Get Daughter KF Particles
+   // Get Daughter KF Particles
 
-    const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0,currentTrackLabels[0]);
-    const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0,currentTrackLabels[1]);
+   const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0,currentTrackLabels[0]);
+   const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0,currentTrackLabels[1]);
 
-    if(!fCurrentExternalTrackParamPositive||!fCurrentExternalTrackParamNegative)return 0x0;
+   if(!fCurrentExternalTrackParamPositive||!fCurrentExternalTrackParamNegative)return 0x0;
 
-    // Apply some Cuts before Reconstruction
+   // Apply some Cuts before Reconstruction
 
-    AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[0]);
-    AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[1]);
+   AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[0]);
+   AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[1]);
 
-    if(!negTrack || !posTrack) {
-       fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kNoTracks);
-       return 0x0;
-    }
+   if(!negTrack || !posTrack) {
+      fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kNoTracks);
+      return 0x0;
+   }
 
-    // Track Cuts
-    if(!fConversionCuts->TracksAreSelected(negTrack, posTrack)){
-       fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kTrackCuts);
-       return 0x0;
-    }
+   // Track Cuts
+   if(!fConversionCuts->TracksAreSelected(negTrack, posTrack)){
+      fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kTrackCuts);
+      return 0x0;
+   }
 
-    // PID Cuts
-    if(!fConversionCuts->dEdxCuts(negTrack) || !fConversionCuts->dEdxCuts(posTrack)) {
-       fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kdEdxCuts);
-       return 0x0;
-    }
+   // PID Cuts
+   if(!fConversionCuts->dEdxCuts(negTrack) || !fConversionCuts->dEdxCuts(posTrack)) {
+      fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kdEdxCuts);
+      return 0x0;
+   }
 
-    // Reconstruct Photon
+   // Reconstruct Photon
 
-    AliKFConversionPhoton *fCurrentMotherKF=NULL;
+   AliKFConversionPhoton *fCurrentMotherKF=NULL;
 
-    AliKFParticle fCurrentNegativeKFParticle(*(fCurrentExternalTrackParamNegative),11);
-    AliKFParticle fCurrentPositiveKFParticle(*(fCurrentExternalTrackParamPositive),-11);
+   AliKFParticle fCurrentNegativeKFParticle(*(fCurrentExternalTrackParamNegative),11);
+   AliKFParticle fCurrentPositiveKFParticle(*(fCurrentExternalTrackParamPositive),-11);
 
-    // Reconstruct Gamma
+   // Reconstruct Gamma
 
-    if(fUseConstructGamma){
-                       fCurrentMotherKF = new AliKFConversionPhoton();
-                       fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
-    }else{
-                       fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
-                       fCurrentMotherKF->SetMassConstraint(0,0.0001);
-    }
+   if(fUseConstructGamma){
+      fCurrentMotherKF = new AliKFConversionPhoton();
+      fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
+   }else{
+      fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
+      fCurrentMotherKF->SetMassConstraint(0,0.0001);
+   }
 
-    // Set Track Labels
+   // Set Track Labels
 
-    fCurrentMotherKF->SetTrackLabels(currentTrackLabels[0],currentTrackLabels[1]);
+   fCurrentMotherKF->SetTrackLabels(currentTrackLabels[0],currentTrackLabels[1]);
 
-    // Set V0 index
+   // Set V0 index
 
-    fCurrentMotherKF->SetV0Index(currentV0Index);
+   fCurrentMotherKF->SetV0Index(currentV0Index);
 
-    //Set MC Label
+   //Set MC Label
 
-    if(fMCEvent){
+   if(fMCEvent){
 
-       AliStack *fMCStack= fMCEvent->Stack();
+      AliStack *fMCStack= fMCEvent->Stack();
 
-       Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelPositive())->GetLabel());
-       Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelNegative())->GetLabel());
+      Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelPositive())->GetLabel());
+      Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelNegative())->GetLabel());
 
-       TParticle *fNegativeMCParticle = fMCStack->Particle(labeln);
-       TParticle *fPositiveMCParticle = fMCStack->Particle(labelp);
+      TParticle *fNegativeMCParticle = fMCStack->Particle(labeln);
+      TParticle *fPositiveMCParticle = fMCStack->Particle(labelp);
 
-       if(fPositiveMCParticle&&fNegativeMCParticle){
-           fCurrentMotherKF->SetMCLabelPositive(labelp);
-           fCurrentMotherKF->SetMCLabelNegative(labeln);
-       }
-    }
+      if(fPositiveMCParticle&&fNegativeMCParticle){
+         fCurrentMotherKF->SetMCLabelPositive(labelp);
+         fCurrentMotherKF->SetMCLabelNegative(labeln);
+      }
+   }
 
-    // Update Vertex (moved for same eta compared to old)
-    if(fUseImprovedVertex == kTRUE){
-       AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
-       primaryVertexImproved+=*fCurrentMotherKF;
-       fCurrentMotherKF->SetProductionVertex(primaryVertexImproved);
-    }
+   // Update Vertex (moved for same eta compared to old)
+   //      cout << currentV0Index <<" \t before: \t" << fCurrentMotherKF->GetPx() << "\t" << fCurrentMotherKF->GetPy() << "\t" << fCurrentMotherKF->GetPz()  << endl;
+   if(fUseImprovedVertex == kTRUE){
+      AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
+      //        cout << "Prim Vtx: " << primaryVertexImproved.GetX() << "\t" << primaryVertexImproved.GetY() << "\t" << primaryVertexImproved.GetZ() << endl;
+      primaryVertexImproved+=*fCurrentMotherKF;
+      fCurrentMotherKF->SetProductionVertex(primaryVertexImproved);
+   }
+   // SetPsiPair
 
-    // SetPsiPair
+   Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative);
+   fCurrentMotherKF->SetPsiPair(PsiPair);
 
-    Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative);
-    fCurrentMotherKF->SetPsiPair(PsiPair);
 
+   // Recalculate ConversionPoint
+   Double_t dca[2]={0,0};
+   if(fUseOwnXYZCalculation){
+      Double_t convpos[3]={0,0,0};
+      if(!GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos,dca)){
+         fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kConvPointFail);
+         delete fCurrentMotherKF;
+         fCurrentMotherKF=NULL;
+         return 0x0;
+      }
 
-    // Recalculate ConversionPoint
-    Double_t dca[2]={0,0};
-    if(fUseOwnXYZCalculation){
-       Double_t convpos[3]={0,0,0};
-       if(!GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos,dca)){
-           fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kConvPointFail);
-           delete fCurrentMotherKF;
-           fCurrentMotherKF=NULL;
-           return 0x0;
-       }
+      fCurrentMotherKF->SetConversionPoint(convpos);
+   }
 
-       fCurrentMotherKF->SetConversionPoint(convpos);
-    }
+   if(fCurrentMotherKF->GetNDF() > 0.)
+      fCurrentMotherKF->SetChi2perNDF(fCurrentMotherKF->GetChi2()/fCurrentMotherKF->GetNDF());   //->Photon is created before all chi2 relevant changes are performed, set it "by hand"
 
-    if(fCurrentMotherKF->GetNDF() > 0.)
-       fCurrentMotherKF->SetChi2perNDF(fCurrentMotherKF->GetChi2()/fCurrentMotherKF->GetNDF());   //->Photon is created before all chi2 relevant changes are performed, set it "by hand"
 
+   // Set Dilepton Mass (moved down for same eta compared to old)
+   fCurrentMotherKF->SetMass(fCurrentMotherKF->M());
 
-    // Set Dilepton Mass (moved down for same eta compared to old)
-    fCurrentMotherKF->SetMass(fCurrentMotherKF->M());
+   // Apply Photon Cuts
 
-    // Apply Photon Cuts
+   if(!fConversionCuts->PhotonCuts(fCurrentMotherKF,fInputEvent)){
+      fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonCuts);
+      delete fCurrentMotherKF;
+      fCurrentMotherKF=NULL;
+      return 0x0;
+   }
 
-    if(!fConversionCuts->PhotonCuts(fCurrentMotherKF,fInputEvent)){
-       fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonCuts);
-       delete fCurrentMotherKF;
-       fCurrentMotherKF=NULL;
-       return 0x0;
-    }
+   //     cout << currentV0Index <<" \t after: \t" <<fCurrentMotherKF->GetPx() << "\t" << fCurrentMotherKF->GetPy() << "\t" << fCurrentMotherKF->GetPz()  << endl;
 
-    fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonOut);
-    return fCurrentMotherKF;
+   fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonOut);
+   return fCurrentMotherKF;
 }
 
 ///________________________________________________________________________
 Double_t AliV0ReaderV1::GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam,const AliExternalTrackParam *negativeparam) const {
-    //
-    // Angle between daughter momentum plane and plane
-    //
+   //
+   // Angle between daughter momentum plane and plane
+   //
 
    AliExternalTrackParam nt(*negativeparam);
    AliExternalTrackParam pt(*positiveparam);
@@ -561,13 +582,13 @@ Double_t AliV0ReaderV1::GetPsiPair(const AliESDv0* v0, const AliExternalTrackPar
    nt.GetPxPyPz(momNegProp);
 
    Double_t pEle =
-       TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
+      TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
 
    Double_t pPos =
-       TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
+      TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
 
    Double_t scalarproduct =
-       momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
+      momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
 
    Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks
 
@@ -579,189 +600,189 @@ Double_t AliV0ReaderV1::GetPsiPair(const AliESDv0* v0, const AliExternalTrackPar
 ///________________________________________________________________________
 Bool_t AliV0ReaderV1::GetHelixCenter(const AliExternalTrackParam *track,Double_t center[2]){
 
-    // Get Center of the helix track parametrization
-
-    Int_t charge=track->Charge();
-    Double_t b=fInputEvent->GetMagneticField();
-
-    Double_t   helix[6];
-    track->GetHelixParameters(helix,b);
-
-    Double_t xpos =    helix[5];
-    Double_t ypos =    helix[0];
-    Double_t radius = TMath::Abs(1./helix[4]);
-    Double_t phi = helix[2];
-
-    if(phi < 0){
-       phi = phi + 2*TMath::Pi();
-    }
-
-    phi -= TMath::Pi()/2.;
-    Double_t xpoint =  radius * TMath::Cos(phi);
-    Double_t ypoint =  radius * TMath::Sin(phi);
-
-    if(b<0){
-       if(charge > 0){
-           xpoint = - xpoint;
-           ypoint = - ypoint;
-       }
-
-       if(charge < 0){
-           xpoint =    xpoint;
-           ypoint =    ypoint;
-       }
-    }
-    if(b>0){
-       if(charge > 0){
-           xpoint =    xpoint;
-           ypoint =    ypoint;
-       }
-
-       if(charge < 0){
-           xpoint = - xpoint;
-           ypoint = - ypoint;
-       }
-    }
-    center[0] =        xpos + xpoint;
-    center[1] =        ypos + ypoint;
-
-    return 1;
+   // Get Center of the helix track parametrization
+
+   Int_t charge=track->Charge();
+   Double_t b=fInputEvent->GetMagneticField();
+
+   Double_t    helix[6];
+   track->GetHelixParameters(helix,b);
+
+   Double_t xpos =     helix[5];
+   Double_t ypos =     helix[0];
+   Double_t radius = TMath::Abs(1./helix[4]);
+   Double_t phi = helix[2];
+
+   if(phi < 0){
+      phi = phi + 2*TMath::Pi();
+   }
+
+   phi -= TMath::Pi()/2.;
+   Double_t xpoint =   radius * TMath::Cos(phi);
+   Double_t ypoint =   radius * TMath::Sin(phi);
+
+   if(b<0){
+      if(charge > 0){
+         xpoint = - xpoint;
+         ypoint = - ypoint;
+      }
+
+      if(charge < 0){
+         xpoint =      xpoint;
+         ypoint =      ypoint;
+      }
+   }
+   if(b>0){
+      if(charge > 0){
+         xpoint =      xpoint;
+         ypoint =      ypoint;
+      }
+
+      if(charge < 0){
+         xpoint = - xpoint;
+         ypoint = - ypoint;
+      }
+   }
+   center[0] = xpos + xpoint;
+   center[1] = ypos + ypoint;
+
+   return 1;
 }
 ///________________________________________________________________________
 Bool_t AliV0ReaderV1::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3],Double_t dca[2]){
 
-    // Recalculate Conversion Point
+   // Recalculate Conversion Point
 
-    if(!pparam||!nparam)return kFALSE;
+   if(!pparam||!nparam)return kFALSE;
 
-    Double_t helixcenterpos[2];
-    GetHelixCenter(pparam,helixcenterpos);
+   Double_t helixcenterpos[2];
+   GetHelixCenter(pparam,helixcenterpos);
 
-    Double_t helixcenterneg[2];
-    GetHelixCenter(nparam,helixcenterneg);
+   Double_t helixcenterneg[2];
+   GetHelixCenter(nparam,helixcenterneg);
 
-       Double_t helixpos[6];
-       pparam->GetHelixParameters(helixpos,fInputEvent->GetMagneticField());
-       Double_t posradius = TMath::Abs(1./helixpos[4]);
+   Double_t helixpos[6];
+   pparam->GetHelixParameters(helixpos,fInputEvent->GetMagneticField());
+   Double_t posradius = TMath::Abs(1./helixpos[4]);
 
-       Double_t helixneg[6];
-       nparam->GetHelixParameters(helixneg,fInputEvent->GetMagneticField());
-       Double_t negradius = TMath::Abs(1./helixneg[4]);
+   Double_t helixneg[6];
+   nparam->GetHelixParameters(helixneg,fInputEvent->GetMagneticField());
+   Double_t negradius = TMath::Abs(1./helixneg[4]);
 
-        // Calculate xy-position
+   // Calculate xy-position
 
-       Double_t xpos = helixcenterpos[0];
-       Double_t ypos = helixcenterpos[1];
-       Double_t xneg = helixcenterneg[0];
-       Double_t yneg = helixcenterneg[1];
+   Double_t xpos = helixcenterpos[0];
+   Double_t ypos = helixcenterpos[1];
+   Double_t xneg = helixcenterneg[0];
+   Double_t yneg = helixcenterneg[1];
 
-       convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
-       convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
+   convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
+   convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
 
 
-       // Calculate Track XY vertex position
+   // Calculate Track XY vertex position
 
-       Double_t deltaXPos = convpos[0] -       xpos;
-       Double_t deltaYPos = convpos[1] -       ypos;
+   Double_t deltaXPos = convpos[0] -   xpos;
+   Double_t deltaYPos = convpos[1] -   ypos;
 
-       Double_t deltaXNeg = convpos[0] -       xneg;
-       Double_t deltaYNeg = convpos[1] -       yneg;
+   Double_t deltaXNeg = convpos[0] -   xneg;
+   Double_t deltaYNeg = convpos[1] -   yneg;
 
-       Double_t alphaPos =     TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
-       Double_t alphaNeg =     TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
+   Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
+   Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
 
-       Double_t vertexXNeg =   xneg +  TMath::Abs(negradius)*TMath::Cos(alphaNeg);
-       Double_t vertexYNeg =   yneg +  TMath::Abs(negradius)*TMath::Sin(alphaNeg);
+   Double_t vertexXNeg =       xneg +  TMath::Abs(negradius)*TMath::Cos(alphaNeg);
+   Double_t vertexYNeg =       yneg +  TMath::Abs(negradius)*TMath::Sin(alphaNeg);
 
-       Double_t vertexXPos =   xpos +  TMath::Abs(posradius)*TMath::Cos(alphaPos);
-       Double_t vertexYPos =   ypos +  TMath::Abs(posradius)*TMath::Sin(alphaPos);
+   Double_t vertexXPos =       xpos +  TMath::Abs(posradius)*TMath::Cos(alphaPos);
+   Double_t vertexYPos =       ypos +  TMath::Abs(posradius)*TMath::Sin(alphaPos);
 
-       AliExternalTrackParam p(*pparam);
-        AliExternalTrackParam n(*nparam);
+   AliExternalTrackParam p(*pparam);
+   AliExternalTrackParam n(*nparam);
 
-       TVector2 vertexPos(vertexXPos,vertexYPos);
-       TVector2 vertexNeg(vertexXNeg,vertexYNeg);
+   TVector2 vertexPos(vertexXPos,vertexYPos);
+   TVector2 vertexNeg(vertexXNeg,vertexYNeg);
 
-       // Convert to local coordinate system
-       TVector2 vertexPosRot=vertexPos.Rotate(-p.GetAlpha());
-       TVector2 vertexNegRot=vertexNeg.Rotate(-n.GetAlpha());
+   // Convert to local coordinate system
+   TVector2 vertexPosRot=vertexPos.Rotate(-p.GetAlpha());
+   TVector2 vertexNegRot=vertexNeg.Rotate(-n.GetAlpha());
 
-       // Propagate Track Params to Vertex
+   // Propagate Track Params to Vertex
 
-       if(!p.PropagateTo(vertexPosRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
-       if(!n.PropagateTo(vertexNegRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
+   if(!p.PropagateTo(vertexPosRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
+   if(!n.PropagateTo(vertexNegRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
 
-       // Check whether propagation was sucessful
+   // Check whether propagation was sucessful
 
-       if(TMath::Abs(vertexPos.Mod()-TMath::Sqrt(p.GetX()*p.GetX()+p.GetY()*p.GetY()))>0.01)return kFALSE;
-       if(TMath::Abs(vertexNeg.Mod()-TMath::Sqrt(n.GetX()*n.GetX()+n.GetY()*n.GetY()))>0.01)return kFALSE;
+   if(TMath::Abs(vertexPos.Mod()-TMath::Sqrt(p.GetX()*p.GetX()+p.GetY()*p.GetY()))>0.01)return kFALSE;
+   if(TMath::Abs(vertexNeg.Mod()-TMath::Sqrt(n.GetX()*n.GetX()+n.GetY()*n.GetY()))>0.01)return kFALSE;
 
-       // Calculate z position
+   // Calculate z position
 
-       convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
+   convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
 
-       // Calculate DCA
-       TVector2 vdca=vertexPos-vertexNeg;
-       dca[0]=vdca.Mod();
-       dca[1]=TMath::Abs(n.GetZ()-p.GetZ());
+   // Calculate DCA
+   TVector2 vdca=vertexPos-vertexNeg;
+   dca[0]=vdca.Mod();
+   dca[1]=TMath::Abs(n.GetZ()-p.GetZ());
 
-       return kTRUE;
+   return kTRUE;
 }
 //________________________________________________________________________
 Bool_t AliV0ReaderV1::GetAODConversionGammas(){
 
-    // Get reconstructed conversion photons from satellite AOD file
+   // Get reconstructed conversion photons from satellite AOD file
 
-    AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent);
+   AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent);
 
-    if(fAODEvent){
+   if(fAODEvent){
 
-       if(fConversionGammas == NULL){
-          fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);
-       }
-       fConversionGammas->Delete();//Reset the TClonesArray
-
-       //Get Gammas from satellite AOD gamma branch
-
-       AliAODConversionPhoton *gamma=0x0;
-
-       TClonesArray *fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));
-       if(!fInputGammas){
-           FindDeltaAODBranchName();
-           fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));}
-       if(!fInputGammas){AliError("No Gamma Satellites found");return kFALSE;}
-       // Apply Selection Cuts to Gammas and create local working copy
-       if(fInputGammas){
-           for(Int_t i=0;i<fInputGammas->GetEntriesFast();i++){
-              gamma=dynamic_cast<AliAODConversionPhoton*>(fInputGammas->At(i));
-              if(gamma){
-                 if(fRelabelAODs)RelabelAODPhotonCandidates(gamma);
-                 if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
-                    new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(*gamma);}
-              }
-           }
-       }
-    }
+      if(fConversionGammas == NULL){
+         fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);
+      }
+      fConversionGammas->Delete();//Reset the TClonesArray
+
+      //Get Gammas from satellite AOD gamma branch
+
+      AliAODConversionPhoton *gamma=0x0;
+
+      TClonesArray *fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));
+      if(!fInputGammas){
+         FindDeltaAODBranchName();
+         fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));}
+      if(!fInputGammas){AliError("No Gamma Satellites found");return kFALSE;}
+      // Apply Selection Cuts to Gammas and create local working copy
+      if(fInputGammas){
+         for(Int_t i=0;i<fInputGammas->GetEntriesFast();i++){
+            gamma=dynamic_cast<AliAODConversionPhoton*>(fInputGammas->At(i));
+            if(gamma){
+               if(fRelabelAODs)RelabelAODPhotonCandidates(gamma);
+               if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
+                  new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(*gamma);}
+            }
+         }
+      }
+   }
 
-    if(fConversionGammas->GetEntries()){return kTRUE;}
+   if(fConversionGammas->GetEntries()){return kTRUE;}
 
-    return kFALSE;
+   return kFALSE;
 }
 
 //________________________________________________________________________
 void AliV0ReaderV1::FindDeltaAODBranchName(){
 
-    // Find delta AOD branchname containing reconstructed photons
-
-    TList *list=fInputEvent->GetList();
-    for(Int_t ii=0;ii<list->GetEntries();ii++){
-       TString name((list->At(ii))->GetName());
-       if(name.BeginsWith(fDeltaAODBranchName)&&name.EndsWith("gamma")){
-           fDeltaAODBranchName=name;
-           AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
-           return;
-       }
-    }
+   // Find delta AOD branchname containing reconstructed photons
+
+   TList *list=fInputEvent->GetList();
+   for(Int_t ii=0;ii<list->GetEntries();ii++){
+      TString name((list->At(ii))->GetName());
+      if(name.BeginsWith(fDeltaAODBranchName)&&name.EndsWith("gamma")){
+         fDeltaAODBranchName=name;
+         AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
+         return;
+      }
+   }
 }
 //________________________________________________________________________
 void AliV0ReaderV1::RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate){
@@ -771,7 +792,7 @@ void AliV0ReaderV1::RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCan
    // MCLabel -> AODMCLabel
    Bool_t AODLabelPos = kFALSE;
    Bool_t AODLabelNeg = kFALSE;
-      
+
    for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
       AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
       if(!AODLabelPos){
@@ -795,7 +816,53 @@ void AliV0ReaderV1::RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCan
    if(!AODLabelPos || !AODLabelNeg){
       AliError(Form("NO AOD Daughters Found Pos: %i %i Neg: %i %i",AODLabelPos,PhotonCandidate->GetTrackLabelPositive(),AODLabelNeg,PhotonCandidate->GetTrackLabelNegative()));
    }
+
+}
+
+//________________________________________________________________________
+void AliV0ReaderV1::CountTracks(){
+
+   // In Case of MC count only MB tracks
+   // if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
+   //    fConversionCuts->GetNotRejectedParticles(1,NULL,fMCEvent);   
+   // }
+   // if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
+   //    fConversionCuts->GetNotRejectedParticles(1,NULL,fInputEvent);   
+   // }
    
+   if(fInputEvent->IsA()==AliESDEvent::Class()){
+      // Using standard function for setting Cuts
+      Bool_t selectPrimaries=kTRUE;
+      AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+      EsdTrackCuts->SetMaxDCAToVertexZ(2);
+      EsdTrackCuts->SetEtaRange(-0.8, 0.8);
+      EsdTrackCuts->SetPtRange(0.15);
+      fNumberOfPrimaryTracks = 0;
+      for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
+         AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
+         if(!curTrack) continue;
+         if(!EsdTrackCuts->AcceptTrack(curTrack)) continue;
+         //if(fMCEvent && !(fConversionCuts->IsParticleFromBGEvent(abs(curTrack->GetLabel()),fMCEvent->Stack(),fInputEvent))) continue;
+         fNumberOfPrimaryTracks++;
+      }
+      delete EsdTrackCuts;
+      EsdTrackCuts=0x0;
+   }
+   else if(fInputEvent->IsA()==AliAODEvent::Class()){
+      fNumberOfPrimaryTracks = 0;
+      for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
+         AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
+         if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
+         if(!curTrack->IsPrimaryCandidate()) continue;
+         if(abs(curTrack->Eta())>0.8) continue;
+         if(curTrack->Pt()<0.15) continue;
+         //if(fMCEvent && !(fConversionCuts->IsParticleFromBGEvent(abs(curTrack->GetLabel()),NULL,fInputEvent))) continue;
+         //if(abs(curTrack->ZAtDCA())>2) continue; // Only Set For TPCOnly tracks
+         fNumberOfPrimaryTracks++;
+      }
+   }
+
+   return;
 }
 
 //________________________________________________________________________
index 9d7feeb..e920628 100644 (file)
@@ -52,6 +52,7 @@ class AliV0ReaderV1 : public AliAnalysisTaskSE {
   TList *GetCutHistograms(){if(fConversionCuts){return fConversionCuts->GetCutHistograms();}return NULL;}
   // Set Options
 
+  void CountTracks();
   void SetConversionCuts(const TString cut);
   void SetConversionCuts(AliConversionCuts *cuts){fConversionCuts=cuts;}
   void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
@@ -64,6 +65,7 @@ class AliV0ReaderV1 : public AliAnalysisTaskSE {
   Bool_t AreAODsRelabeled(){return fRelabelAODs;}
   void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate);
   TString GetPeriodName(){return fPeriodName;}
+  Int_t GetNumberOfPrimaryTracks(){return fNumberOfPrimaryTracks;}
   
 protected:
     // Reconstruct Gammas
@@ -98,6 +100,7 @@ protected:
     TString fDeltaAODFilename; // set filename for delta/satellite aod
     Bool_t fRelabelAODs; //
     Bool_t fEventIsSelected;
+    Int_t fNumberOfPrimaryTracks; // Number of Primary Tracks in AOD or ESD
     TString fPeriodName;
     
 private:
index 4d08f17..2ee78e2 100644 (file)
@@ -26,15 +26,15 @@ AliAnalysisTask *AddTask_ConversionAODProduction(Int_t dataset=0, Bool_t isMC =
      // Old cut string, no longer compatible with AliConversionCuts
      // analysiscut="900177009350113211200001000000000";
      // New cut string as of April 2013
-       analysiscut= "1000000060084000001500000";
-       analysiscutB="1000000160084000001500000";
+       analysiscut= "100000006008400000150000000";
+       analysiscutB="100000016008400000150000000";
     } else if (dataset == 2){
-       analysiscut= "8000000060084000001500000";
-       analysiscutB="8000000160084000001500000";
+       analysiscut= "800000006008400000150000000";
+       analysiscutB="800000016008400000150000000";
     } else{
       // analysiscut="
-       analysiscut ="0000000060084001001500000";
-       analysiscutB="0000000160084001001500000";
+       analysiscut ="000000006008400100150000000";
+       analysiscutB="000000016008400100150000000";
     }
 
     //========= Add V0 Reader to  ANALYSIS manager =====
index fec5522..a0d9ab2 100644 (file)
@@ -1,5 +1,5 @@
 
-void AddTask_GammaConvV1(TString trainConfig = "pp",   Bool_t isMC     = kFALSE, UInt_t triggerMaskpPb = AliVEvent::kINT7 ){
+void AddTask_GammaConvV1(TString trainConfig = "pp",   Bool_t isMC     = kFALSE, UInt_t triggerMaskpPb = AliVEvent::kINT7){
 
    gSystem->Load("libCore.so");  
    gSystem->Load("libTree.so");
index ac7b9e5..c4571e4 100644 (file)
@@ -43,7 +43,7 @@ void AddTask_GammaConvV1_PbPb(  Int_t trainConfig = 1,  //change different set o
    }
    
    //=========  Set Cutnumber for V0Reader ================================
-   TString cutnumber = "1000000000084001001500000"; 
+   TString cutnumber = "100000000008400100150000000"; 
    AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
    //========= Add V0 Reader to  ANALYSIS manager if not yet existent =====
    if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
@@ -96,52 +96,61 @@ void AddTask_GammaConvV1_PbPb(  Int_t trainConfig = 1,  //change different set o
    TString *cutarray = new TString[numberOfCuts];
    TString *mesonCutArray = new TString[numberOfCuts];
 
-   if(trainConfig == 1){ // Standard neutral pion cuts
-      cutarray[ 0] = "3010001042092970023220000"; mesonCutArray[ 0] = "01522045009"; // 0-5%
-      cutarray[ 1] = "3120001042092970023220000"; mesonCutArray[ 1] = "01522045009"; // 5-10%
-      cutarray[ 2] = "1010001042092970023220000"; mesonCutArray[ 2] = "01522045009"; // 0-10%
-      cutarray[ 3] = "1120001042092970023220000"; mesonCutArray[ 3] = "01522045009"; // 10-20%
+   if (trainConfig == 1){ // Standard neutral pion cuts
+      cutarray[ 0] = "301000104209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
+      cutarray[ 1] = "312000104209297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
+      cutarray[ 2] = "101000104209297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
+      cutarray[ 3] = "112000104209297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
    } else if (trainConfig == 2) { // Standard neutral pion cuts
-      cutarray[ 0] = "1240001042092970023220000"; mesonCutArray[ 0] = "01522045009"; // 20-40%
-      cutarray[ 1] = "1460001042092970023220000"; mesonCutArray[ 1] = "01522065009"; // 40-60%
-      cutarray[ 2] = "1680001042092970023220000"; mesonCutArray[ 2] = "01522065009"; // 60-80%
-      cutarray[ 3] = "1080001042092970023220000"; mesonCutArray[ 3] = "01522065009"; // 0-80%
+      cutarray[ 0] = "124000104209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
+      cutarray[ 1] = "146000104209297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
+      cutarray[ 2] = "168000104209297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
+      cutarray[ 3] = "108000104209297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 0-80%
    } else if (trainConfig == 3) { // Standard direct photon cuts
-      cutarray[ 0] = "1020001042092370023700000"; mesonCutArray[ 0] = "01522045009"; // 0-20%
-      cutarray[ 1] = "1040001042092370023700000"; mesonCutArray[ 1] = "01522045009"; // 0-40%
-      cutarray[ 2] = "1480001042092370023700000"; mesonCutArray[ 2] = "01522065009"; // 40-80%
-      cutarray[ 3] = "1080001042092370023700000"; mesonCutArray[ 3] = "01522045009"; // 0-80%
+      cutarray[ 0] = "102000104209237002370000000"; mesonCutArray[ 0] = "01522045009000"; // 0-20%
+      cutarray[ 1] = "104000104209237002370000000"; mesonCutArray[ 1] = "01522045009000"; // 0-40%
+      cutarray[ 2] = "148000104209237002370000000"; mesonCutArray[ 2] = "01522065009000"; // 40-80%
+      cutarray[ 3] = "108000104209237002370000000"; mesonCutArray[ 3] = "01522045009000"; // 0-80%
    } else if (trainConfig == 4) { // Standard direct photon cuts
-      cutarray[ 0] = "1010001042092370023700000"; mesonCutArray[ 0] = "01522045009"; // 0-10%
-      cutarray[ 1] = "1120001042092370023700000"; mesonCutArray[ 1] = "01522045009"; // 10-20%
-      cutarray[ 2] = "1240001042092370023700000"; mesonCutArray[ 2] = "01522045009"; // 20-40%
-      cutarray[ 3] = "1090001042092370023700000"; mesonCutArray[ 3] = "01522045009"; // 0-90%
+      cutarray[ 0] = "101000104209237002370000000"; mesonCutArray[ 0] = "01522045009000"; // 0-10%
+      cutarray[ 1] = "112000104209237002370000000"; mesonCutArray[ 1] = "01522045009000"; // 10-20%
+      cutarray[ 2] = "124000104209237002370000000"; mesonCutArray[ 2] = "01522045009000"; // 20-40%
+      cutarray[ 3] = "109000104209237002370000000"; mesonCutArray[ 3] = "01522045009000"; // 0-90%
    } else if (trainConfig == 5) { // Standard neutral pion cuts only added signals
-      cutarray[ 0] = "3010002042092970023220000"; mesonCutArray[ 0] = "01522045009"; // 0-5%
-      cutarray[ 1] = "3120002042092970023220000"; mesonCutArray[ 1] = "01522045009"; // 5-10%
-      cutarray[ 2] = "1010002042092970023220000"; mesonCutArray[ 2] = "01522045009"; // 0-10%
-      cutarray[ 3] = "1120002042092970023220000"; mesonCutArray[ 3] = "01522045009"; // 10-20%
+      cutarray[ 0] = "301000204209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
+      cutarray[ 1] = "312000204209297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
+      cutarray[ 2] = "101000204209297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
+      cutarray[ 3] = "112000204209297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
    } else if (trainConfig == 6) { // Standard neutral pion cuts only added signals
-      cutarray[ 0] = "1240002042092970023220000"; mesonCutArray[ 0] = "01522045009"; // 20-40%
-      cutarray[ 1] = "1460002042092970023220000"; mesonCutArray[ 1] = "01522065009"; // 40-60%
-      cutarray[ 2] = "1680002042092970023220000"; mesonCutArray[ 2] = "01522065009"; // 60-80%
-      cutarray[ 3] = "1080002042092970023220000"; mesonCutArray[ 3] = "01522065009"; // 0-80%
+      cutarray[ 0] = "124000204209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
+      cutarray[ 1] = "146000204209297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
+      cutarray[ 2] = "168000204209297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
+      cutarray[ 3] = "108000204209297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 0-80%
    } else if (trainConfig == 7) { // Standard direct photon cuts
-      cutarray[ 0] = "1020003042092370023700000"; mesonCutArray[ 0] = "01522045009"; // 0-20%
-      cutarray[ 1] = "1040003042092370023700000"; mesonCutArray[ 1] = "01522045009"; // 0-40%
-      cutarray[ 2] = "1480003042092370023700000"; mesonCutArray[ 2] = "01522065009"; // 40-80%
-      cutarray[ 3] = "1080003042092370023700000"; mesonCutArray[ 3] = "01522045009"; // 0-80%
+      cutarray[ 0] = "102000304209237002370000000"; mesonCutArray[ 0] = "01522045009000"; // 0-20%
+      cutarray[ 1] = "104000304209237002370000000"; mesonCutArray[ 1] = "01522045009000"; // 0-40%
+      cutarray[ 2] = "148000304209237002370000000"; mesonCutArray[ 2] = "01522065009000"; // 40-80%
+      cutarray[ 3] = "108000304209237002370000000"; mesonCutArray[ 3] = "01522045009000"; // 0-80%
    } else if (trainConfig == 8) { // Standard direct photon cuts
-      cutarray[ 0] = "1010003042092370023700000"; mesonCutArray[ 0] = "01522045009"; // 0-10%
-      cutarray[ 1] = "1120003042092370023700000"; mesonCutArray[ 1] = "01522045009"; // 10-20%
-      cutarray[ 2] = "1240003042092370023700000"; mesonCutArray[ 2] = "01522045009"; // 20-40%
-      cutarray[ 3] = "1090003042092370023700000"; mesonCutArray[ 3] = "01522045009"; // 0-90%
+      cutarray[ 0] = "101000304209237002370000000"; mesonCutArray[ 0] = "01522045009000"; // 0-10%
+      cutarray[ 1] = "112000304209237002370000000"; mesonCutArray[ 1] = "01522045009000"; // 10-20%
+      cutarray[ 2] = "124000304209237002370000000"; mesonCutArray[ 2] = "01522045009000"; // 20-40%
+      cutarray[ 3] = "109000304209237002370000000"; mesonCutArray[ 3] = "01522045009000"; // 0-90%
    } else if(trainConfig == 9){ // Different trigger conditions
-      cutarray[ 0] = "3010001042092970023220000"; mesonCutArray[ 0] = "01522045009"; // 0-5%
-      cutarray[ 1] = "3014001042092970023220000"; mesonCutArray[ 1] = "01522045009"; // 0-5% kMB
-      cutarray[ 2] = "3015001042092970023220000"; mesonCutArray[ 2] = "01522045009"; // 0-5% kSemiCentral
-      cutarray[ 3] = "3016001042092970023220000"; mesonCutArray[ 3] = "01522045009"; // 0-5% kCentral
-      
+      cutarray[ 0] = "301000104209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
+      cutarray[ 1] = "301400104209297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 0-5% kMB
+      cutarray[ 2] = "301500104209297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-5% kSemiCentral
+      cutarray[ 3] = "301600104209297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 0-5% kCentral
+   } else if (trainConfig == 10) { // Standard direct photon cuts
+      cutarray[ 0] = "102000204209237002370000000"; mesonCutArray[ 0] = "01522045009000"; // 0-20%
+      cutarray[ 1] = "104000204209237002370000000"; mesonCutArray[ 1] = "01522045009000"; // 0-40%
+      cutarray[ 2] = "148000204209237002370000000"; mesonCutArray[ 2] = "01522065009000"; // 40-80%
+      cutarray[ 3] = "108000204209237002370000000"; mesonCutArray[ 3] = "01522045009000"; // 0-80%
+   } else if (trainConfig == 11) { // Standard direct photon cuts
+      cutarray[ 0] = "101000204209237002370000000"; mesonCutArray[ 0] = "01522045009000"; // 0-10%
+      cutarray[ 1] = "112000204209237002370000000"; mesonCutArray[ 1] = "01522045009000"; // 10-20%
+      cutarray[ 2] = "124000204209237002370000000"; mesonCutArray[ 2] = "01522045009000"; // 20-40%
+      cutarray[ 3] = "109000204209237002370000000"; mesonCutArray[ 3] = "01522045009000"; // 0-90%   
    } else {
       Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
       return;
index f244ac1..b084ec5 100644 (file)
@@ -42,7 +42,7 @@ void AddTask_GammaConvV1_pPb(  Int_t trainConfig = 1,  //change different set of
    }
    
    //=========  Set Cutnumber for V0Reader ================================
-   TString cutnumber = "8000000060084001001500000"; 
+   TString cutnumber = "800000006008400100150000000"; 
    Bool_t doEtaShift = kFALSE;
    AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
    //========= Add V0 Reader to  ANALYSIS manager if not yet existent =====
@@ -102,41 +102,41 @@ void AddTask_GammaConvV1_pPb(  Int_t trainConfig = 1,  //change different set of
       // Shifting in pPb direction
       doEtaShiftIndCuts = kTRUE;
       stringShift = "pPb";
-      cutarray[ 0] = "8000000080093172003290000"; mesonCutArray[ 0] = "01629045000";  //standard cut Pi0 pPb RCut Changed
-      cutarray[ 1] = "8000000081093172003290000"; mesonCutArray[ 1] = "01629045000";  //standard cut Pi0 pPb RCut Changed
-      cutarray[ 2] = "8000000083093172003290000"; mesonCutArray[ 2] = "01629045000";  //standard cut Pi0 pPb RCut Changed
-      cutarray[ 3] = "8000000084093172003290000"; mesonCutArray[ 3] = "01629045000";  //standard cut Pi0 pPb RCut Changed
-      cutarray[ 4] = "8000000085093172003290000"; mesonCutArray[ 4] = "01629045000";  //standard cut Pi0 pPb RCut Changed
-      cutarray[ 5] = "8000000086093172003290000"; mesonCutArray[ 5] = "01629045000";  //standard cut Pi0 pPb RCut Changed
+      cutarray[ 0] = "800000008009317200329000000"; mesonCutArray[ 0] = "01629045000000";  //standard cut Pi0 pPb RCut Changed
+      cutarray[ 1] = "800000008109317200329000000"; mesonCutArray[ 1] = "01629045000000";  //standard cut Pi0 pPb RCut Changed
+      cutarray[ 2] = "800000008309317200329000000"; mesonCutArray[ 2] = "01629045000000";  //standard cut Pi0 pPb RCut Changed
+      cutarray[ 3] = "800000008409317200329000000"; mesonCutArray[ 3] = "01629045000000";  //standard cut Pi0 pPb RCut Changed
+      cutarray[ 4] = "800000008509317200329000000"; mesonCutArray[ 4] = "01629045000000";  //standard cut Pi0 pPb RCut Changed
+      cutarray[ 5] = "800000008609317200329000000"; mesonCutArray[ 5] = "01629045000000";  //standard cut Pi0 pPb RCut Changed
    } else if (trainConfig == 2) { 
       doEtaShiftIndCuts = kTRUE;
       stringShift = "pPb";
-      cutarray[ 0] = "8000000082193172003290000"; mesonCutArray[ 0] = "01629045000";  //standard cut Pi0 pPb Single pT Cut changed
-      cutarray[ 1] = "8000000082293172003290000"; mesonCutArray[ 1] = "01629045000";  //standard cut Pi0 pPb Single pT Cut changed
-      cutarray[ 2] = "8000000082493172003290000"; mesonCutArray[ 2] = "01629045000";  //standard cut Pi0 pPb Single pT Cut changed
-      cutarray[ 3] = "8000000082693172003290000"; mesonCutArray[ 3] = "01629045000";  //standard cut Pi0 pPb Single pT Cut changed
-      cutarray[ 4] = "8000000082793172003290000"; mesonCutArray[ 4] = "01629045000";  //standard cut Pi0 pPb Single pT Cut changed
-      cutarray[ 5] = "8000000082593172003290000"; mesonCutArray[ 5] = "01629045000";  //standard cut Pi0 pPb Single pT Cut changed
+      cutarray[ 0] = "800000008219317200329000000"; mesonCutArray[ 0] = "01629045000000";  //standard cut Pi0 pPb Single pT Cut changed
+      cutarray[ 1] = "800000008229317200329000000"; mesonCutArray[ 1] = "01629045000000";  //standard cut Pi0 pPb Single pT Cut changed
+      cutarray[ 2] = "800000008249317200329000000"; mesonCutArray[ 2] = "01629045000000";  //standard cut Pi0 pPb Single pT Cut changed
+      cutarray[ 3] = "800000008269317200329000000"; mesonCutArray[ 3] = "01629045000000";  //standard cut Pi0 pPb Single pT Cut changed
+      cutarray[ 4] = "800000008279317200329000000"; mesonCutArray[ 4] = "01629045000000";  //standard cut Pi0 pPb Single pT Cut changed
+      cutarray[ 5] = "800000008259317200329000000"; mesonCutArray[ 5] = "01629045000000";  //standard cut Pi0 pPb Single pT Cut changed
    } else if (trainConfig == 3) { 
       doEtaShiftIndCuts = kTRUE;
       stringShift = "pPb";
-      cutarray[ 0] = "8000000082090172003290000"; mesonCutArray[ 0] = "01629045000";  //standard cut Pi0 pPb dedx electron Cut changed
-      cutarray[ 1] = "8000000082091172003290000"; mesonCutArray[ 1] = "01629045000";  //standard cut Pi0 pPb  dedx electron Cut changed
-      cutarray[ 2] = "8000000082092172003290000"; mesonCutArray[ 2] = "01629045000";  //standard cut Pi0 pPb  dedx electron Cut changed
-      cutarray[ 3] = "8000000082094172003290000"; mesonCutArray[ 3] = "01629045000";  //standard cut Pi0 pPb  dedx electron Cut changed
-      cutarray[ 4] = "8000000082095172003290000"; mesonCutArray[ 4] = "01629045000";  //standard cut Pi0 pPb  dedx electron Cut changed
-      cutarray[ 5] = "8000000082096172003290000"; mesonCutArray[ 5] = "01629045000";  //standard cut Pi0 pPb  dedx electron Cut changed
+      cutarray[ 0] = "800000008209017200329000000"; mesonCutArray[ 0] = "01629045000000";  //standard cut Pi0 pPb dedx electron Cut changed
+      cutarray[ 1] = "800000008209117200329000000"; mesonCutArray[ 1] = "01629045000000";  //standard cut Pi0 pPb  dedx electron Cut changed
+      cutarray[ 2] = "800000008209217200329000000"; mesonCutArray[ 2] = "01629045000000";  //standard cut Pi0 pPb  dedx electron Cut changed
+      cutarray[ 3] = "800000008209417200329000000"; mesonCutArray[ 3] = "01629045000000";  //standard cut Pi0 pPb  dedx electron Cut changed
+      cutarray[ 4] = "800000008209517200329000000"; mesonCutArray[ 4] = "01629045000000";  //standard cut Pi0 pPb  dedx electron Cut changed
+      cutarray[ 5] = "800000008209617200329000000"; mesonCutArray[ 5] = "01629045000000";  //standard cut Pi0 pPb  dedx electron Cut changed
 
 
    } else if (trainConfig == 4) { 
       doEtaShiftIndCuts = kTRUE;
       stringShift = "pPb";
-      cutarray[ 0] = "8000000082093162003290000"; mesonCutArray[ 0] = "01629045000";  //standard cut Pi0 pPb dedx Pion Line changed
-      cutarray[ 1] = "8000000082093102003290000"; mesonCutArray[ 1] = "01629045000";  //standard cut Pi0 pPb dedx Pion Line changed
-      cutarray[ 2] = "8000000082093174003290000"; mesonCutArray[ 2] = "01629045000";  //standard cut Pi0 pPb dedx Pion Line changed
-      cutarray[ 3] = "8000000082093173003290000"; mesonCutArray[ 3] = "01629045000";  //standard cut Pi0 pPb dedx Pion Line changed
-      cutarray[ 4] = "8000000082093572003290000"; mesonCutArray[ 4] = "01629045000";  //standard cut Pi0 pPb dedx Pion Line changed
-      cutarray[ 5] = "8000000082093072003290000"; mesonCutArray[ 5] = "01629045000";  //standard cut Pi0 pPb dedx Pion Line changed
+      cutarray[ 0] = "800000008209316200329000000"; mesonCutArray[ 0] = "01629045000000";  //standard cut Pi0 pPb dedx Pion Line changed
+      cutarray[ 1] = "800000008209310200329000000"; mesonCutArray[ 1] = "01629045000000";  //standard cut Pi0 pPb dedx Pion Line changed
+      cutarray[ 2] = "800000008209317400329000000"; mesonCutArray[ 2] = "01629045000000";  //standard cut Pi0 pPb dedx Pion Line changed
+      cutarray[ 3] = "800000008209317300329000000"; mesonCutArray[ 3] = "01629045000000";  //standard cut Pi0 pPb dedx Pion Line changed
+      cutarray[ 4] = "800000008209357200329000000"; mesonCutArray[ 4] = "01629045000000";  //standard cut Pi0 pPb dedx Pion Line changed
+      cutarray[ 5] = "800000008209307200329000000"; mesonCutArray[ 5] = "01629045000000";  //standard cut Pi0 pPb dedx Pion Line changed
    } else {
       Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
       return;
index 6d95a52..6cfbc85 100644 (file)
@@ -42,7 +42,7 @@ void AddTask_GammaConvV1_pp(  Int_t trainConfig = 1,  //change different set of
    }
    
    //=========  Set Cutnumber for V0Reader ================================
-   TString cutnumber = "0000000002084000002200000"; 
+   TString cutnumber = "000000000208400000220000000"; 
    AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
    
    //========= Add V0 Reader to  ANALYSIS manager if not yet existent =====
@@ -96,20 +96,20 @@ void AddTask_GammaConvV1_pp(  Int_t trainConfig = 1,  //change different set of
    TString *mesonCutArray = new TString[numberOfCuts];
 
    if(trainConfig == 1){
-      cutarray[ 0] = "0000012002093663003800000"; mesonCutArray[0] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD , only boxes
-      cutarray[ 1] = "0001012002093663003800000"; mesonCutArray[1] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND , only boxes
-      cutarray[ 2] = "0000012002093260003800000"; mesonCutArray[2] = "01631031009"; //standard cut Gamma pp 2-76TeV , only boxes
-      cutarray[ 3] = "0000012002093260003800000"; mesonCutArray[3] = "01631031009"; //standard cut Gamma pp 2-76TeV , only boxes
+      cutarray[ 0] = "000001200209366300380000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , only boxes
+      cutarray[ 1] = "000101200209366300380000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND , only boxes
+      cutarray[ 2] = "000001200209326000380000000"; mesonCutArray[2] = "01631031009000"; //standard cut Gamma pp 2-76TeV , only boxes
+      cutarray[ 3] = "000001200209326000380000000"; mesonCutArray[3] = "01631031009000"; //standard cut Gamma pp 2-76TeV , only boxes
    } else if (trainConfig == 2) {
-      cutarray[ 0] = "0000011002093663003800000"; mesonCutArray[0] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD , only Minbias MC
-      cutarray[ 1] = "0001011002093663003800000"; mesonCutArray[1] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND
-      cutarray[ 2] = "0000011002093260003800000"; mesonCutArray[2] = "01631031009"; //standard cut Gamma pp 2-76TeV
-      cutarray[ 3] = "0000011002093260003800000"; mesonCutArray[3] = "01631031009"; //standard cut Gamma pp 2-76TeV , only boxes
+      cutarray[ 0] = "000001100209366300380000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , only Minbias MC
+      cutarray[ 1] = "000101100209366300380000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND
+      cutarray[ 2] = "000001100209326000380000000"; mesonCutArray[2] = "01631031009000"; //standard cut Gamma pp 2-76TeV
+      cutarray[ 3] = "000001100209326000380000000"; mesonCutArray[3] = "01631031009000"; //standard cut Gamma pp 2-76TeV , only boxes
    } else if (trainConfig == 3) {
-      cutarray[ 0] = "0002011002093663003800000"; mesonCutArray[0] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
-      cutarray[ 1] = "0003011002093663003800000"; mesonCutArray[1] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
-      cutarray[ 2] = "0002012002093663003800000"; mesonCutArray[2] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
-      cutarray[ 3] = "0003012002093663003800000"; mesonCutArray[3] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
+      cutarray[ 0] = "000201100209366300380000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
+      cutarray[ 1] = "000301100209366300380000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
+      cutarray[ 2] = "000201200209366300380000000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
+      cutarray[ 3] = "000301200209366300380000000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
    } else {
       Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
       return;