bugs corrected
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Nov 2008 09:09:17 +0000 (09:09 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Nov 2008 09:09:17 +0000 (09:09 +0000)
PWG4/PartCorr/AliAnalysisTaskGammaConversion.cxx
PWG4/PartCorr/AliGammaConversionHistograms.cxx
PWG4/PartCorr/AliGammaConversionHistograms.h
PWG4/PartCorr/AliV0Reader.cxx
PWG4/PartCorr/AliV0Reader.h
PWG4/macros/ConfigGammaConversion.C

index ff6d6fd..f6edf1f 100644 (file)
@@ -124,6 +124,7 @@ AliAnalysisTaskGammaConversion::~AliAnalysisTaskGammaConversion()
 void AliAnalysisTaskGammaConversion::Init()\r
 {\r
   // Initialization\r
+  AliLog::SetGlobalLogLevel(AliLog::kError);\r
 }\r
 \r
 \r
@@ -216,10 +217,26 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
          fHistograms->FillHistogram("MC_Gamma_Phi", tmpPhi);\r
 \r
          //adding the conversion points from all gammas with e+e- daughters\r
-         if(particle->GetNDaughters() == 2){\r
-           TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter());\r
-           TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter());\r
+         if(particle->GetNDaughters() >= 2){\r
+           TParticle* daughter0 = NULL;\r
+           TParticle* daughter1 = NULL;\r
            \r
+           for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){\r
+             TParticle *tmpDaughter = fStack->Particle(daughterIndex);\r
+             if(tmpDaughter->GetUniqueID() == 5){\r
+               if(tmpDaughter->GetPdgCode() == 11){\r
+                  daughter0 = tmpDaughter;\r
+               }\r
+               else if(tmpDaughter->GetPdgCode() == -11){\r
+                 daughter1 = tmpDaughter;\r
+               }\r
+             }\r
+           }\r
+\r
+           if(daughter0 == NULL || daughter1 == NULL){ // means we do not have two daughters from pair production\r
+             continue;\r
+           }\r
+\r
            if(daughter0->R()>fV0Reader->GetMaxRCut() || daughter1->R()>fV0Reader->GetMaxRCut()){\r
              continue;\r
            }\r
@@ -244,24 +261,24 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
              fHistograms->FillHistogram(nameMCMappingR, particle->Eta());\r
              \r
              TString nameMCMappingPhiInR="";\r
-             nameMCMappingPhiInR.Form("MC_EP_Mapping_Phi_vs_R_R-%02d",rBin);\r
-             fHistograms->FillHistogram(nameMCMappingPhiInR, daughter0->R(), tmpPhi);\r
+             nameMCMappingPhiInR.Form("MC_EP_Mapping_Phi_R-%02d",rBin);\r
+             fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);\r
              //end mapping\r
 \r
              fHistograms->FillHistogram("MC_EP_R",daughter0->R());\r
              fHistograms->FillHistogram("MC_EP_ZR",daughter0->Vz(),daughter0->R());\r
              fHistograms->FillHistogram("MC_EP_XY",daughter0->Vx(),daughter0->Vy());\r
              fHistograms->FillHistogram("MC_EP_OpeningAngle",GetMCOpeningAngle(daughter0, daughter1));\r
-           }\r
-         }\r
-       }\r
+           }// end if((daughter0->GetPdgCode() == -11 && daughter1->GetPdgCode()) == 11 ||....... approx 20 lines above\r
+         }// end if(particle->GetNDaughters() >= 2){\r
+       } // end if( fStack->Particle(particle->GetMother(0))->GetPdgCode() != 22 )\r
        if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==10441 ||//chic0 \r
            fStack->Particle(particle->GetMother(0))->GetPdgCode()==20443 ||//psi2S\r
            fStack->Particle(particle->GetMother(0))->GetPdgCode()==445  //chic2\r
-       ){ \r
+           ){ \r
          fMCGammaChic.push_back(particle);\r
-         }\r
-      }\r
+       }\r
+      }// end if(particle->GetMother(0)>-1)\r
       else{//means we have a primary particle\r
        fHistograms->FillHistogram("MC_DirectGamma_Energy",particle->Energy());\r
        fHistograms->FillHistogram("MC_DirectGamma_Pt", particle->Pt());\r
@@ -282,9 +299,8 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
 \r
          }\r
        }\r
-\r
-      }\r
-    }\r
+      }// end else\r
+    }// end if (particle->GetPdgCode()== 22){\r
     else if (TMath::Abs(particle->GetPdgCode())== 11){ // Means we have an electron or a positron\r
       if(particle->GetMother(0)>-1){ // means we have a mother\r
        if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==22 ){ // Means we have a gamma mother\r
@@ -302,7 +318,7 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
          }\r
        }\r
       }\r
-    }\r
+    } // end else if (TMath::Abs(particle->GetPdgCode())== 11)\r
     else if(particle->GetNDaughters() == 2){\r
 \r
       TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter());\r
@@ -322,7 +338,7 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
            fHistograms->FillHistogram("MC_Pi0_Secondaries_Energy", particle->Energy());\r
            fHistograms->FillHistogram("MC_Pi0_Secondaries_R", particle->R());\r
            fHistograms->FillHistogram("MC_Pi0_Secondaries_ZR", particle->Vz(),particle->R());\r
-           fHistograms->FillHistogram("MC_Pi0_Secondaries_OpeningAngle_Gamma", GetMCOpeningAngle(daughter0,daughter1));\r
+           fHistograms->FillHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));\r
            fHistograms->FillHistogram("MC_Pi0_Secondaries_XY", particle->Vx(),particle->Vy());//only fill from one daughter to avoid multiple filling\r
          }\r
          else{\r
@@ -333,7 +349,7 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
            fHistograms->FillHistogram("MC_Pi0_Energy", particle->Energy());\r
            fHistograms->FillHistogram("MC_Pi0_R", particle->R());\r
            fHistograms->FillHistogram("MC_Pi0_ZR", particle->Vz(),particle->R());\r
-           fHistograms->FillHistogram("MC_Pi0_OpeningAngle_Gamma", GetMCOpeningAngle(daughter0,daughter1));\r
+           fHistograms->FillHistogram("MC_Pi0_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));\r
            fHistograms->FillHistogram("MC_Pi0_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling\r
          }\r
        }\r
@@ -345,7 +361,7 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
          fHistograms->FillHistogram("MC_Eta_Energy", particle->Energy());\r
          fHistograms->FillHistogram("MC_Eta_R", particle->R());\r
          fHistograms->FillHistogram("MC_Eta_ZR", particle->Vz(),particle->R());\r
-         fHistograms->FillHistogram("MC_Eta_OpeningAngle_Gamma", GetMCOpeningAngle(daughter0,daughter1));\r
+         fHistograms->FillHistogram("MC_Eta_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));\r
          fHistograms->FillHistogram("MC_Eta_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling\r
        }\r
        \r
@@ -360,9 +376,9 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
        fHistograms->FillHistogram("MC_Match_Gamma_Eta", particle->Eta());\r
        fHistograms->FillHistogram("MC_Match_Gamma_Phi",tmpPhi);\r
       }\r
-    }\r
-  }\r
-}\r
+    }// end else if(particle->GetNDaughters() == 2)\r
+  }// end for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++)\r
+} // end ProcessMCData\r
 \r
 void AliAnalysisTaskGammaConversion::ProcessV0s(){\r
   // see header file for documentation\r
@@ -411,8 +427,8 @@ void AliAnalysisTaskGammaConversion::ProcessV0s(){
     fHistograms->FillHistogram(nameESDMappingR, fV0Reader->GetZ(), motherCandidateEta);  \r
 \r
     TString nameESDMappingPhiInR="";\r
-    nameESDMappingPhiInR.Form("ESD_EP_Mapping_Phi_vs_R_R-%02d",rBin);\r
-    fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetXYRadius(), fV0Reader->GetMotherCandidatePhi());\r
+    nameESDMappingPhiInR.Form("ESD_EP_Mapping_Phi_R-%02d",rBin);\r
+    fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());\r
     // end mapping\r
     \r
     fKFReconstructedGammas.push_back(*fV0Reader->GetMotherCandidateKFCombination());\r
@@ -422,13 +438,13 @@ void AliAnalysisTaskGammaConversion::ProcessV0s(){
       if(fV0Reader->HasSameMCMother() == kFALSE){\r
        continue;\r
       }\r
-\r
\r
       TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();\r
       TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();\r
+\r
       if(negativeMC->GetPdgCode()!=11 || positiveMC->GetPdgCode()!=-11){\r
        continue;\r
       }\r
-\r
       if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){\r
        fHistograms->FillHistogram("ESD_Match_Gamma_XY", fV0Reader->GetX(),fV0Reader->GetY());\r
        fHistograms->FillHistogram("ESD_Match_Gamma_OpeningAngle", fV0Reader->GetOpeningAngle());\r
@@ -469,7 +485,7 @@ void AliAnalysisTaskGammaConversion::ProcessV0s(){
        if(fV0Reader->GetNegativeMCParticle()->R() != 0){\r
          resdR = ((fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R())/fV0Reader->GetNegativeMCParticle()->R())*100;\r
        }\r
-       fHistograms->FillHistogram("Resolutiond_R", fV0Reader->GetNegativeMCParticle()->R(), resdR);\r
+       fHistograms->FillHistogram("Resolution_dR", fV0Reader->GetNegativeMCParticle()->R(), resdR);\r
        fHistograms->FillHistogram("Resolution_MC_R", fV0Reader->GetNegativeMCParticle()->R());\r
        fHistograms->FillHistogram("Resolution_ESD_R", fV0Reader->GetXYRadius());\r
        fHistograms->FillHistogram("Resolution_dR_dPt", resdR, resdPt);\r
@@ -497,8 +513,7 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
       twoGammaCandidate->GetMass(massTwoGammaCandidate,widthTwoGammaCandidate);\r
       if(twoGammaCandidate->GetNDF()>0){\r
        chi2TwoGammaCandidate = twoGammaCandidate->GetChi2()/twoGammaCandidate->GetNDF();\r
-       //      if(chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<fChi2Cut){//TODO  find this out\r
-       if(chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<10000){//TODO  find this out see line above\r
+       if(chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<fV0Reader->GetChi2CutMeson()){\r
 \r
          TVector3 vectorTwoGammaCandidate(twoGammaCandidate->Px(),twoGammaCandidate->Py(),twoGammaCandidate->Pz());\r
 \r
@@ -510,7 +525,7 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
          \r
          Double_t radiusTwoGammaCandidate = TMath::Sqrt(tmpX*tmpX + tmpY*tmpY);\r
 \r
-         fHistograms->FillHistogram("ESD_TwoGammaCombination_OpeningAngleGamma", openingAngleTwoGammaCandidate);\r
+         fHistograms->FillHistogram("ESD_TwoGammaCombination_GammaDaughter_OpeningAngle", openingAngleTwoGammaCandidate);\r
          fHistograms->FillHistogram("ESD_TwoGammaCombination_Energy", twoGammaCandidate->GetE());\r
          fHistograms->FillHistogram("ESD_TwoGammaCombination_Pt", sqrt(twoGammaCandidate->GetPx()*twoGammaCandidate->GetPx()+twoGammaCandidate->GetPy()*twoGammaCandidate->GetPy()));\r
          fHistograms->FillHistogram("ESD_TwoGammaCombination_Eta", vectorTwoGammaCandidate.Eta());\r
@@ -518,14 +533,13 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
          fHistograms->FillHistogram("ESD_TwoGammaCombination_Mass", massTwoGammaCandidate);\r
          fHistograms->FillHistogram("ESD_TwoGammaCombination_R", radiusTwoGammaCandidate);\r
          fHistograms->FillHistogram("ESD_TwoGammaCombination_ZR", tmpY, radiusTwoGammaCandidate);\r
-         fHistograms->FillHistogram("ESD_TwoGammaCombination_XY", tmpX, tmpY);   \r
-         fHistograms->FillHistogram("InvMass_vs_Pt__Spectra",massTwoGammaCandidate ,sqrt(twoGammaCandidate->GetPx()*twoGammaCandidate->GetPx()+twoGammaCandidate->GetPy()*twoGammaCandidate->GetPy()));\r
+         fHistograms->FillHistogram("ESD_TwoGammaCombination_XY", tmpX, tmpY);\r
+         fHistograms->FillHistogram("InvMass_vs_Pt_Spectra",massTwoGammaCandidate ,sqrt(twoGammaCandidate->GetPx()*twoGammaCandidate->GetPx()+twoGammaCandidate->GetPy()*twoGammaCandidate->GetPy()));\r
        }\r
       }\r
       delete twoGammaCandidate;\r
     }\r
   }\r
-\r
 }\r
 \r
 void AliAnalysisTaskGammaConversion::CalculateBackground(){\r
@@ -546,8 +560,7 @@ void AliAnalysisTaskGammaConversion::CalculateBackground(){
       backgroundCandidate->GetMass(massBG,widthBG);\r
       if(backgroundCandidate->GetNDF()>0){\r
        chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();\r
-       //      if(chi2Pi0>0 && chi2Pi0<fChi2Cut){//TODO  find this out\r
-       if(chi2BG>0 && chi2BG<fV0Reader->GetChi2Cut()){//TODO  find this out see line above\r
+       if(chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()){\r
 \r
          TVector3 vectorBGCandidate(backgroundCandidate->Px(),backgroundCandidate->Py(),backgroundCandidate->Pz());\r
 \r
@@ -568,6 +581,7 @@ void AliAnalysisTaskGammaConversion::CalculateBackground(){
          fHistograms->FillHistogram("ESD_Background_R", radiusBG);\r
          fHistograms->FillHistogram("ESD_Background_ZR", tmpY, radiusBG);\r
          fHistograms->FillHistogram("ESD_Background_XY", tmpX, tmpY);\r
+         fHistograms->FillHistogram("Background_InvMass_vs_Pt_Spectra",massBG,sqrt(backgroundCandidate->GetPx()*backgroundCandidate->GetPx()+backgroundCandidate->GetPy()*backgroundCandidate->GetPy()));\r
        }\r
       }\r
       delete backgroundCandidate;   \r
@@ -593,7 +607,7 @@ void AliAnalysisTaskGammaConversion::UserCreateOutputObjects()
     fOutputContainer = new TList();\r
   }\r
   fHistograms->GetOutputContainer(fOutputContainer);\r
-  fOutputContainer->SetName(GetName()) ;  \r
+  fOutputContainer->SetName(GetName());\r
 }\r
 \r
 Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(TParticle* daughter0, TParticle* daughter1) const{\r
@@ -602,4 +616,3 @@ Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(TParticle* daughter0,
   TVector3 v3D1(daughter1->Px(),daughter1->Py(),daughter1->Pz());\r
   return v3D0.Angle(v3D1);\r
 }\r
-\r
index cd9f6ee..08ada54 100644 (file)
@@ -42,7 +42,8 @@ AliGammaConversionHistograms::AliGammaConversionHistograms() :
   fDeltaR(0.),\r
   fMinPhi(0.),\r
   fMaxPhi(0.),\r
-  fDeltaPhi(0.)\r
+  fDeltaPhi(0.),\r
+  fMappingContainer(NULL)\r
 {\r
   // see header file for documenation\r
 }\r
@@ -57,7 +58,8 @@ AliGammaConversionHistograms::AliGammaConversionHistograms(const AliGammaConvers
   fDeltaR(original.fDeltaR),\r
   fMinPhi(original.fMinPhi),\r
   fMaxPhi(original.fMaxPhi),\r
-  fDeltaPhi(original.fDeltaPhi)\r
+  fDeltaPhi(original.fDeltaPhi),\r
+  fMappingContainer(original.fMappingContainer)\r
 {    \r
   //see header file for documentation\r
 }\r
@@ -101,7 +103,7 @@ void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t
       tmp->Fill(xValue);\r
   }\r
   else{\r
-    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
+    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
   }\r
 }\r
 \r
@@ -112,208 +114,37 @@ void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t
     tmp->Fill(xValue, yValue);\r
   }\r
   else{\r
-    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
+    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
   }\r
 }\r
 \r
-void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer) const{\r
+void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){\r
   //checking if the container is alrerady created\r
 \r
   if(fOutputContainer == NULL){\r
     //print warning\r
     return;\r
   }\r
-  cout<<"Creating the histogram output container"<<endl;\r
 \r
-  if(fHistogramMap){\r
+  if(fHistogramMap != NULL){\r
     TIter iter(fHistogramMap);\r
     TObjString *histogramName;\r
     while ((histogramName = (TObjString*) iter.Next())) {\r
-      cout<<"Histohram name "<<histogramName->GetString().Data()<<endl;\r
       TString histogramString = histogramName->GetString();\r
+      if(histogramString.Contains("Mapping")){// means it should be put in the mapping folder\r
+       if(fMappingContainer == NULL){\r
+         fMappingContainer = new TList();\r
+         fMappingContainer->SetName("Mapping histograms");\r
+       }\r
+       if(fMappingContainer != NULL){\r
+         fMappingContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
       fOutputContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
       histogramName = NULL;\r
-    }  \r
-  }\r
-\r
-  //remember mapping stuff!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r
-\r
-\r
-  /*\r
-  TList*  fMappingContainer = new TList();\r
-  fMappingContainer->SetName("Mapping Histograms");\r
-\r
-  if(fMCEPR != NULL){ fOutputContainer->Add(fMCEPR);}\r
-  if(fMCEPZR != NULL){ fOutputContainer->Add(fMCEPZR);}\r
-  if(fMCEPXY != NULL){ fOutputContainer->Add(fMCEPXY);}\r
-  if(fMCEPOpeningAngle != NULL){ fOutputContainer->Add(fMCEPOpeningAngle);}\r
-\r
-  if(fMCEEnergy != NULL){ fOutputContainer->Add(fMCEEnergy);}\r
-  if(fMCEPt != NULL){ fOutputContainer->Add(fMCEPt);}\r
-  if(fMCEEta != NULL){ fOutputContainer->Add(fMCEEta);}\r
-  if(fMCEPhi != NULL){ fOutputContainer->Add(fMCEPhi);}\r
-\r
-  if(fMCPEnergy != NULL){ fOutputContainer->Add(fMCPEnergy);}\r
-  if(fMCPPt != NULL){ fOutputContainer->Add(fMCPPt);}\r
-  if(fMCPEta != NULL){ fOutputContainer->Add(fMCPEta);}\r
-  if(fMCPPhi != NULL){ fOutputContainer->Add(fMCPPhi);}\r
-\r
-  if(fMCGammaEnergy != NULL){ fOutputContainer->Add(fMCGammaEnergy);}\r
-  if(fMCGammaPt != NULL){ fOutputContainer->Add(fMCGammaPt);}\r
-  if(fMCGammaEta != NULL){ fOutputContainer->Add(fMCGammaEta);}\r
-  if(fMCGammaPhi != NULL){ fOutputContainer->Add(fMCGammaPhi);}\r
-\r
-  if(fMCDirectGammaEnergy != NULL){ fOutputContainer->Add(fMCDirectGammaEnergy);}\r
-  if(fMCDirectGammaPt != NULL){ fOutputContainer->Add(fMCDirectGammaPt);}\r
-  if(fMCDirectGammaEta != NULL){ fOutputContainer->Add(fMCDirectGammaEta);}\r
-  if(fMCDirectGammaPhi != NULL){ fOutputContainer->Add(fMCDirectGammaPhi);}\r
-\r
-  //mapping\r
-  for(UInt_t i=0;i<fMCMapping.size();i++){\r
-    for(UInt_t j=0;j<fMCMapping[i].size();j++){\r
-      if(fMCMapping[i][j] != NULL){fMappingContainer->Add(fMCMapping[i][j]);}\r
-    }\r
+    } // end while\r
+    //   fOutputContainer->Add(fMappingContainer);\r
   }\r
-  for(UInt_t i=0;i<fMCMappingPhi.size();i++){\r
-    if(fMCMappingPhi[i] != NULL){fMappingContainer->Add(fMCMappingPhi[i]);}\r
-  }\r
-  for(UInt_t i=0;i<fMCMappingR.size();i++){\r
-    if(fMCMappingR[i] != NULL){fMappingContainer->Add(fMCMappingR[i]);}\r
-  }\r
-  if(fMCMatchGammaEta != NULL){ fOutputContainer->Add(fMCMatchGammaEta);}\r
-  if(fMCMatchGammaPhi != NULL){ fOutputContainer->Add(fMCMatchGammaPhi);}\r
-  if(fMCMatchGammaPt != NULL){ fOutputContainer->Add(fMCMatchGammaPt);}\r
-  if(fMCMatchGammaEnergy != NULL){ fOutputContainer->Add(fMCMatchGammaEnergy);}\r
-  if(fMCMatchGammaMass != NULL){ fOutputContainer->Add(fMCMatchGammaMass);}\r
-  if(fMCMatchGammaOpeningAngle != NULL){ fOutputContainer->Add(fMCMatchGammaOpeningAngle);}\r
-  if(fMCMatchGammaR != NULL){ fOutputContainer->Add(fMCMatchGammaR);}\r
-  if(fMCMatchGammaZR != NULL){ fOutputContainer->Add(fMCMatchGammaZR);}\r
-  if(fMCMatchGammaXY != NULL){ fOutputContainer->Add(fMCMatchGammaXY);}\r
-\r
-  if(fMCPi0Eta != NULL){ fOutputContainer->Add(fMCPi0Eta);}\r
-  if(fMCPi0Phi != NULL){ fOutputContainer->Add(fMCPi0Phi);}\r
-  if(fMCPi0Pt != NULL){ fOutputContainer->Add(fMCPi0Pt);}\r
-  if(fMCPi0Energy != NULL){ fOutputContainer->Add(fMCPi0Energy);}\r
-  if(fMCPi0Mass != NULL){ fOutputContainer->Add(fMCPi0Mass);}\r
-  if(fMCPi0OpeningAngleGamma != NULL){ fOutputContainer->Add(fMCPi0OpeningAngleGamma);}\r
-  if(fMCPi0R != NULL){ fOutputContainer->Add(fMCPi0R);}\r
-  if(fMCPi0ZR != NULL){ fOutputContainer->Add(fMCPi0ZR);}\r
-  if(fMCPi0XY != NULL){ fOutputContainer->Add(fMCPi0XY);}\r
-  if(fMCPi0SecondariesXY != NULL){ fOutputContainer->Add(fMCPi0SecondariesXY);}\r
-\r
-  if(fMCEtaEta != NULL){ fOutputContainer->Add(fMCEtaEta);}\r
-  if(fMCEtaPhi != NULL){ fOutputContainer->Add(fMCEtaPhi);}\r
-  if(fMCEtaPt != NULL){ fOutputContainer->Add(fMCEtaPt);}\r
-  if(fMCEtaEnergy != NULL){ fOutputContainer->Add(fMCEtaEnergy);}\r
-  if(fMCEtaMass != NULL){ fOutputContainer->Add(fMCEtaMass);}\r
-  if(fMCEtaOpeningAngleGamma != NULL){ fOutputContainer->Add(fMCEtaOpeningAngleGamma);}\r
-  if(fMCEtaR != NULL){ fOutputContainer->Add(fMCEtaR);}\r
-  if(fMCEtaZR != NULL){ fOutputContainer->Add(fMCEtaZR);}\r
-  if(fMCEtaXY != NULL){ fOutputContainer->Add(fMCEtaXY);}\r
-    \r
-  // Histograms from esd tracks\r
-  if(fESDEPR != NULL){ fOutputContainer->Add(fESDEPR);}\r
-  if(fESDEPZR != NULL){ fOutputContainer->Add(fESDEPZR);}\r
-  if(fESDEPXY != NULL){ fOutputContainer->Add(fESDEPXY);}\r
-  if(fESDEPOpeningAngle != NULL){ fOutputContainer->Add(fESDEPOpeningAngle);}\r
-\r
-  if(fESDEEnergy != NULL){ fOutputContainer->Add(fESDEEnergy);}\r
-  if(fESDEPt != NULL){ fOutputContainer->Add(fESDEPt);}\r
-  if(fESDEEta != NULL){ fOutputContainer->Add(fESDEEta);}\r
-  if(fESDEPhi != NULL){ fOutputContainer->Add(fESDEPhi);}\r
-\r
-  if(fESDPEnergy != NULL){ fOutputContainer->Add(fESDPEnergy);}\r
-  if(fESDPPt != NULL){ fOutputContainer->Add(fESDPPt);}\r
-  if(fESDPEta != NULL){ fOutputContainer->Add(fESDPEta);}\r
-  if(fESDPPhi != NULL){ fOutputContainer->Add(fESDPPhi);}\r
-\r
-  if(fESDGammaEnergy != NULL){ fOutputContainer->Add(fESDGammaEnergy);}\r
-  if(fESDGammaPt != NULL){ fOutputContainer->Add(fESDGammaPt);}\r
-  if(fESDGammaEta != NULL){ fOutputContainer->Add(fESDGammaEta);}\r
-  if(fESDGammaPhi != NULL){ fOutputContainer->Add(fESDGammaPhi);}\r
-\r
-  //mapping\r
-  for(UInt_t i=0;i<fESDMapping.size();i++){\r
-    for(UInt_t j=0;j<fESDMapping[i].size();j++){\r
-      if(fESDMapping[i][j] != NULL){fMappingContainer->Add(fESDMapping[i][j]);}\r
-    }\r
-  }\r
-  for(UInt_t i=0;i<fESDMappingPhi.size();i++){\r
-    if(fESDMappingPhi[i] != NULL){fMappingContainer->Add(fESDMappingPhi[i]);}\r
-  }\r
-  for(UInt_t i=0;i<fESDMappingR.size();i++){\r
-    if(fESDMappingR[i] != NULL){fMappingContainer->Add(fESDMappingR[i]);}\r
-  }\r
-\r
-  fOutputContainer->Add(fMappingContainer);\r
-\r
-  if(fESDMatchGammaOpeningAngle != NULL){ fOutputContainer->Add(fESDMatchGammaOpeningAngle);}\r
-  if(fESDMatchGammaEnergy != NULL){ fOutputContainer->Add(fESDMatchGammaEnergy);}\r
-  if(fESDMatchGammaPt != NULL){ fOutputContainer->Add(fESDMatchGammaPt);}\r
-  if(fESDMatchGammaEta != NULL){ fOutputContainer->Add(fESDMatchGammaEta);}\r
-  if(fESDMatchGammaPhi != NULL){ fOutputContainer->Add(fESDMatchGammaPhi);}\r
-  if(fESDMatchGammaMass != NULL){ fOutputContainer->Add(fESDMatchGammaMass);}\r
-  if(fESDMatchGammaWidth != NULL){ fOutputContainer->Add(fESDMatchGammaWidth);}\r
-  if(fESDMatchGammaChi2 != NULL){ fOutputContainer->Add(fESDMatchGammaChi2);}\r
-  if(fESDMatchGammaNDF != NULL){ fOutputContainer->Add(fESDMatchGammaNDF);}\r
-  if(fESDMatchGammaR != NULL){ fOutputContainer->Add(fESDMatchGammaR);}\r
-  if(fESDMatchGammaZR != NULL){ fOutputContainer->Add(fESDMatchGammaZR);}\r
-  if(fESDMatchGammaXY != NULL){ fOutputContainer->Add(fESDMatchGammaXY);}\r
-\r
-  if(fESDPi0OpeningAngleGamma != NULL){ fOutputContainer->Add(fESDPi0OpeningAngleGamma);}\r
-  if(fESDPi0Energy != NULL){ fOutputContainer->Add(fESDPi0Energy);}\r
-  if(fESDPi0Pt != NULL){ fOutputContainer->Add(fESDPi0Pt);}\r
-  if(fESDPi0Eta != NULL){ fOutputContainer->Add(fESDPi0Eta);}\r
-  if(fESDPi0Phi != NULL){ fOutputContainer->Add(fESDPi0Phi);}\r
-  if(fESDPi0Mass != NULL){ fOutputContainer->Add(fESDPi0Mass);}\r
-  if(fESDPi0R != NULL){ fOutputContainer->Add(fESDPi0R);}\r
-  if(fESDPi0ZR != NULL){ fOutputContainer->Add(fESDPi0ZR);}\r
-  if(fESDPi0XY != NULL){ fOutputContainer->Add(fESDPi0XY);}\r
-\r
-  if(fESDEtaOpeningAngleGamma != NULL){ fOutputContainer->Add(fESDEtaOpeningAngleGamma);}\r
-  if(fESDEtaEnergy != NULL){ fOutputContainer->Add(fESDEtaEnergy);}\r
-  if(fESDEtaPt != NULL){ fOutputContainer->Add(fESDEtaPt);}\r
-  if(fESDEtaEta != NULL){ fOutputContainer->Add(fESDEtaEta);}\r
-  if(fESDEtaPhi != NULL){ fOutputContainer->Add(fESDEtaPhi);}\r
-  if(fESDEtaMass != NULL){ fOutputContainer->Add(fESDEtaMass);}\r
-  if(fESDEtaR != NULL){ fOutputContainer->Add(fESDEtaR);}\r
-  if(fESDEtaZR != NULL){ fOutputContainer->Add(fESDEtaZR);}\r
-  if(fESDEtaXY != NULL){ fOutputContainer->Add(fESDEtaXY);}\r
-\r
-  if(fESDBackgroundOpeningAngleGamma != NULL){ fOutputContainer->Add(fESDBackgroundOpeningAngleGamma);}\r
-  if(fESDBackgroundEnergy != NULL){ fOutputContainer->Add(fESDBackgroundEnergy);}\r
-  if(fESDBackgroundPt != NULL){ fOutputContainer->Add(fESDBackgroundPt);}\r
-  if(fESDBackgroundEta != NULL){ fOutputContainer->Add(fESDBackgroundEta);}\r
-  if(fESDBackgroundPhi != NULL){ fOutputContainer->Add(fESDBackgroundPhi);}\r
-  if(fESDBackgroundMass != NULL){ fOutputContainer->Add(fESDBackgroundMass);}\r
-  if(fESDBackgroundR != NULL){ fOutputContainer->Add(fESDBackgroundR);}\r
-  if(fESDBackgroundZR != NULL){ fOutputContainer->Add(fESDBackgroundZR);}\r
-  if(fESDBackgroundXY != NULL){ fOutputContainer->Add(fESDBackgroundXY);}\r
-\r
-  if(fResolutiondPt != NULL){ fOutputContainer->Add(fResolutiondPt);}\r
-  if(fResolutiondR != NULL){ fOutputContainer->Add(fResolutiondR);}\r
-  if(fResolutiondZ != NULL){ fOutputContainer->Add(fResolutiondZ);}\r
-  if(fResolutiondRdPt != NULL){ fOutputContainer->Add(fResolutiondRdPt);}\r
-  if(fResolutionMCPt != NULL){ fOutputContainer->Add(fResolutionMCPt);}\r
-  if(fResolutionMCR != NULL){ fOutputContainer->Add(fResolutionMCR);}\r
-  if(fResolutionMCZ != NULL){ fOutputContainer->Add(fResolutionMCZ);}\r
-  if(fResolutionESDPt != NULL){ fOutputContainer->Add(fResolutionESDPt);}\r
-  if(fResolutionESDR != NULL){ fOutputContainer->Add(fResolutionESDR);}\r
-  if(fResolutionESDZ != NULL){ fOutputContainer->Add(fResolutionESDZ);}\r
-\r
-  if(fNumberOfV0s != NULL){fOutputContainer->Add(fNumberOfV0s);}\r
-  if(fNumberOfSurvivingV0s != NULL){fOutputContainer->Add(fNumberOfSurvivingV0s);}\r
-  if(fV0MassDebugCut1 != NULL){fOutputContainer->Add(fV0MassDebugCut1);}\r
-  if(fV0MassDebugCut2 != NULL){fOutputContainer->Add(fV0MassDebugCut2);}\r
-  if(fV0MassDebugCut3 != NULL){fOutputContainer->Add(fV0MassDebugCut3);}\r
-  if(fV0MassDebugCut4 != NULL){fOutputContainer->Add(fV0MassDebugCut4);}\r
-  if(fV0MassDebugCut5 != NULL){fOutputContainer->Add(fV0MassDebugCut5);}\r
-  if(fV0MassDebugCut6 != NULL){fOutputContainer->Add(fV0MassDebugCut6);}\r
-  if(fV0MassDebugCut7 != NULL){fOutputContainer->Add(fV0MassDebugCut7);}\r
-  if(fV0MassDebugCut8 != NULL){fOutputContainer->Add(fV0MassDebugCut8);}\r
-  \r
-  return fOutputContainer;\r
-*/\r
 }\r
 \r
 Int_t AliGammaConversionHistograms::GetRBin(Double_t radius) const{\r
@@ -365,6 +196,9 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
 \r
     for(Int_t r =0; r<fNRIndex;r++){\r
 \r
+      // setting axis to "" changes below\r
+      xAxisTitle="";\r
+      yAxisTitle="";\r
       //Creating the axis titles\r
       if(xAxisTitle.Length() == 0){\r
        xAxisTitle.Form("Phi %02d",phi);\r
@@ -392,8 +226,12 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
     }\r
   }\r
 \r
+\r
   for(Int_t phi =0; phi<=nPhiIndex;phi++){ \r
 \r
+    // setting axis to "" changes below\r
+    xAxisTitle="";\r
+    yAxisTitle="";\r
     //Creating the axis titles\r
     if(xAxisTitle.Length() == 0){\r
       xAxisTitle.Form("Phi %02d",phi);\r
@@ -412,15 +250,19 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
 \r
     //MC\r
     TString nameESD="";\r
-    nameMC.Form("ESD_EP_Mapping-Phi%02d",phi);\r
+    nameESD.Form("ESD_EP_Mapping-Phi%02d",phi);\r
     TString titleESD="";\r
-    titleMC.Form("Electron-Positron ESD Mapping-Phi%02d",phi);\r
+    titleESD.Form("Electron-Positron ESD Mapping-Phi%02d",phi);\r
     \r
     AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
   }\r
 \r
 \r
   for(Int_t r =0; r<=nRIndex;r++){\r
+\r
+    // setting axis to "" changes below\r
+    xAxisTitle="";\r
+    yAxisTitle="";\r
     //Creating the axis titles\r
     if(xAxisTitle.Length() == 0){\r
       xAxisTitle.Form("R %02d",r);\r
@@ -447,15 +289,16 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
 \r
     //Mapping Phi in R\r
     TString nameMCPhiInR="";\r
-    nameMCPhiInR.Form("MC_EP_Mapping_Phi_vs_R_R-%02d",r);\r
+    nameMCPhiInR.Form("MC_EP_Mapping_Phi_R-%02d",r);\r
     TString titleMCPhiInR="";\r
-    titleMCPhiInR.Form("Electron-Positron MC Mapping of Phi in R%02d",r);\r
-    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);\r
+    titleMCPhiInR.Form("MC Mapping of Phi in R%02d",r);\r
+    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
 \r
+    //Mapping Phi in R\r
     TString nameESDPhiInR="";\r
-    nameESDPhiInR.Form("ESD_EP_Mapping_Phi_vs_R_R-%02d",r);\r
+    nameESDPhiInR.Form("ESD_EP_Mapping_Phi_R-%02d",r);\r
     TString titleESDPhiInR="";\r
-    titleESDPhiInR.Form("Electron-Positron ESD Mapping of Phi in R%02d",r);\r
-    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);    \r
+    titleESDPhiInR.Form("ESD Mapping of Phi in R%02d",r);\r
+    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    \r
   }\r
 }\r
index d3a1709..8434d66 100644 (file)
 ////////////////////////////////////////////////\r
 \r
 #include "TString.h"\r
-//#include "TH1F.h"\r
-//#include "TH2F.h"\r
 #include "Riostream.h"\r
 #include <vector>\r
-//#include "TList.h"\r
-//#include "TMap.h"\r
 \r
 class TMap;\r
 class TList;\r
@@ -33,7 +29,7 @@ class AliGammaConversionHistograms{
   \r
 \r
   //  TList * GetOutputContainer();\r
-  void GetOutputContainer(TList *fOutputContainer) const;\r
+  void GetOutputContainer(TList *fOutputContainer);\r
   \r
   Int_t GetRBin(Double_t radius) const;\r
   Int_t GetPhiBin(Double_t phi) const;\r
@@ -73,6 +69,9 @@ class AliGammaConversionHistograms{
   Double_t fMinPhi;\r
   Double_t fMaxPhi;\r
   Double_t fDeltaPhi;\r
+\r
+  TList * fMappingContainer;\r
+\r
   \r
   ClassDef(AliGammaConversionHistograms,1)\r
 } ;\r
index 6c9291d..7e39f1f 100644 (file)
@@ -77,7 +77,8 @@ ClassImp(AliV0Reader)
     fMaxR(10000),// 100 meter(outside of ALICE)\r
     fEtaCut(0.),\r
     fPtCut(0.),\r
-    fChi2Cut(0.),\r
+    fChi2CutConversion(0.),\r
+    fChi2CutMeson(0.),\r
     fPIDProbabilityCutNegativeParticle(0),\r
     fPIDProbabilityCutPositiveParticle(0),\r
     fXVertexCut(0.),\r
@@ -126,7 +127,8 @@ AliV0Reader::AliV0Reader(const AliV0Reader & original) :
   fMaxR(original.fMaxR),\r
   fEtaCut(original.fEtaCut),\r
   fPtCut(original.fPtCut),\r
-  fChi2Cut(original.fChi2Cut),\r
+  fChi2CutConversion(original.fChi2CutConversion),\r
+  fChi2CutMeson(original.fChi2CutMeson),\r
   fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),\r
   fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),\r
   fXVertexCut(original.fXVertexCut),\r
@@ -231,7 +233,7 @@ Bool_t AliV0Reader::NextV0(){
        continue;\r
       }\r
       Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();\r
-      if(chi2V0 > fChi2Cut || chi2V0 <=0){\r
+      if(chi2V0 > fChi2CutConversion || chi2V0 <=0){\r
        fCurrentV0IndexNumber++;\r
        fHistograms->FillHistogram("V0MassDebugCut6",GetMotherCandidateMass());\r
        continue;\r
@@ -332,10 +334,11 @@ void AliV0Reader::UpdateV0Information(){
     fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.); \r
   }\r
     \r
-  if(fDoMC){\r
+  if(fDoMC == kTRUE){\r
     fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));\r
     fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));\r
   }\r
+  fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);\r
 }\r
 \r
 Bool_t AliV0Reader::HasSameMCMother(){\r
index 94f1d3f..41a3ab9 100644 (file)
@@ -212,12 +212,14 @@ class AliV0Reader : public TObject {
   Double_t GetMaxRCut() const{return fMaxR;}\r
   Double_t GetEtaCut() const{return fEtaCut;}\r
   Double_t GetPtCut() const{return fPtCut;}\r
-  Double_t GetChi2Cut() const{return fChi2Cut;}\r
+  Double_t GetChi2CutConversion() const{return fChi2CutConversion;}\r
+  Double_t GetChi2CutMeson() const{return fChi2CutMeson;}\r
 \r
   void SetMaxRCut(Double_t maxR){fMaxR=maxR;}\r
   void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}\r
   void SetPtCut(Double_t ptCut){fPtCut=ptCut;}\r
-  void SetChi2Cut(Double_t chi2){fChi2Cut=chi2;}\r
+  void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}\r
+  void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}\r
   \r
   void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;}\r
   void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;}\r
@@ -226,6 +228,9 @@ class AliV0Reader : public TObject {
   void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}\r
   void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}\r
   void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}\r
+\r
+  void SetDoMCTruth(Bool_t doMC){fDoMC = doMC;}\r
+\r
   void UpdateV0Information();\r
 \r
   void SetHistograms(AliGammaConversionHistograms *histograms){fHistograms=histograms;}\r
@@ -278,7 +283,8 @@ class AliV0Reader : public TObject {
   Double_t fMaxR;\r
   Double_t fEtaCut;\r
   Double_t fPtCut;\r
-  Double_t fChi2Cut;\r
+  Double_t fChi2CutConversion;\r
+  Double_t fChi2CutMeson;\r
   Double_t fPIDProbabilityCutNegativeParticle;\r
   Double_t fPIDProbabilityCutPositiveParticle;\r
   Double_t fXVertexCut;\r
index d2fb671..7b1d101 100644 (file)
@@ -11,6 +11,8 @@ Bool_t useESDTrack   = kFALSE;
 \r
 Bool_t calculateBackground = kTRUE;\r
 \r
+Int_t numberOfFilesToAnalyze=100;\r
+\r
 /** ---------------------------------- define cuts here ------------------------------------*/\r
 \r
 Int_t pidOfNegativeTrack=11;\r
@@ -19,7 +21,8 @@ Int_t pidOfPositiveTrack=-11;
 Double_t maxRCut   = 200.;\r
 Double_t etaCut    = 1.2;\r
 Double_t ptCut     = 0.1;\r
-Double_t chi2Cut   = 20.;\r
+Double_t chi2CutConversion   = 20.;\r
+Double_t chi2CutMeson   = 20.;\r
 \r
 Double_t xVertexCut = 0.;\r
 Double_t yVertexCut = 0.;\r
@@ -59,8 +62,8 @@ Double_t maxPhi      = TMath::Pi();
 /** ------------------- define which histograms to plot here --------------------------------*/\r
 /**   NB: to change the bin numbers, see below the histogram flags                           */\r
 Bool_t plotMCEPR                             = kTRUE;\r
-Bool_t plotMCEPZR                           = kTRUE;\r
-Bool_t plotMCEPXY                           = kTRUE;\r
+Bool_t plotMCEPZR                            = kTRUE;\r
+Bool_t plotMCEPXY                            = kTRUE;\r
 Bool_t plotMCEPOpeningAngle                  = kTRUE;\r
 \r
 Bool_t plotMCEEnergy                         = kTRUE;\r
@@ -83,15 +86,15 @@ Bool_t plotMCDirectGammaPt                   = kTRUE;
 Bool_t plotMCDirectGammaEta                  = kTRUE;\r
 Bool_t plotMCDirectGammaPhi                  = kTRUE;\r
 \r
-Bool_t plotMCMatchGammaEta                  = kTRUE;\r
-Bool_t plotMCMatchGammaPhi                  = kTRUE;\r
-Bool_t plotMCMatchGammaPt                   = kTRUE;\r
-Bool_t plotMCMatchGammaEnergy               = kTRUE;\r
-Bool_t plotMCMatchGammaMass                 = kTRUE;\r
-Bool_t plotMCMatchGammaOpeningAngle         = kTRUE;\r
-Bool_t plotMCMatchGammaR                    = kTRUE;\r
-Bool_t plotMCMatchGammaZR                  = kTRUE;\r
-Bool_t plotMCMatchGammaXY                  = kTRUE;\r
+Bool_t plotMCMatchGammaEta                   = kTRUE;\r
+Bool_t plotMCMatchGammaPhi                   = kTRUE;\r
+Bool_t plotMCMatchGammaPt                    = kTRUE;\r
+Bool_t plotMCMatchGammaEnergy                = kTRUE;\r
+Bool_t plotMCMatchGammaMass                  = kTRUE;\r
+Bool_t plotMCMatchGammaOpeningAngle          = kTRUE;\r
+Bool_t plotMCMatchGammaR                     = kTRUE;\r
+Bool_t plotMCMatchGammaZR                    = kTRUE;\r
+Bool_t plotMCMatchGammaXY                    = kTRUE;\r
 \r
 Bool_t plotMCPi0Eta                          = kTRUE;\r
 Bool_t plotMCPi0Phi                          = kTRUE;\r
@@ -100,8 +103,8 @@ Bool_t plotMCPi0Energy                       = kTRUE;
 Bool_t plotMCPi0Mass                         = kTRUE;\r
 Bool_t plotMCPi0OpeningAngle                 = kTRUE;\r
 Bool_t plotMCPi0R                            = kTRUE;\r
-Bool_t plotMCPi0ZR                          = kTRUE;\r
-Bool_t plotMCPi0XY                          = kTRUE;\r
+Bool_t plotMCPi0ZR                           = kTRUE;\r
+Bool_t plotMCPi0XY                           = kTRUE;\r
 \r
 Bool_t plotMCEtaEta                          = kTRUE;\r
 Bool_t plotMCEtaPhi                          = kTRUE;\r
@@ -110,13 +113,13 @@ Bool_t plotMCEtaEnergy                       = kTRUE;
 Bool_t plotMCEtaMass                         = kTRUE;\r
 Bool_t plotMCEtaOpeningAngleGamma            = kTRUE;\r
 Bool_t plotMCEtaR                            = kTRUE;\r
-Bool_t plotMCEtaZR                          = kTRUE;\r
-Bool_t plotMCEtaXY                          = kTRUE;\r
+Bool_t plotMCEtaZR                           = kTRUE;\r
+Bool_t plotMCEtaXY                           = kTRUE;\r
     \r
 // Histograms from esd tracks\r
 Bool_t plotESDEPR                            = kTRUE;\r
-Bool_t plotESDEPZR                          = kTRUE;\r
-Bool_t plotESDEPXY                          = kTRUE;\r
+Bool_t plotESDEPZR                           = kTRUE;\r
+Bool_t plotESDEPXY                           = kTRUE;\r
 Bool_t plotESDEPOpeningAngle                 = kTRUE;\r
 \r
 Bool_t plotESDEEnergy                        = kTRUE;\r
@@ -135,28 +138,28 @@ Bool_t plotESDGammaPt                        = kTRUE;
 Bool_t plotESDGammaEta                       = kTRUE;\r
 Bool_t plotESDGammaPhi                       = kTRUE;\r
 \r
-Bool_t plotESDMatchGammaOpeningAngle        = kTRUE;\r
-Bool_t plotESDMatchGammaEnergy              = kTRUE;\r
-Bool_t plotESDMatchGammaPt                  = kTRUE;\r
-Bool_t plotESDMatchGammaEta                 = kTRUE;\r
-Bool_t plotESDMatchGammaPhi                 = kTRUE;\r
-Bool_t plotESDMatchGammaMass                = kTRUE;\r
-Bool_t plotESDMatchGammaWidth               = kTRUE;\r
-Bool_t plotESDMatchGammaChi2                = kTRUE;\r
-Bool_t plotESDMatchGammaNDF                 = kTRUE;\r
-Bool_t plotESDMatchGammaR                   = kTRUE;\r
-Bool_t plotESDMatchGammaZR                 = kTRUE;\r
-Bool_t plotESDMatchGammaXY                 = kTRUE;\r
+Bool_t plotESDMatchGammaOpeningAngle         = kTRUE;\r
+Bool_t plotESDMatchGammaEnergy               = kTRUE;\r
+Bool_t plotESDMatchGammaPt                   = kTRUE;\r
+Bool_t plotESDMatchGammaEta                  = kTRUE;\r
+Bool_t plotESDMatchGammaPhi                  = kTRUE;\r
+Bool_t plotESDMatchGammaMass                 = kTRUE;\r
+Bool_t plotESDMatchGammaWidth                = kTRUE;\r
+Bool_t plotESDMatchGammaChi2                 = kTRUE;\r
+Bool_t plotESDMatchGammaNDF                  = kTRUE;\r
+Bool_t plotESDMatchGammaR                    = kTRUE;\r
+Bool_t plotESDMatchGammaZR                   = kTRUE;\r
+Bool_t plotESDMatchGammaXY                   = kTRUE;\r
 \r
 Bool_t plotESDTwoGammaCombinationOpeningAngleGamma         = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationEnergy    = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationPt        = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationEta       = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationPhi       = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationMass      = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationR         = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationZR        = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationXY        = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationEnergy      = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationPt          = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationEta         = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationPhi         = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationMass        = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationR           = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationZR          = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationXY          = kTRUE;\r
 \r
 Bool_t plotESDBackgroundOpeningAngleGamma    = kTRUE;\r
 Bool_t plotESDBackgroundEnergy               = kTRUE;\r
@@ -165,14 +168,14 @@ Bool_t plotESDBackgroundEta                  = kTRUE;
 Bool_t plotESDBackgroundPhi                  = kTRUE;\r
 Bool_t plotESDBackgroundMass                 = kTRUE;\r
 Bool_t plotESDBackgroundR                    = kTRUE;\r
-Bool_t plotESDBackgroundZR                  = kTRUE;\r
-Bool_t plotESDBackgroundXY                  = kTRUE;\r
+Bool_t plotESDBackgroundZR                   = kTRUE;\r
+Bool_t plotESDBackgroundXY                   = kTRUE;\r
 \r
-Bool_t plotMapping                             = kTRUE;       \r
+Bool_t plotMapping                           = kTRUE;       \r
 \r
-Bool_t plotResolutiondPt                      = kTRUE;\r
-Bool_t plotResolutiondR                       = kTRUE;\r
-Bool_t plotResolutiondZ                       = kTRUE;\r
+Bool_t plotResolutiondPt                     = kTRUE;\r
+Bool_t plotResolutiondR                      = kTRUE;\r
+Bool_t plotResolutiondZ                      = kTRUE;\r
   \r
 Bool_t plotResolutiondRdPt                   = kTRUE;\r
 \r
@@ -184,21 +187,21 @@ Bool_t plotResolutionESDPt                   = kTRUE;
 Bool_t plotResolutionESDR                    = kTRUE;\r
 Bool_t plotResolutionESDZ                    = kTRUE;\r
 \r
-Bool_t plotNumberOfV0s                         = kTRUE;\r
-Bool_t plotNumberOfSurvivingV0s                = kTRUE;\r
+Bool_t plotNumberOfV0s                       = kTRUE;\r
+Bool_t plotNumberOfSurvivingV0s              = kTRUE;\r
 \r
   //  debug histograms\r
-Bool_t plotV0MassDebugCut1                     = kTRUE;\r
-Bool_t plotV0MassDebugCut2                     = kTRUE;\r
-Bool_t plotV0MassDebugCut3                     = kTRUE;\r
-Bool_t plotV0MassDebugCut4                     = kTRUE;\r
-Bool_t plotV0MassDebugCut5                     = kTRUE;\r
-Bool_t plotV0MassDebugCut6                     = kTRUE;\r
-Bool_t plotV0MassDebugCut7                     = kTRUE;\r
-Bool_t plotV0MassDebugCut8                     = kTRUE;\r
+Bool_t plotV0MassDebugCut1                   = kTRUE;\r
+Bool_t plotV0MassDebugCut2                   = kTRUE;\r
+Bool_t plotV0MassDebugCut3                   = kTRUE;\r
+Bool_t plotV0MassDebugCut4                   = kTRUE;\r
+Bool_t plotV0MassDebugCut5                   = kTRUE;\r
+Bool_t plotV0MassDebugCut6                   = kTRUE;\r
+Bool_t plotV0MassDebugCut7                   = kTRUE;\r
+Bool_t plotV0MassDebugCut8                   = kTRUE;\r
 \r
-Bool_t plotPi0Spectra                          = kTRUE;\r
-Bool_t plotEtaSpectra                          = kTRUE;\r
+Bool_t plotPi0Spectra                        = kTRUE;\r
+Bool_t plotEtaSpectra                        = kTRUE;\r
 \r
 \r
 /** ----------------- end define which histograms to plot here -------------------------------*/\r
@@ -401,9 +404,9 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotMCMatchGammaEnergy == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
   if(plotMCMatchGammaMass == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Mass" ,"" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass, "", "");}\r
   if(plotMCMatchGammaOpeningAngle == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotMCMatchGammaR == kTRUE){ histograms->AddHistogram("MC_Match_GammaR" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotMCMatchGammaZR == kTRUE){ histograms->AddHistogram("MC_Match_GammaZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotMCMatchGammaXY == kTRUE){ histograms->AddHistogram("MC_Match_GammaXY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
+  if(plotMCMatchGammaR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
+  if(plotMCMatchGammaZR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
+  if(plotMCMatchGammaXY == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
 \r
   if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
   if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
@@ -415,6 +418,16 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
   if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
 \r
+  if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
+  if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
+  if(plotMCPi0Pt == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
+  if(plotMCPi0Energy == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
+  if(plotMCPi0Mass == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}\r
+  if(plotMCPi0OpeningAngle == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
+  if(plotMCPi0R == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
+  if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
+  if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
+\r
   if(plotMCEtaEta == kTRUE){ histograms->AddHistogram("MC_Eta_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
   if(plotMCEtaPhi == kTRUE){ histograms->AddHistogram("MC_Eta_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
   if(plotMCEtaPt == kTRUE){ histograms->AddHistogram("MC_Eta_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
@@ -469,17 +482,6 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotESDTwoGammaCombinationZR == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
   if(plotESDTwoGammaCombinationXY == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
 \r
-  /*\r
-  if(plotESDEtaOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_Eta_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotESDEtaEnergy == kTRUE){ histograms->AddHistogram("ESD_Eta_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotESDEtaPt == kTRUE){ histograms->AddHistogram("ESD_Eta_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotESDEtaEta == kTRUE){ histograms->AddHistogram("ESD_Eta_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDEtaPhi == kTRUE){ histograms->AddHistogram("ESD_Eta_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-  if(plotESDEtaMass == kTRUE){ histograms->AddHistogram("ESD_Eta_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}\r
-  if(plotESDEtaR == kTRUE){ histograms->AddHistogram("ESD_Eta_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotESDEtaZR == kTRUE){ histograms->AddHistogram("ESD_Eta_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotESDEtaXY == kTRUE){ histograms->AddHistogram("ESD_Eta_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
-  */\r
   if(plotESDBackgroundOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_Background_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
   if(plotESDBackgroundEnergy == kTRUE){ histograms->AddHistogram("ESD_Background_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
   if(plotESDBackgroundPt == kTRUE){ histograms->AddHistogram("ESD_Background_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
@@ -523,7 +525,9 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotV0MassDebugCut8 == kTRUE){histograms->AddHistogram("V0MassDebugCut8" ,"debug8" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
 \r
 \r
-  if(plotPi0Spectra == kTRUE){histograms->AddHistogram("InvMass_vs_Pt__Spectra" ,"Inv mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}\r
+  if(plotPi0Spectra == kTRUE){histograms->AddHistogram("InvMass_vs_Pt_Spectra" ,"Invariant Mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}\r
+\r
+  if(plotPi0Spectra == kTRUE && calculateBackground == kTRUE){histograms->AddHistogram("Background_InvMass_vs_Pt_Spectra" ,"Background Invariant Mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}\r
 \r
   \r
 \r
@@ -585,13 +589,15 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   v0Reader->SetMaxRCut(maxRCut);\r
   v0Reader->SetEtaCut(etaCut);\r
   v0Reader->SetPtCut(ptCut);\r
-  v0Reader->SetChi2Cut(chi2Cut);\r
+  v0Reader->SetChi2CutConversion(chi2CutConversion);\r
+  v0Reader->SetChi2CutMeson(chi2CutMeson);\r
   v0Reader->SetPIDProbability(probElectron);\r
   v0Reader->SetXVertexCut(xVertexCut);\r
   v0Reader->SetYVertexCut(yVertexCut);\r
   v0Reader->SetZVertexCut(zVertexCut);\r
   v0Reader->SetSigmaMass(sigmaCutGammaMass);\r
   v0Reader->SetUseImprovedVertex(useImprovedVertex);\r
+  v0Reader->SetDoMCTruth(doMCTruth);\r
 \r
   // Create the GammaConversionTask\r
   AliAnalysisTaskGammaConversion *gammaconversion = new AliAnalysisTaskGammaConversion("GammaConversionTask");\r
@@ -629,7 +635,7 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   mgr->ConnectOutput(gammaconversion, 0, coutput1);\r
   mgr->ConnectOutput(gammaconversion, 1, coutput2);\r
 \r
-  TChain* chain= CreateESDChain(sample);\r
+  TChain* chain= CreateESDChain(sample,numberOfFilesToAnalyze);\r
   \r
   mgr->InitAnalysis();\r
   \r