Cleaning up files, added documentation. Added ntuple for v0s.
authorkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Jan 2009 14:42:07 +0000 (14:42 +0000)
committerkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Jan 2009 14:42:07 +0000 (14:42 +0000)
PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx
PWG4/GammaConv/AliAnalysisTaskGammaConversion.h
PWG4/GammaConv/AliGammaConversionHistograms.cxx
PWG4/GammaConv/AliGammaConversionHistograms.h
PWG4/GammaConv/AliV0Reader.cxx
PWG4/GammaConv/AliV0Reader.h
PWG4/macros/ConfigGammaConversion.C

index f6edf1f..5df0c83 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
  *                                                                        *\r
  * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                        *\r
- * Version 1.0                                                            *\r
+ * Version 1.1                                                            *\r
  *                                                                        *\r
  * Permission to use, copy, modify and distribute this software and its   *\r
  * documentation strictly for non-commercial purposes is hereby granted   *\r
@@ -64,7 +64,11 @@ AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion():
   fGammaWidth(-1),\r
   fPi0Width(-1),\r
   fEtaWidth(-1),\r
-  fCalculateBackground(kFALSE)\r
+  fCalculateBackground(kFALSE),\r
+  fWriteNtuple(kFALSE),\r
+  fGammaNtuple(NULL),\r
+  fNeutralMesonNtuple(NULL),\r
+  fTotalNumberOfAddedNtupleEntries(0)\r
 {\r
   // Default constructor\r
   // Common I/O in slot 0\r
@@ -94,7 +98,11 @@ AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(const char* name)
   fGammaWidth(-1),\r
   fPi0Width(-1),\r
   fEtaWidth(-1),\r
-  fCalculateBackground(kFALSE)\r
+  fCalculateBackground(kFALSE),\r
+  fWriteNtuple(kFALSE),\r
+  fGammaNtuple(NULL),\r
+  fNeutralMesonNtuple(NULL),\r
+  fTotalNumberOfAddedNtupleEntries(0)\r
 {\r
   // Common I/O in slot 0\r
   DefineInput (0, TChain::Class());\r
@@ -380,9 +388,62 @@ void AliAnalysisTaskGammaConversion::ProcessMCData(){
   }// end for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++)\r
 } // end ProcessMCData\r
 \r
+void AliAnalysisTaskGammaConversion::FillNtuple(){\r
+\r
+  if(fGammaNtuple == NULL){\r
+    return;\r
+  }\r
+  Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();\r
+  for(Int_t i=0;i<numberOfV0s;i++){\r
+    Float_t values[27] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};\r
+    AliESDv0 * cV0 = fV0Reader->GetV0(i);\r
+    Double_t negPID=0;\r
+    Double_t posPID=0;\r
+    fV0Reader->GetPIDProbability(negPID,posPID);\r
+    values[0]=cV0->GetOnFlyStatus();\r
+    values[1]=fV0Reader->CheckForPrimaryVertex();\r
+    values[2]=negPID;\r
+    values[3]=posPID;\r
+    values[4]=fV0Reader->GetX();\r
+    values[5]=fV0Reader->GetY();\r
+    values[6]=fV0Reader->GetZ();\r
+    values[7]=fV0Reader->GetXYRadius();\r
+    values[8]=fV0Reader->GetMotherCandidateNDF();\r
+    values[9]=fV0Reader->GetMotherCandidateChi2();\r
+    values[10]=fV0Reader->GetMotherCandidateEnergy();\r
+    values[11]=fV0Reader->GetMotherCandidateEta();\r
+    values[12]=fV0Reader->GetMotherCandidatePt();\r
+    values[13]=fV0Reader->GetMotherCandidateMass();\r
+    values[14]=fV0Reader->GetMotherCandidateWidth();\r
+    //    values[15]=fV0Reader->GetMotherMCParticle()->Pt();   MOVED TO THE END, HAS TO BE CALLED AFTER HasSameMother NB: still has the same entry in the array\r
+    values[16]=fV0Reader->GetOpeningAngle();\r
+    values[17]=fV0Reader->GetNegativeTrackEnergy();\r
+    values[18]=fV0Reader->GetNegativeTrackPt();\r
+    values[19]=fV0Reader->GetNegativeTrackEta();\r
+    values[20]=fV0Reader->GetNegativeTrackPhi();\r
+    values[21]=fV0Reader->GetPositiveTrackEnergy();\r
+    values[22]=fV0Reader->GetPositiveTrackPt();\r
+    values[23]=fV0Reader->GetPositiveTrackEta();\r
+    values[24]=fV0Reader->GetPositiveTrackPhi();\r
+    values[25]=fV0Reader->HasSameMCMother();\r
+    if(values[25] != 0){\r
+      values[26]=fV0Reader->GetMotherMCParticlePDGCode();\r
+      values[15]=fV0Reader->GetMotherMCParticle()->Pt();\r
+    }\r
+    fTotalNumberOfAddedNtupleEntries++;\r
+    fGammaNtuple->Fill(values);\r
+  }\r
+  fV0Reader->ResetV0IndexNumber();\r
+  \r
+}\r
+\r
 void AliAnalysisTaskGammaConversion::ProcessV0s(){\r
   // see header file for documentation\r
 \r
+  if(fWriteNtuple == kTRUE){\r
+    FillNtuple();\r
+  }\r
+\r
   Int_t nSurvivingV0s=0;\r
   while(fV0Reader->NextV0()){\r
     nSurvivingV0s++;\r
@@ -606,7 +667,24 @@ void AliAnalysisTaskGammaConversion::UserCreateOutputObjects()
   if(fOutputContainer == NULL){\r
     fOutputContainer = new TList();\r
   }\r
+  \r
+  //Adding the histograms to the output container\r
   fHistograms->GetOutputContainer(fOutputContainer);\r
+\r
+  \r
+  if(fWriteNtuple){\r
+    if(fGammaNtuple == NULL){\r
+      fGammaNtuple = new TNtuple("V0ntuple","V0ntuple","OnTheFly:HasVertex:NegPIDProb:PosPIDProb:X:Y:Z:R:MotherCandidateNDF:MotherCandidateChi2:MotherCandidateEnergy:MotherCandidateEta:MotherCandidatePt:MotherCandidateMass:MotherCandidateWidth:MCMotherCandidatePT:EPOpeningAngle:ElectronEnergy:ElectronPt:ElectronEta:ElectronPhi:PositronEnergy:PositronPt:PositronEta:PositronPhi:HasSameMCMother:MotherMCParticlePIDCode",50000);\r
+    }\r
+    if(fNeutralMesonNtuple == NULL){\r
+      fNeutralMesonNtuple = new TNtuple("NeutralMesonNtuple","NeutralMesonNtuple","test");\r
+    }\r
+    TList * ntupleTList = new TList();\r
+    ntupleTList->SetName("Ntuple");\r
+    ntupleTList->Add((TNtuple*)fGammaNtuple);\r
+    fOutputContainer->Add(ntupleTList);\r
+  }\r
+\r
   fOutputContainer->SetName(GetName());\r
 }\r
 \r
index 9e48cdf..bcff03f 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliAnalysisTaskSE.h"\r
 #include <vector>\r
 #include "AliV0Reader.h"\r
+#include "TNtuple.h"\r
 \r
 class AliGammaConversionHistograms;\r
 class AliESDv0;\r
@@ -53,6 +54,8 @@ class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE
     void SetV0Reader(AliV0Reader* reader){fV0Reader=reader;}\r
     void SetCalculateBackground(Bool_t bg){fCalculateBackground=bg;}\r
     void CalculateBackground();\r
+    void SetWriteNtuple(Bool_t writeNtuple){fWriteNtuple = writeNtuple;}\r
+    void FillNtuple();\r
     Double_t GetMCOpeningAngle(TParticle* daughter0, TParticle* daughter1) const;\r
 \r
  private:\r
@@ -87,9 +90,13 @@ class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE
     Double_t fPi0Width;\r
     Double_t fEtaWidth;\r
     Bool_t fCalculateBackground;\r
+    Bool_t fWriteNtuple;\r
+    TNtuple *fGammaNtuple;\r
+    TNtuple *fNeutralMesonNtuple;\r
 \r
+    Int_t fTotalNumberOfAddedNtupleEntries;\r
 \r
-    ClassDef(AliAnalysisTaskGammaConversion, 0); // Analysis task for gamma conversions\r
+    ClassDef(AliAnalysisTaskGammaConversion, 1); // Analysis task for gamma conversions\r
 };\r
  \r
 #endif //ALIANALYSISTASKGAMMA_H\r
index 08ada54..2ca295f 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
  *                                                                        *\r
  * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                        *\r
- * Version 1.0                                                            *\r
+ * Version 1.1                                                            *\r
  *                                                                        *\r
  * Permission to use, copy, modify and distribute this software and its   *\r
  * documentation strictly for non-commercial purposes is hereby granted   *\r
@@ -43,7 +43,14 @@ AliGammaConversionHistograms::AliGammaConversionHistograms() :
   fMinPhi(0.),\r
   fMaxPhi(0.),\r
   fDeltaPhi(0.),\r
-  fMappingContainer(NULL)\r
+  fMappingContainer(NULL),\r
+  fBackgroundContainer(NULL),\r
+  fDebugContainer(NULL),\r
+  fResolutionContainer(NULL),\r
+  fMatchContainer(NULL),\r
+  fESDContainer(NULL),\r
+  fMCContainer(NULL),\r
+  fOtherContainer(NULL)\r
 {\r
   // see header file for documenation\r
 }\r
@@ -59,7 +66,14 @@ AliGammaConversionHistograms::AliGammaConversionHistograms(const AliGammaConvers
   fMinPhi(original.fMinPhi),\r
   fMaxPhi(original.fMaxPhi),\r
   fDeltaPhi(original.fDeltaPhi),\r
-  fMappingContainer(original.fMappingContainer)\r
+  fMappingContainer(original.fMappingContainer),\r
+  fBackgroundContainer(original.fBackgroundContainer),\r
+  fDebugContainer(original.fDebugContainer),\r
+  fResolutionContainer(original.fResolutionContainer),\r
+  fMatchContainer(original.fMatchContainer),\r
+  fESDContainer(original.fESDContainer),\r
+  fMCContainer(original.fMCContainer),\r
+  fOtherContainer(original.fOtherContainer)\r
 {    \r
   //see header file for documentation\r
 }\r
@@ -102,9 +116,6 @@ void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t
   if(tmp){\r
       tmp->Fill(xValue);\r
   }\r
-  else{\r
-    cout<<"Histogram does not exist: "<<histogramName.Data()<<endl;\r
-  }\r
 }\r
 \r
 void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t xValue, Double_t yValue) const{\r
@@ -113,9 +124,6 @@ void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t
   if(tmp){\r
     tmp->Fill(xValue, yValue);\r
   }\r
-  else{\r
-    cout<<"Histogram does not exist: "<<histogramName.Data()<<endl;\r
-  }\r
 }\r
 \r
 void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){\r
@@ -140,10 +148,95 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fMappingContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
        }\r
       }\r
-      fOutputContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+      else if(histogramString.Contains("Background")){// means it should be put in the background folder\r
+       if(fBackgroundContainer == NULL){\r
+         fBackgroundContainer = new TList();\r
+         fBackgroundContainer->SetName("Background histograms");\r
+       }\r
+       if(fBackgroundContainer != NULL){\r
+         fBackgroundContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
+      else if(histogramString.Contains("Debug")){// means it should be put in the debug folder\r
+       if(fDebugContainer == NULL){\r
+         fDebugContainer = new TList();\r
+         fDebugContainer->SetName("Debug histograms");\r
+       }\r
+       if(fDebugContainer != NULL){\r
+         fDebugContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
+      else if(histogramString.Contains("Resolution")){// means it should be put in the resolution folder\r
+       if(fResolutionContainer == NULL){\r
+         fResolutionContainer = new TList();\r
+         fResolutionContainer->SetName("Resolution histograms");\r
+       }\r
+       if(fResolutionContainer != NULL){\r
+         fResolutionContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
+      else if(histogramString.Contains("Match")){// means it should be put in the mapping folder\r
+       if(fMatchContainer == NULL){\r
+         fMatchContainer = new TList();\r
+         fMatchContainer->SetName("Match histograms");\r
+       }\r
+       if(fMatchContainer != NULL){\r
+         fMatchContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
+      else if(histogramString.Contains("ESD")){// means it should be put in the ESD folder\r
+       if(fESDContainer == NULL){\r
+         fESDContainer = new TList();\r
+         fESDContainer->SetName("ESD histograms");\r
+       }\r
+       if(fESDContainer != NULL){\r
+         fESDContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
+      else if(histogramString.Contains("MC")){// means it should be put in the MC folder\r
+       if(fMCContainer == NULL){\r
+         fMCContainer = new TList();\r
+         fMCContainer->SetName("MC histograms");\r
+       }\r
+       if(fMCContainer != NULL){\r
+         fMCContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
+      else{\r
+       if(fOtherContainer == NULL){\r
+         fOtherContainer = new TList();\r
+         fOtherContainer->SetName("Other histograms");\r
+       }\r
+       if(fOtherContainer != NULL){\r
+         fOtherContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
       histogramName = NULL;\r
     } // end while\r
-    //   fOutputContainer->Add(fMappingContainer);\r
+    if(fMappingContainer != NULL){\r
+      fOutputContainer->Add(fMappingContainer);\r
+    }\r
+    if(fBackgroundContainer != NULL){\r
+      fOutputContainer->Add(fBackgroundContainer);\r
+    }\r
+    if(fDebugContainer != NULL){\r
+      fOutputContainer->Add(fDebugContainer);\r
+    }\r
+    if(fResolutionContainer != NULL){\r
+      fOutputContainer->Add(fResolutionContainer);\r
+    }\r
+    if(fMatchContainer != NULL){\r
+      fOutputContainer->Add(fMatchContainer);\r
+    }\r
+    if(fESDContainer != NULL){\r
+      fOutputContainer->Add(fESDContainer);\r
+    }\r
+    if(fMCContainer != NULL){\r
+      fOutputContainer->Add(fMCContainer);\r
+    }\r
+    if(fOtherContainer != NULL){\r
+      fOutputContainer->Add(fMCContainer);\r
+    }\r
   }\r
 }\r
 \r
index 8434d66..38ece70 100644 (file)
@@ -71,6 +71,13 @@ class AliGammaConversionHistograms{
   Double_t fDeltaPhi;\r
 \r
   TList * fMappingContainer;\r
+  TList * fBackgroundContainer;\r
+  TList * fDebugContainer;\r
+  TList * fResolutionContainer;\r
+  TList * fMatchContainer;\r
+  TList * fESDContainer;\r
+  TList * fMCContainer;\r
+  TList * fOtherContainer;\r
 \r
   \r
   ClassDef(AliGammaConversionHistograms,1)\r
index 7e39f1f..b5ecfba 100644 (file)
@@ -187,7 +187,9 @@ AliESDv0* AliV0Reader::GetV0(Int_t index){
   UpdateV0Information();\r
   return fCurrentV0;\r
 }\r
-\r
+Bool_t AliV0Reader::CheckForPrimaryVertex(){\r
+  return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;\r
+}\r
 \r
 Bool_t AliV0Reader::NextV0(){\r
   //see header file for documentation\r
@@ -199,28 +201,35 @@ Bool_t AliV0Reader::NextV0(){
     //checks if on the fly mode is set\r
     if ( !fCurrentV0->GetOnFlyStatus() ){\r
       fCurrentV0IndexNumber++;\r
-      fHistograms->FillHistogram("V0MassDebugCut1",GetMotherCandidateMass());\r
+      if(fHistograms != NULL){\r
+       fHistograms->FillHistogram("V0MassDebugCut1",GetMotherCandidateMass());\r
+      }\r
       continue;\r
     }\r
 \r
     if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {//checks if we have a vertex\r
       fCurrentV0IndexNumber++;\r
-      fHistograms->FillHistogram("V0MassDebugCut2",GetMotherCandidateMass());\r
+      if(fHistograms != NULL){\r
+       fHistograms->FillHistogram("V0MassDebugCut2",GetMotherCandidateMass());\r
+      }\r
       continue;\r
     }\r
 \r
     if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){\r
       fCurrentV0IndexNumber++;\r
-      fHistograms->FillHistogram("V0MassDebugCut3",GetMotherCandidateMass());\r
+      if(fHistograms != NULL){\r
+       fHistograms->FillHistogram("V0MassDebugCut3",GetMotherCandidateMass());\r
+      }\r
       continue;\r
     }\r
 \r
-\r
     fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);\r
  \r
     if(GetXYRadius()>fMaxR){ // cuts on distance from collision point\r
       fCurrentV0IndexNumber++;\r
-      fHistograms->FillHistogram("V0MassDebugCut4",GetMotherCandidateMass());\r
+      if(fHistograms != NULL){\r
+       fHistograms->FillHistogram("V0MassDebugCut4",GetMotherCandidateMass());\r
+      }\r
       continue;\r
     }\r
 \r
@@ -229,28 +238,35 @@ Bool_t AliV0Reader::NextV0(){
     if(fUseKFParticle){\r
       if(fCurrentMotherKFCandidate->GetNDF()<=0){\r
        fCurrentV0IndexNumber++;\r
-       fHistograms->FillHistogram("V0MassDebugCut5",GetMotherCandidateMass());\r
+       if(fHistograms != NULL){\r
+         fHistograms->FillHistogram("V0MassDebugCut5",GetMotherCandidateMass());\r
+       }\r
        continue;\r
       }\r
       Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();\r
       if(chi2V0 > fChi2CutConversion || chi2V0 <=0){\r
        fCurrentV0IndexNumber++;\r
-       fHistograms->FillHistogram("V0MassDebugCut6",GetMotherCandidateMass());\r
+       if(fHistograms != NULL){\r
+         fHistograms->FillHistogram("V0MassDebugCut6",GetMotherCandidateMass());\r
+       }\r
        continue;\r
       }\r
       \r
       if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){\r
        fCurrentV0IndexNumber++;\r
-       fHistograms->FillHistogram("V0MassDebugCut7",GetMotherCandidateMass());\r
+       if(fHistograms != NULL){\r
+         fHistograms->FillHistogram("V0MassDebugCut7",GetMotherCandidateMass());\r
+       }\r
        continue;\r
       }\r
       \r
       if(fMotherCandidateLorentzVector->Pt()<fPtCut){\r
        fCurrentV0IndexNumber++;\r
-       fHistograms->FillHistogram("V0MassDebugCut8",GetMotherCandidateMass());\r
+       if(fHistograms != NULL){\r
+         fHistograms->FillHistogram("V0MassDebugCut8",GetMotherCandidateMass());\r
+       }\r
        continue;\r
       }\r
-      \r
     }\r
     else if(fUseESDTrack){\r
       //TODO\r
@@ -335,8 +351,12 @@ void AliV0Reader::UpdateV0Information(){
   }\r
     \r
   if(fDoMC == kTRUE){\r
+    fMotherMCParticle= NULL;\r
     fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));\r
     fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));\r
+    if(fPositiveMCParticle->GetMother(0)>-1){\r
+      fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));\r
+    }\r
   }\r
   fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);\r
 }\r
@@ -348,8 +368,9 @@ Bool_t AliV0Reader::HasSameMCMother(){
   if(fDoMC == kTRUE){\r
     if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){\r
       if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))\r
-       fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));\r
-      iResult = kTRUE;\r
+       if(fMotherMCParticle){\r
+         iResult = kTRUE;\r
+       }\r
     }\r
   }\r
   return iResult;\r
@@ -378,6 +399,24 @@ Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut
   return iResult;\r
 }\r
 \r
+void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){\r
+\r
+  Double_t *posProbArray = new Double_t[10];\r
+  Double_t *negProbArray = new Double_t[10];\r
+  AliESDtrack* negTrack  = fESDEvent->GetTrack(fCurrentV0->GetNindex());\r
+  AliESDtrack* posTrack  = fESDEvent->GetTrack(fCurrentV0->GetPindex());\r
+  \r
+  negTrack->GetTPCpid(negProbArray);\r
+  posTrack->GetTPCpid(posProbArray);\r
+\r
+  if(negProbArray!=NULL && posProbArray!=NULL){\r
+    negPIDProb = negProbArray[GetSpeciesIndex(-1)];\r
+    posPIDProb = posProbArray[GetSpeciesIndex(1)];\r
+  }\r
+  delete [] posProbArray;\r
+  delete [] negProbArray;\r
+}\r
+\r
 void AliV0Reader::UpdateEventByEventData(){\r
   //see header file for documentation\r
 \r
index 41a3ab9..d6a376d 100644 (file)
@@ -90,14 +90,21 @@ class AliV0Reader : public TObject {
    * Returns the positive KF particle which belongs to fCurrentV0\r
    */\r
   AliKFParticle* GetPositiveKFParticle() const{return fCurrentPositiveKFParticle;}\r
+\r
   /*\r
    * Returns the KFParticle object of the 2 tracks.\r
    */\r
   AliKFParticle* GetMotherCandidateKFCombination() const{return fCurrentMotherKFCandidate;}\r
+\r
   /*\r
    * Checks the probablity that the PID of the particle is what we want it to be.\r
    */\r
   Bool_t CheckPIDProbability(Double_t negProbCut, Double_t posProbCut);\r
+  \r
+  /*\r
+   * Checks if the PID of the two particles are within our cuts.\r
+   */\r
+  void GetPIDProbability(Double_t &negPIDProb, Double_t &posPIDProb);\r
 \r
   /*\r
    *Get the negative MC TParticle from the stack \r
@@ -114,8 +121,17 @@ class AliV0Reader : public TObject {
    */\r
   TParticle * GetMotherMCParticle() const{return fMotherMCParticle;}\r
 \r
+  /*\r
+   * Flag to see if the v0 particles share the same mother\r
+   */\r
   Bool_t HasSameMCMother();\r
 \r
+\r
+  /*\r
+   *Get the PID of the MC mother particle\r
+   */\r
+  Int_t GetMotherMCParticlePDGCode() const{if(fMotherMCParticle != NULL){ cout<<"MCParticle exists"<<endl;} return fMotherMCParticle->GetPdgCode();}\r
+\r
   /*\r
    *Get the MC stack \r
    */\r
@@ -186,56 +202,207 @@ class AliV0Reader : public TObject {
    */\r
   Double_t GetOpeningAngle(){return fNegativeTrackLorentzVector->Angle(fPositiveTrackLorentzVector->Vect());}\r
 \r
+  /*\r
+   * Gets the Energy of the negative track.\r
+   */\r
   Double_t GetNegativeTrackEnergy() const{return fCurrentNegativeKFParticle->E();}\r
+\r
+  /*\r
+   * Gets the Energy of the positive track.\r
+   */\r
   Double_t GetPositiveTrackEnergy() const{return fCurrentPositiveKFParticle->E();}\r
+\r
+  /*\r
+   * Gets the Energy of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidateEnergy() const{return fCurrentMotherKFCandidate->E();}\r
 \r
+  /*\r
+   * Gets the Pt of the negative track.\r
+   */\r
   Double_t GetNegativeTrackPt() const{return fNegativeTrackLorentzVector->Pt();}\r
+\r
+  /*\r
+   * Gets the Pt of the positive track.\r
+   */\r
   Double_t GetPositiveTrackPt() const{return fPositiveTrackLorentzVector->Pt();}\r
+\r
+  /*\r
+   * Gets the Pt of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidatePt() const{return fMotherCandidateLorentzVector->Pt();}\r
 \r
+  /*\r
+   * Gets the Eta of the negative track.\r
+   */\r
   Double_t GetNegativeTrackEta() const{return fNegativeTrackLorentzVector->Eta();}\r
+  /*\r
+   * Gets the Eta of the positive track.\r
+   */\r
   Double_t GetPositiveTrackEta() const{return fPositiveTrackLorentzVector->Eta();}\r
+  /*\r
+   * Gets the Eta of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidateEta() const{return fMotherCandidateLorentzVector->Eta();}\r
 \r
+  /*\r
+   * Gets the NDF of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidateNDF() const{return fCurrentMotherKFCandidate->GetNDF();}\r
+\r
+  /*\r
+   * Gets the Chi2 of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidateChi2() const{return fCurrentMotherKFCandidate->GetChi2();}\r
+\r
+  /*\r
+   * Gets the Mass of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidateMass() const{return fMotherCandidateKFMass;}\r
+\r
+  /*\r
+   * Gets the Width of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidateWidth() const{return fMotherCandidateKFWidth;}\r
 \r
+  /*\r
+   * Gets the Phi of the negative track.\r
+   */\r
   Double_t GetNegativeTrackPhi() const;\r
+\r
+  /*\r
+   * Gets the Phi of the positive track.\r
+   */\r
   Double_t GetPositiveTrackPhi() const;\r
+\r
+  /*\r
+   * Gets the Phi of the mother candidate.\r
+   */\r
   Double_t GetMotherCandidatePhi() const;\r
 \r
+  /*\r
+   * Update data which need to be updated every event.\r
+   */\r
   void UpdateEventByEventData();\r
   \r
+  /*\r
+   * Gets the MaxRCut value.\r
+   */\r
   Double_t GetMaxRCut() const{return fMaxR;}\r
+\r
+  /*\r
+   * Gets the Eta cut value.\r
+   */\r
   Double_t GetEtaCut() const{return fEtaCut;}\r
+\r
+  /*\r
+   * Gets the Pt cut value.\r
+   */\r
   Double_t GetPtCut() const{return fPtCut;}\r
+\r
+  /*\r
+   * Gets the Chi2 cut value for the conversions.\r
+   */\r
   Double_t GetChi2CutConversion() const{return fChi2CutConversion;}\r
+\r
+  /*\r
+   * Gets the Chi2 cut value for the mesons.\r
+   */\r
   Double_t GetChi2CutMeson() const{return fChi2CutMeson;}\r
 \r
+  /*\r
+   * Sets the MaxRCut value.\r
+   */\r
   void SetMaxRCut(Double_t maxR){fMaxR=maxR;}\r
+\r
+  /*\r
+   * Sets the EtaCut value.\r
+   */\r
   void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}\r
+\r
+  /*\r
+   * Sets the PtCut value.\r
+   */\r
   void SetPtCut(Double_t ptCut){fPtCut=ptCut;}\r
+\r
+  /*\r
+   * Sets the Chi2Cut value for conversions.\r
+   */\r
   void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}\r
+\r
+  /*\r
+   * Sets the Chi2Cut for the mesons.\r
+   */\r
   void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}\r
   \r
+  /*\r
+   * Sets the XVertexCut value.\r
+   */\r
   void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;}\r
+\r
+  /*\r
+   * Sets the YVertexCut value.\r
+   */\r
   void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;}\r
+\r
+  /*\r
+   * Sets the ZVertexCut value.\r
+   */\r
   void SetZVertexCut(Double_t zVtx){fCurrentZValue=zVtx;}\r
+\r
+  /*\r
+   * Sets the PIDProbabilityCut value for track particles.\r
+   */\r
   void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;}\r
+\r
+  /*\r
+   * Sets the PIDProbability cut value for the negative track.\r
+   */\r
   void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}\r
+\r
+  /*\r
+   * Sets the PIDProbability cut value for the positive track.\r
+   */\r
   void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}\r
+\r
+  /*\r
+   * Sets the SigmaMassCut value.\r
+   */\r
   void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}\r
 \r
+  /*\r
+   * Sets the flag to enable/disable the usage of MC information. \r
+   */\r
   void SetDoMCTruth(Bool_t doMC){fDoMC = doMC;}\r
 \r
+  /*\r
+   * Updates the V0 information of the current V0.\r
+   */\r
   void UpdateV0Information();\r
 \r
+  /*\r
+   * Resets the V0 index.\r
+   */\r
+  void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}\r
+\r
+  /*\r
+   * Sets the histograms.\r
+   */\r
   void SetHistograms(AliGammaConversionHistograms *histograms){fHistograms=histograms;}\r
 \r
+  /*\r
+   * Check for primary vertex.\r
+   */\r
+  Bool_t CheckForPrimaryVertex();\r
+\r
+  /*\r
+   * Gets a vector of good v0s.\r
+   */\r
   vector<AliKFParticle> GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;}\r
+\r
+  /*\r
+   * Gets the vector of previous events v0s (for bacground analysis)\r
+   */\r
   vector<AliKFParticle> GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;}\r
 \r
  private:\r
index 7b1d101..c60ec31 100644 (file)
-\r
-/** ------------------------------ Monte Carlo flag -----------------------------------------*/\r
-Bool_t doMCTruth = kTRUE;\r
-/** ---------------------------- end Monte Carlo flag ---------------------------------------*/\r
-\r
-/** ------------------------- Choose KFParticle OR ESDTrack  --------------------------------*/\r
-Bool_t useKFParticle = kTRUE;\r
-Bool_t useESDTrack   = kFALSE;\r
-/** ----------------------- end Choose KFParticle OR ESDTrack  -----------------------------*/\r
-\r
-\r
-Bool_t calculateBackground = kTRUE;\r
-\r
-Int_t numberOfFilesToAnalyze=100;\r
-\r
-/** ---------------------------------- define cuts here ------------------------------------*/\r
-\r
-Int_t pidOfNegativeTrack=11;\r
-Int_t pidOfPositiveTrack=-11;\r
-\r
-Double_t maxRCut   = 200.;\r
-Double_t etaCut    = 1.2;\r
-Double_t ptCut     = 0.1;\r
-Double_t chi2CutConversion   = 20.;\r
-Double_t chi2CutMeson   = 20.;\r
-\r
-Double_t xVertexCut = 0.;\r
-Double_t yVertexCut = 0.;\r
-Double_t zVertexCut = 0.;\r
-\r
-Double_t sigmaCutGammaMass=0.0001;\r
-\r
-Bool_t useImprovedVertex = kTRUE;\r
-\r
-// define masses of different particles, this will be used by the KF particle\r
-// together with the width to set mass constraints. Units in GeV.\r
-Double_t electronMass = 0.00051099892;\r
-Double_t gammaMass    = 0.;\r
-Double_t pi0Mass      = 0.1349766;\r
-Double_t etaMass      = 0.54751;\r
-\r
-// define the width constraint used by KF particle.\r
-Double_t gammaWidth = 0.01;\r
-Double_t pi0Width   = 0.01;\r
-Double_t etaWidth   = 0.01;\r
-\r
-// define the probability of track being an electron\r
-Double_t probElectron = 0.5;\r
-\r
-/** ----------------------------------end define cuts here----------------------------------*/\r
-\r
-/** -------------------------------- Phi/R Mapping ---------------------------------------*/\r
-Int_t nPhiIndex = 18;\r
-Int_t nRIndex   = 40;\r
-\r
-Double_t minRadius   = 0.;\r
-Double_t maxRadius   = 200.;\r
-Double_t minPhi      = -TMath::Pi();\r
-Double_t maxPhi      = TMath::Pi();\r
-/** ------------------------------- end Phi/R Mapping ------------------------------------*/\r
-\r
-/** ------------------- 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 plotMCEPOpeningAngle                  = kTRUE;\r
-\r
-Bool_t plotMCEEnergy                         = kTRUE;\r
-Bool_t plotMCEPt                             = kTRUE;\r
-Bool_t plotMCEEta                            = kTRUE;\r
-Bool_t plotMCEPhi                            = kTRUE;\r
-\r
-Bool_t plotMCPEnergy                         = kTRUE;\r
-Bool_t plotMCPPt                             = kTRUE;\r
-Bool_t plotMCPEta                            = kTRUE;\r
-Bool_t plotMCPPhi                            = kTRUE;\r
-\r
-Bool_t plotMCGammaEnergy                     = kTRUE;\r
-Bool_t plotMCGammaPt                         = kTRUE;\r
-Bool_t plotMCGammaEta                        = kTRUE;\r
-Bool_t plotMCGammaPhi                        = kTRUE;\r
-\r
-Bool_t plotMCDirectGammaEnergy               = kTRUE;\r
-Bool_t plotMCDirectGammaPt                   = kTRUE;\r
-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
-\r
-Bool_t plotMCPi0Eta                          = kTRUE;\r
-Bool_t plotMCPi0Phi                          = kTRUE;\r
-Bool_t plotMCPi0Pt                           = kTRUE;\r
-Bool_t plotMCPi0Energy                       = kTRUE;\r
-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
-\r
-Bool_t plotMCEtaEta                          = kTRUE;\r
-Bool_t plotMCEtaPhi                          = kTRUE;\r
-Bool_t plotMCEtaPt                           = kTRUE;\r
-Bool_t plotMCEtaEnergy                       = kTRUE;\r
-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
-    \r
-// Histograms from esd tracks\r
-Bool_t plotESDEPR                            = kTRUE;\r
-Bool_t plotESDEPZR                           = kTRUE;\r
-Bool_t plotESDEPXY                           = kTRUE;\r
-Bool_t plotESDEPOpeningAngle                 = kTRUE;\r
-\r
-Bool_t plotESDEEnergy                        = kTRUE;\r
-Bool_t plotESDEPt                            = kTRUE;\r
-Bool_t plotESDEEta                           = kTRUE;\r
-Bool_t plotESDEPhi                           = kTRUE;\r
-\r
-Bool_t plotESDPEnergy                        = kTRUE;\r
-Bool_t plotESDPPt                            = kTRUE;\r
-Bool_t plotESDPEta                           = kTRUE;\r
-Bool_t plotESDPPhi                           = kTRUE;\r
-\r
-\r
-Bool_t plotESDGammaEnergy                    = kTRUE;\r
-Bool_t plotESDGammaPt                        = kTRUE;\r
-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
-\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
-\r
-Bool_t plotESDBackgroundOpeningAngleGamma    = kTRUE;\r
-Bool_t plotESDBackgroundEnergy               = kTRUE;\r
-Bool_t plotESDBackgroundPt                   = kTRUE;\r
-Bool_t plotESDBackgroundEta                  = kTRUE;\r
-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
-\r
-Bool_t plotMapping                           = kTRUE;       \r
-\r
-Bool_t plotResolutiondPt                     = kTRUE;\r
-Bool_t plotResolutiondR                      = kTRUE;\r
-Bool_t plotResolutiondZ                      = kTRUE;\r
-  \r
-Bool_t plotResolutiondRdPt                   = kTRUE;\r
-\r
-Bool_t plotResolutionMCPt                    = kTRUE;\r
-Bool_t plotResolutionMCR                     = kTRUE;\r
-Bool_t plotResolutionMCZ                     = kTRUE;\r
-\r
-Bool_t plotResolutionESDPt                   = kTRUE;\r
-Bool_t plotResolutionESDR                    = kTRUE;\r
-Bool_t plotResolutionESDZ                    = kTRUE;\r
-\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
-\r
-Bool_t plotPi0Spectra                        = kTRUE;\r
-Bool_t plotEtaSpectra                        = kTRUE;\r
-\r
-\r
-/** ----------------- end define which histograms to plot here -------------------------------*/\r
-\r
-\r
-\r
-/** ----------- Define the binning for the different plot types here -------------------------*/\r
-//R-plots\r
-Int_t nXBinsR = 1000;\r
-Double_t firstXBinR = 0.;\r
-Double_t lastXBinR = 250.;\r
-\r
-//ZR-plots\r
-Int_t nXBinsZR = 2000;\r
-Double_t firstXBinZR = -10.;\r
-Double_t lastXBinZR = 10.;\r
-Int_t nYBinsZR = 1000;\r
-Double_t firstYBinZR = 0.;\r
-Double_t lastYBinZR = 250.;\r
-\r
-//XY-plots\r
-Int_t nXBinsXY = 2000;\r
-Double_t firstXBinXY = -250.;\r
-Double_t lastXBinXY = 250.;\r
-Int_t nYBinsXY = 2000;\r
-Double_t firstYBinXY = -250.;\r
-Double_t lastYBinXY = 250.;\r
-\r
-//OpenAngle-plots\r
-Int_t nXBinsOpeningAngle = 200;\r
-Double_t firstXBinOpeningAngle = 0.;\r
-Double_t lastXBinOpeningAngle = TMath::Pi()/2;\r
-\r
-//Energy-plots\r
-Int_t nXBinsEnergy = 500;\r
-Double_t firstXBinEnergy = 0.;\r
-Double_t lastXBinEnergy = 5.;\r
-\r
-//Pt-plots\r
-Int_t nXBinsPt = 500;\r
-Double_t firstXBinPt = 0.;\r
-Double_t lastXBinPt = 5.;\r
-\r
-//Eta-plots\r
-Int_t nXBinsEta = 400;\r
-Double_t firstXBinEta = -2.;\r
-Double_t lastXBinEta = 2.;\r
-\r
-//Phi-plots\r
-Int_t nXBinsPhi = 720;\r
-Double_t firstXBinPhi = -TMath::Pi();\r
-Double_t lastXBinPhi = TMath::Pi();\r
-\r
-//Mapping-plots\r
-Int_t nXBinsMapping = 40;\r
-Double_t firstXBinMapping = -20.;\r
-Double_t lastXBinMapping = 20.;\r
-Int_t nYBinsMapping = 30;\r
-Double_t firstYBinMapping = -1.5;\r
-Double_t lastYBinMapping = 1.5;\r
-\r
-//ResolutionPlots\r
-//RESdPt\r
-Int_t nXBinsResdPt=500;\r
-Int_t firstXBinResdPt= 0;\r
-Int_t lastXBinResdPt=5;\r
-Int_t nYBinsResdPt=1000;\r
-Int_t firstYBinResdPt= -5;\r
-Int_t lastYBinResdPt=5;\r
-\r
-//RESdR\r
-Int_t nXBinsResdR=1000;\r
-Int_t firstXBinResdR= 0;\r
-Int_t lastXBinResdR=250;\r
-Int_t nYBinsResdR=1000;\r
-Int_t firstYBinResdR= -25;\r
-Int_t lastYBinResdR=25;\r
-\r
-//RESdZ\r
-Int_t nXBinsResdZ=2000;\r
-Int_t firstXBinResdZ= -20;\r
-Int_t lastXBinResdZ=20;\r
-Int_t nYBinsResdZ=1000;\r
-Int_t firstYBinResdZ= -20;\r
-Int_t lastYBinResdZ=20;\r
-\r
-//RESdRdPt\r
-Int_t nXBinsResdRdPt=1000;\r
-Int_t firstXBinResdRdPt= -22;\r
-Int_t lastXBinResdRdPt=22;\r
-Int_t nYBinsResdRdPt=1000;\r
-Int_t firstYBinResdRdPt= -5;\r
-Int_t lastYBinResdRdPt=5;\r
-\r
-\r
-//RESMCPt\r
-Int_t nXBinsResPt=500;\r
-Int_t firstXBinResPt= 0;\r
-Int_t lastXBinResPt=5;\r
-\r
-//RESMCR\r
-Int_t nXBinsResR=1000;\r
-Int_t firstXBinResR= 0;\r
-Int_t lastXBinResR=250;\r
-\r
-//RESMCZ\r
-Int_t nXBinsResZ=1000;\r
-Int_t firstXBinResZ= 0;\r
-Int_t lastXBinResZ=250;\r
-\r
-//GammaMass-plots\r
-Int_t nXBinsGammaMass = 100;\r
-Double_t firstXBinGammaMass = 0.;\r
-Double_t lastXBinGammaMass = 1.;\r
-\r
-//Pi0Mass-plots\r
-Int_t nXBinsPi0Mass = 100;\r
-Double_t firstXBinPi0Mass = 0.;\r
-Double_t lastXBinPi0Mass = 1.;\r
-\r
-//EtaMass-plots\r
-Int_t nXBinsEtaMass = 100;\r
-Double_t firstXBinEtaMass = 0.;\r
-Double_t lastXBinEtaMass = 1.;\r
-\r
-//GammaWidth-plots\r
-Int_t nXBinsGammaWidth = 100;\r
-Double_t firstXBinGammaWidth = 0.;\r
-Double_t lastXBinGammaWidth = 1.;\r
-\r
-//GammaChi2-plots\r
-Int_t nXBinsGammaChi2 = 100;\r
-Double_t firstXBinGammaChi2 = 0;\r
-Double_t lastXBinGammaChi2 = 100.;\r
-\r
-//GammaNDF-plots\r
-Int_t nXBinsGammaNDF = 10;\r
-Double_t firstXBinGammaNDF = 0.;\r
-Double_t lastXBinGammaNDF = 10.;\r
-\r
-//Spectra-plots\r
-Int_t nXBinsSpectra = 100;\r
-Double_t firstXBinSpectra = 0.;\r
-Double_t lastXBinSpectra = 1.;\r
-Int_t nYBinsSpectra = 500;\r
-Double_t firstYBinSpectra = 0.;\r
-Double_t lastYBinSpectra = 100.;\r
-\r
-/** ---------- end Define the binning for the different plot types here ----------------------*/\r
-\r
-\r
-\r
-/************************************************************************************************\r
- *                                                                                              *\r
- *                                                                                              *\r
- *                     EVERYTHING BELOW IS FOR DEVELOPERS ONLY                                  *\r
- *                                                                                              *\r
- *                                                                                              *\r
- ************************************************************************************************/\r
-\r
-void ConfigGammaConversion(const char *chainName, const char *sample, int limit = 0){\r
-  \r
-  build();//build (if necessary) and load the libraries needed\r
-\r
-  gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); // load the CreateChain macro\r
-\r
-  AliLog::SetGlobalLogLevel(AliLog::kError);\r
-\r
-  //-------------------------------- Creating the histograms -------------------------------\r
-  AliGammaConversionHistograms * histograms = new AliGammaConversionHistograms();\r
-\r
-  if(plotMCEPR == kTRUE){ histograms->AddHistogram("MC_EP_R","Radius of gamma conversion points",nXBinsR, firstXBinR, lastXBinR,"counts","cm");}\r
-  if(plotMCEPZR == kTRUE){ histograms->AddHistogram("MC_EP_ZR","Radius of gamma conversion points vs Z",nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "cm", "cm");}\r
-  if(plotMCEPXY == kTRUE){ histograms->AddHistogram("MC_EP_XY","Gamma XY converison point.",nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "cm", "cm");}\r
-  if(plotMCEPOpeningAngle == kTRUE){ histograms->AddHistogram("MC_EP_OpeningAngle","Opening angle of e+e- pairs from gamma conversion",nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "counts", "cm");}\r
-\r
-  if(plotMCEEnergy == kTRUE){ histograms->AddHistogram("MC_E_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotMCEPt == kTRUE){ histograms->AddHistogram("MC_E_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotMCEEta == kTRUE){ histograms->AddHistogram("MC_E_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotMCEPhi == kTRUE){ histograms->AddHistogram("MC_E_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-\r
-  if(plotMCPEnergy == kTRUE){ histograms->AddHistogram("MC_P_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotMCPPt == kTRUE){ histograms->AddHistogram("MC_P_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotMCPEta == kTRUE){ histograms->AddHistogram("MC_P_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotMCPPhi == kTRUE){ histograms->AddHistogram("MC_P_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-\r
-  if(plotMCGammaEnergy == kTRUE){ histograms->AddHistogram("MC_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotMCGammaPt == kTRUE){ histograms->AddHistogram("MC_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotMCGammaEta == kTRUE){ histograms->AddHistogram("MC_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotMCGammaPhi == kTRUE){ histograms->AddHistogram("MC_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-\r
-  if(plotMCDirectGammaEnergy == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotMCDirectGammaPt == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotMCDirectGammaEta == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotMCDirectGammaPhi == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-\r
-  if(plotMCMatchGammaEta == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotMCMatchGammaPhi == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-  if(plotMCMatchGammaPt == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  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_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
-  if(plotMCPi0Pt == kTRUE){ histograms->AddHistogram("MC_Pi0_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotMCPi0Energy == kTRUE){ histograms->AddHistogram("MC_Pi0_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotMCPi0Mass == kTRUE){ histograms->AddHistogram("MC_Pi0_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}\r
-  if(plotMCPi0OpeningAngle == kTRUE){ histograms->AddHistogram("MC_Pi0_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotMCPi0R == kTRUE){ histograms->AddHistogram("MC_Pi0_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  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
-  if(plotMCEtaEnergy == kTRUE){ histograms->AddHistogram("MC_Eta_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotMCEtaMass == kTRUE){ histograms->AddHistogram("MC_Eta_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}\r
-  if(plotMCEtaOpeningAngleGamma == kTRUE){ histograms->AddHistogram("MC_Eta_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotMCEtaR == kTRUE){ histograms->AddHistogram("MC_Eta_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotMCEtaZR == kTRUE){ histograms->AddHistogram("MC_Eta_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotMCEtaXY == kTRUE){ histograms->AddHistogram("MC_Eta_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
-    \r
-  // Histograms from esd tracks\r
-  if(plotESDEPR == kTRUE){ histograms->AddHistogram("ESD_EP_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotESDEPZR == kTRUE){ histograms->AddHistogram("ESD_EP_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotESDEPXY == kTRUE){ histograms->AddHistogram("ESD_EP_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
-  if(plotESDEPOpeningAngle == kTRUE){ histograms->AddHistogram("ESD_EP_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-\r
-  if(plotESDEEnergy == kTRUE){ histograms->AddHistogram("ESD_E_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotESDEPt == kTRUE){ histograms->AddHistogram("ESD_E_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotESDEEta == kTRUE){ histograms->AddHistogram("ESD_E_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDEPhi == kTRUE){ histograms->AddHistogram("ESD_E_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-\r
-  if(plotESDPEnergy == kTRUE){ histograms->AddHistogram("ESD_P_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotESDPPt == kTRUE){ histograms->AddHistogram("ESD_P_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotESDPEta == kTRUE){ histograms->AddHistogram("ESD_P_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDPPhi == kTRUE){ histograms->AddHistogram("ESD_P_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-\r
-  if(plotESDGammaEnergy == kTRUE){ histograms->AddHistogram("ESD_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotESDGammaPt == kTRUE){ histograms->AddHistogram("ESD_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotESDGammaEta == kTRUE){ histograms->AddHistogram("ESD_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDGammaPhi == kTRUE){ histograms->AddHistogram("ESD_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-\r
-  if(plotESDMatchGammaOpeningAngle == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotESDMatchGammaEnergy == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotESDMatchGammaPt == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotESDMatchGammaEta == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDMatchGammaPhi == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-  if(plotESDMatchGammaMass == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Mass" ,"" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass, "", "");}\r
-  if(plotESDMatchGammaWidth == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Width" ,"" , nXBinsGammaWidth, firstXBinGammaWidth, lastXBinGammaWidth, "", "");}\r
-  if(plotESDMatchGammaChi2 == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Chi2" ,"" , nXBinsGammaChi2, firstXBinGammaChi2, lastXBinGammaChi2, "", "");}\r
-  if(plotESDMatchGammaNDF == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_NDF" ,"" , nXBinsGammaNDF, firstXBinGammaNDF, lastXBinGammaNDF, "", "");}\r
-  if(plotESDMatchGammaR == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotESDMatchGammaZR == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotESDMatchGammaXY == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
-\r
-  if(plotESDTwoGammaCombinationOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotESDTwoGammaCombinationEnergy == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotESDTwoGammaCombinationPt == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotESDTwoGammaCombinationEta == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDTwoGammaCombinationPhi == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-  if(plotESDTwoGammaCombinationMass == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}\r
-  if(plotESDTwoGammaCombinationR == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  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
-  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
-  if(plotESDBackgroundEta == kTRUE){ histograms->AddHistogram("ESD_Background_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDBackgroundPhi == kTRUE){ histograms->AddHistogram("ESD_Background_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-  if(plotESDBackgroundMass == kTRUE){ histograms->AddHistogram("ESD_Background_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}\r
-  if(plotESDBackgroundR == kTRUE){ histograms->AddHistogram("ESD_Background_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotESDBackgroundZR == kTRUE){ histograms->AddHistogram("ESD_Background_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotESDBackgroundXY == kTRUE){ histograms->AddHistogram("ESD_Background_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
-\r
-  if(plotMapping == kTRUE){\r
-    histograms->InitializeMappingValues(nPhiIndex,nRIndex,nXBinsMapping,minRadius,maxRadius,nYBinsMapping,minPhi,maxPhi);\r
-    histograms->AddMappingHistograms(nPhiIndex,nRIndex,nXBinsMapping,minRadius,maxRadius,nYBinsMapping,minPhi,maxPhi);\r
-  }\r
-\r
-  if(plotResolutiondPt == kTRUE){histograms->AddHistogram("Resolution_dPt" ,"" , nXBinsResdPt, firstXBinResdPt, lastXBinResdPt, nYBinsResdPt, firstYBinResdPt, lastYBinResdPt, "", "");}\r
-  if(plotResolutiondR == kTRUE){histograms->AddHistogram("Resolution_dR" ,"" , nXBinsResdR, firstXBinResdR, lastXBinResdR, nYBinsResdR, firstYBinResdR, lastYBinResdR, "", "");}\r
-  if(plotResolutiondZ == kTRUE){histograms->AddHistogram("Resolution_dZ" ,"" , nXBinsResdZ, firstXBinResdZ, lastXBinResdZ, nYBinsResdZ, firstYBinResdZ, lastYBinResdZ, "", "");}\r
-  \r
-  if(plotResolutiondRdPt == kTRUE){histograms->AddHistogram("Resolution_dR_dPt" ,"" , nXBinsResdRdPt, firstXBinResdRdPt, lastXBinResdRdPt, nYBinsResdRdPt, firstYBinResdRdPt, lastYBinResdRdPt, "", "");}\r
-  \r
-  if(plotResolutionMCPt == kTRUE){histograms->AddHistogram("Resolution_MC_Pt" ,"" , nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}\r
-  if(plotResolutionMCR == kTRUE){histograms->AddHistogram("Resolution_MC_R" ,"" , nXBinsResR, firstXBinResR, lastXBinResR,"","");}\r
-  if(plotResolutionMCZ == kTRUE){histograms->AddHistogram("Resolution_MC_Z" ,"" , nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}\r
-  \r
-  if(plotResolutionESDPt == kTRUE){histograms->AddHistogram("Resolution_ESD_Pt" ,"" , nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}\r
-  if(plotResolutionESDR == kTRUE){histograms->AddHistogram("Resolution_ESD_R" ,"" , nXBinsResR, firstXBinResR, lastXBinResR,"","");}\r
-  if(plotResolutionESDZ == kTRUE){histograms->AddHistogram("Resolution_ESD_Z" ,"" , nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}\r
-  \r
-  if(plotNumberOfV0s == kTRUE){histograms->AddHistogram("NumberOfV0s","Number of v0s",100, 0, 100,"","");}\r
-  if(plotNumberOfSurvivingV0s == kTRUE){histograms->AddHistogram("NumberOfSurvivingV0s","Number of surviving v0s",100, 0, 100,"","");}\r
-\r
-  //  debug histograms\r
-  if(plotV0MassDebugCut1 == kTRUE){histograms->AddHistogram("V0MassDebugCut1" ,"debug1" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-  if(plotV0MassDebugCut2 == kTRUE){histograms->AddHistogram("V0MassDebugCut2" ,"debug2" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-  if(plotV0MassDebugCut3 == kTRUE){histograms->AddHistogram("V0MassDebugCut3" ,"debug3" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-  if(plotV0MassDebugCut4 == kTRUE){histograms->AddHistogram("V0MassDebugCut4" ,"debug4" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-  if(plotV0MassDebugCut5 == kTRUE){histograms->AddHistogram("V0MassDebugCut5" ,"debug5" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-  if(plotV0MassDebugCut6 == kTRUE){histograms->AddHistogram("V0MassDebugCut6" ,"debug6" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-  if(plotV0MassDebugCut7 == kTRUE){histograms->AddHistogram("V0MassDebugCut7" ,"debug7" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-  if(plotV0MassDebugCut8 == kTRUE){histograms->AddHistogram("V0MassDebugCut8" ,"debug8" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
-\r
-\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
-  //------------------------------ end Creating the histograms -----------------------------\r
-\r
-  // Create the Analysis manager\r
-  AliAnalysisManager *mgr  = new AliAnalysisManager("My Manager", "My Analysis");\r
-\r
-  // Define Input Event Handler \r
-  AliESDInputHandler* inpHandler = new AliESDInputHandler();\r
-\r
-  // Define Output Event Handler\r
-  AliAODHandler* aodHandler = new AliAODHandler();\r
-  aodHandler->SetOutputFileName("aodAliGammaConversion.root");\r
-  \r
-  // Define MC Truth Event Handler\r
-  AliMCEventHandler* mcHandler = new AliMCEventHandler();\r
-  \r
-  // Add Handlers to the Task Manager\r
-  mgr->SetInputEventHandler  (inpHandler);\r
-  mgr->SetOutputEventHandler (aodHandler);\r
-  mgr->SetMCtruthEventHandler(mcHandler);\r
-\r
-  // Be sure you are told what you are doing\r
-  mgr->SetDebugLevel(10);\r
-\r
-  // Declare Common Input Tchain\r
-  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("Chain",TChain::Class(),AliAnalysisManager::kInputContainer);\r
-\r
-  // Common Output Tree in common ‘default’ output file\r
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),AliAnalysisManager::kOutputContainer, "default");\r
-\r
-  // Private output objects\r
-  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histogramsAliGammaConversion", TList::Class(),AliAnalysisManager::kOutputContainer, "histogramsAliGammaConversion.root");\r
-\r
-\r
-  //------------------------ END: Define input/output handlers ---------------------------------------------------\r
-\r
-\r
-  //check for errors in the specified data\r
-  if(useKFParticle == kTRUE && useESDTrack == kTRUE){\r
-    //Print warning, cannot use both\r
-  }\r
-  if(useKFParticle == kFALSE && useESDTrack == kFALSE){\r
-    //Print warning, one have to be specified\r
-  }\r
-\r
-\r
-  //Create the V0Reader\r
-  AliV0Reader * v0Reader = new AliV0Reader();\r
-  if(useKFParticle){\r
-    v0Reader->UseKFParticle();\r
-  }\r
-  else if(useESDTrack){\r
-    v0Reader->UseESDTrack();\r
-  }\r
-  v0Reader->SetNegativeTrackPID(pidOfNegativeTrack);\r
-  v0Reader->SetPositiveTrackPID(pidOfPositiveTrack);\r
-  v0Reader->SetMaxRCut(maxRCut);\r
-  v0Reader->SetEtaCut(etaCut);\r
-  v0Reader->SetPtCut(ptCut);\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
-  gammaconversion->SetDebugLevel(10);\r
-  \r
-  gammaconversion->SetV0Reader(v0Reader);\r
-  gammaconversion->SetCalculateBackground(calculateBackground);\r
-  gammaconversion->Init();\r
-  \r
-  gammaconversion->SetElectronMass(electronMass);\r
-  gammaconversion->SetGammaMass(gammaMass);\r
-  gammaconversion->SetPi0Mass(pi0Mass);\r
-  gammaconversion->SetEtaMass(etaMass);\r
-\r
-  gammaconversion->SetGammaWidth(gammaWidth);\r
-  gammaconversion->SetPi0Width(pi0Width);\r
-  gammaconversion->SetEtaWidth(etaWidth);\r
-\r
-  // define the width constraint used by KF particle.\r
-  Double_t gammaWidth = 0.01;\r
-  Double_t pi0Width   = 0.01;\r
-  Double_t etaWidth   = 0.01;\r
-\r
-  gammaconversion->SetHistograms(histograms);\r
-  v0Reader->SetHistograms(histograms);// also give the pointer to the v0reader, for debugging cuts\r
-  \r
-  gammaconversion->SetDoMCTruth(doMCTruth);\r
-\r
-\r
-  // Add task to the manager \r
-  mgr->AddTask(gammaconversion);\r
-\r
-  // Connect I/O to the task\r
-  mgr->ConnectInput (gammaconversion, 0, cinput1);\r
-  mgr->ConnectOutput(gammaconversion, 0, coutput1);\r
-  mgr->ConnectOutput(gammaconversion, 1, coutput2);\r
-\r
-  TChain* chain= CreateESDChain(sample,numberOfFilesToAnalyze);\r
-  \r
-  mgr->InitAnalysis();\r
-  \r
-  mgr->PrintStatus();\r
-  \r
-  mgr->StartAnalysis("local",chain);\r
-}\r
-\r
-\r
-\r
-\r
-void build() {\r
-  TStopwatch timer;\r
-  timer.Start();\r
-  gSystem->Load("libTree.so");\r
-  gSystem->Load("libGeom");\r
-  //  gSystem->Load("libANALYSISalice");\r
-\r
-  ////\r
-  ////\r
-  //Setting up STEERBase.par//\r
-  ////\r
-  setupPar("STEERBase");\r
-  gSystem->Load("libSTEERBase.so");\r
-\r
-  ////\r
-  //Setting up ESD.par//\r
-  ////\r
-  setupPar("ESD");\r
-  gSystem->Load("libVMC.so");\r
-  gSystem->Load("libESD.so");\r
-\r
-  ////\r
-  //Setting up AOD.par//\r
-  ////\r
-  setupPar("AOD");\r
-  gSystem->Load("libAOD.so");\r
-                                                                \r
-  ////\r
-  //Setting up ANALYSIS.par//\r
-  ////\r
-  setupPar("ANALYSIS");\r
-  gSystem->Load("libANALYSIS.so");\r
-\r
-  ////\r
-  //Setting up ANALYSISalice.par//\r
-  ////\r
-  setupPar("ANALYSISalice");\r
-  gSystem->Load("libANALYSISalice.so");\r
-                                                                                                                                  \r
-  ////\r
-  //Setting up PWG4Gamma.par//\r
-  ////\r
-  //  setupPar("PWG4Gamma");\r
-  //  gSystem->Load("libPWG4Gamma.so");\r
-  setupPar("PWG4PartCorr");\r
-  gSystem->Load("libPWG4PartCorr.so");\r
-  //if head:: use PWG4PartCorr\r
-             \r
-  //gROOT->LoadMacro("AliAnalysisTaskPi0.cxx+");\r
-  // gROOT->LoadMacro("AliAnalysisTaskPtMC.cxx+");\r
-  //  gROOT->LoadMacro("AliAnalysisTaskPi0MC.cxx+");\r
-  //  gROOT->LoadMacro("AliAnaScale.cxx+");\r
-\r
-\r
-  //gROOT->LoadMacro("$ALICEROOT/PWG0/CreateESDChain.C");\r
-  //TChain* chain = CreateESDChain("files1.txt");\r
-\r
-\r
-\r
-  ////\r
-\r
-\r
-}\r
-\r
-Int_t setupPar(const char* pararchivename) {\r
-  ///////////////////\r
-  // Setup PAR File//\r
-  ///////////////////\r
-  if (pararchivename) {\r
-    char processline[1024];\r
-    sprintf(processline,".! tar xvzf %s.par",pararchivename);\r
-    gROOT->ProcessLine(processline);\r
-    const char* ocwd = gSystem->WorkingDirectory();\r
-    gSystem->ChangeDirectory(pararchivename);\r
-                                                                                                                                               \r
-    // check for BUILD.sh and execute\r
-    if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {\r
-      printf("*******************************\n");\r
-      printf("*** Building PAR archive    ***\n");\r
-      printf("*******************************\n");\r
-                                                                                                                                               \r
-      if (gSystem->Exec("PROOF-INF/BUILD.sh")) {\r
-        Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");\r
-        return -1;\r
-      }\r
-    }\r
-    // check for SETUP.C and execute\r
-    if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {\r
-      printf("*******************************\n");\r
-      printf("*** Setup PAR archive       ***\n");\r
-      printf("*******************************\n");\r
-      gROOT->Macro("PROOF-INF/SETUP.C");\r
-    }\r
-                                                                                                                                               \r
-    gSystem->ChangeDirectory("../");\r
-  }                                                                                                                                               \r
-  return 1;\r
-}\r
+
+/** VERSION NUMBER 0 */
+
+Bool_t usePWG4PartCorr = kTRUE;
+
+
+/** ------------------------------ Monte Carlo flag -----------------------------------------*/
+Bool_t doMCTruth = kTRUE;
+/** ---------------------------- end Monte Carlo flag ---------------------------------------*/
+
+/** ------------------------- Choose KFParticle OR ESDTrack  --------------------------------*/
+Bool_t useKFParticle = kTRUE;
+Bool_t useESDTrack   = kFALSE;
+/** ----------------------- end Choose KFParticle OR ESDTrack  -----------------------------*/
+
+
+Bool_t calculateBackground = kTRUE;
+
+Int_t numberOfFilesToAnalyze=2000;
+
+/** ---------------------------------- define cuts here ------------------------------------*/
+
+Int_t pidOfNegativeTrack=11;
+Int_t pidOfPositiveTrack=-11;
+
+Double_t maxRCut   = 200.;
+Double_t etaCut    = 1.2;
+Double_t ptCut     = 0.1;
+Double_t chi2CutConversion   = 20.;
+Double_t chi2CutMeson   = 20.;
+
+Double_t xVertexCut = 0.;
+Double_t yVertexCut = 0.;
+Double_t zVertexCut = 0.;
+
+Double_t sigmaCutGammaMass=0.0001;
+
+Bool_t useImprovedVertex = kTRUE;
+
+// define masses of different particles, this will be used by the KF particle
+// together with the width to set mass constraints. Units in GeV.
+Double_t electronMass = 0.00051099892;
+Double_t gammaMass    = 0.;
+Double_t pi0Mass      = 0.1349766;
+Double_t etaMass      = 0.54751;
+
+// define the width constraint used by KF particle.
+Double_t gammaWidth = 0.01;
+Double_t pi0Width   = 0.01;
+Double_t etaWidth   = 0.01;
+
+// define the probability of track being an electron
+Double_t probElectron = 0.5;
+
+/** ----------------------------------end define cuts here----------------------------------*/
+
+/** -------------------------------- Phi/R Mapping ---------------------------------------*/
+Int_t nPhiIndex = 18;
+Int_t nRIndex   = 40;
+
+Double_t minRadius   = 0.;
+Double_t maxRadius   = 200.;
+Double_t minPhi      = -TMath::Pi();
+Double_t maxPhi      = TMath::Pi();
+/** ------------------------------- end Phi/R Mapping ------------------------------------*/
+
+/** ------------------- define which histograms to plot here --------------------------------*/
+/**   NB: to change the bin numbers, see below the histogram flags                           */
+Bool_t plotMCEPR                                           = kTRUE;
+Bool_t plotMCEPZR                                          = kTRUE;
+Bool_t plotMCEPXY                                          = kTRUE;
+Bool_t plotMCEPOpeningAngle                                = kTRUE;
+
+Bool_t plotMCEEnergy                                       = kTRUE;
+Bool_t plotMCEPt                                           = kTRUE;
+Bool_t plotMCEEta                                          = kTRUE;
+Bool_t plotMCEPhi                                          = kTRUE;
+
+Bool_t plotMCPEnergy                                       = kTRUE;
+Bool_t plotMCPPt                                           = kTRUE;
+Bool_t plotMCPEta                                          = kTRUE;
+Bool_t plotMCPPhi                                          = kTRUE;
+
+Bool_t plotMCGammaEnergy                                   = kTRUE;
+Bool_t plotMCGammaPt                                       = kTRUE;
+Bool_t plotMCGammaEta                                      = kTRUE;
+Bool_t plotMCGammaPhi                                      = kTRUE;
+
+Bool_t plotMCDirectGammaEnergy                             = kTRUE;
+Bool_t plotMCDirectGammaPt                                 = kTRUE;
+Bool_t plotMCDirectGammaEta                                = kTRUE;
+Bool_t plotMCDirectGammaPhi                                = kTRUE;
+
+Bool_t plotMCMatchGammaEta                                 = kTRUE;
+Bool_t plotMCMatchGammaPhi                                 = kTRUE;
+Bool_t plotMCMatchGammaPt                                  = kTRUE;
+Bool_t plotMCMatchGammaEnergy                              = kTRUE;
+Bool_t plotMCMatchGammaMass                                = kTRUE;
+Bool_t plotMCMatchGammaOpeningAngle                        = kTRUE;
+Bool_t plotMCMatchGammaR                                   = kTRUE;
+Bool_t plotMCMatchGammaZR                                  = kTRUE;
+Bool_t plotMCMatchGammaXY                                  = kTRUE;
+
+Bool_t plotMCPi0Eta                                        = kTRUE;
+Bool_t plotMCPi0Phi                                        = kTRUE;
+Bool_t plotMCPi0Pt                                         = kTRUE;
+Bool_t plotMCPi0Energy                                     = kTRUE;
+Bool_t plotMCPi0Mass                                       = kTRUE;
+Bool_t plotMCPi0OpeningAngle                               = kTRUE;
+Bool_t plotMCPi0R                                          = kTRUE;
+Bool_t plotMCPi0ZR                                         = kTRUE;
+Bool_t plotMCPi0XY                                         = kTRUE;
+
+Bool_t plotMCEtaEta                                        = kTRUE;
+Bool_t plotMCEtaPhi                                        = kTRUE;
+Bool_t plotMCEtaPt                                         = kTRUE;
+Bool_t plotMCEtaEnergy                                     = kTRUE;
+Bool_t plotMCEtaMass                                       = kTRUE;
+Bool_t plotMCEtaOpeningAngleGamma                          = kTRUE;
+Bool_t plotMCEtaR                                          = kTRUE;
+Bool_t plotMCEtaZR                                         = kTRUE;
+Bool_t plotMCEtaXY                                         = kTRUE;
+    
+// Histograms from esd tracks
+Bool_t plotESDEPR                                          = kTRUE;
+Bool_t plotESDEPZR                                         = kTRUE;
+Bool_t plotESDEPXY                                         = kTRUE;
+Bool_t plotESDEPOpeningAngle                               = kTRUE;
+
+Bool_t plotESDEEnergy                                      = kTRUE;
+Bool_t plotESDEPt                                          = kTRUE;
+Bool_t plotESDEEta                                         = kTRUE;
+Bool_t plotESDEPhi                                         = kTRUE;
+
+Bool_t plotESDPEnergy                                      = kTRUE;
+Bool_t plotESDPPt                                          = kTRUE;
+Bool_t plotESDPEta                                         = kTRUE;
+Bool_t plotESDPPhi                                         = kTRUE;
+
+
+Bool_t plotESDGammaEnergy                                  = kTRUE;
+Bool_t plotESDGammaPt                                      = kTRUE;
+Bool_t plotESDGammaEta                                     = kTRUE;
+Bool_t plotESDGammaPhi                                     = kTRUE;
+
+Bool_t plotESDMatchGammaOpeningAngle                       = kTRUE;
+Bool_t plotESDMatchGammaEnergy                             = kTRUE;
+Bool_t plotESDMatchGammaPt                                 = kTRUE;
+Bool_t plotESDMatchGammaEta                                = kTRUE;
+Bool_t plotESDMatchGammaPhi                                = kTRUE;
+Bool_t plotESDMatchGammaMass                               = kTRUE;
+Bool_t plotESDMatchGammaWidth                              = kTRUE;
+Bool_t plotESDMatchGammaChi2                               = kTRUE;
+Bool_t plotESDMatchGammaNDF                                = kTRUE;
+Bool_t plotESDMatchGammaR                                  = kTRUE;
+Bool_t plotESDMatchGammaZR                                 = kTRUE;
+Bool_t plotESDMatchGammaXY                                 = kTRUE;
+
+Bool_t plotESDTwoGammaCombinationOpeningAngleGamma         = kTRUE;
+Bool_t plotESDTwoGammaCombinationEnergy                    = kTRUE;
+Bool_t plotESDTwoGammaCombinationPt                        = kTRUE;
+Bool_t plotESDTwoGammaCombinationEta                       = kTRUE;
+Bool_t plotESDTwoGammaCombinationPhi                       = kTRUE;
+Bool_t plotESDTwoGammaCombinationMass                      = kTRUE;
+Bool_t plotESDTwoGammaCombinationR                         = kTRUE;
+Bool_t plotESDTwoGammaCombinationZR                        = kTRUE;
+Bool_t plotESDTwoGammaCombinationXY                        = kTRUE;
+
+Bool_t plotESDBackgroundOpeningAngleGamma                  = kTRUE;
+Bool_t plotESDBackgroundEnergy                             = kTRUE;
+Bool_t plotESDBackgroundPt                                 = kTRUE;
+Bool_t plotESDBackgroundEta                                = kTRUE;
+Bool_t plotESDBackgroundPhi                                = kTRUE;
+Bool_t plotESDBackgroundMass                               = kTRUE;
+Bool_t plotESDBackgroundR                                  = kTRUE;
+Bool_t plotESDBackgroundZR                                 = kTRUE;
+Bool_t plotESDBackgroundXY                                 = kTRUE;
+
+Bool_t plotMapping                                         = kTRUE;       
+
+Bool_t plotResolutiondPt                                   = kTRUE;
+Bool_t plotResolutiondR                                    = kTRUE;
+Bool_t plotResolutiondZ                                    = kTRUE;
+  
+Bool_t plotResolutiondRdPt                                 = kTRUE;
+
+Bool_t plotResolutionMCPt                                  = kTRUE;
+Bool_t plotResolutionMCR                                   = kTRUE;
+Bool_t plotResolutionMCZ                                   = kTRUE;
+
+Bool_t plotResolutionESDPt                                 = kTRUE;
+Bool_t plotResolutionESDR                                  = kTRUE;
+Bool_t plotResolutionESDZ                                  = kTRUE;
+
+Bool_t plotNumberOfV0s                                     = kTRUE;
+Bool_t plotNumberOfSurvivingV0s                            = kTRUE;
+
+  //  debug histograms
+Bool_t plotV0MassDebugCut1                                 = kTRUE;
+Bool_t plotV0MassDebugCut2                                 = kTRUE;
+Bool_t plotV0MassDebugCut3                                 = kTRUE;
+Bool_t plotV0MassDebugCut4                                 = kTRUE;
+Bool_t plotV0MassDebugCut5                                 = kTRUE;
+Bool_t plotV0MassDebugCut6                                 = kTRUE;
+Bool_t plotV0MassDebugCut7                                 = kTRUE;
+Bool_t plotV0MassDebugCut8                                 = kTRUE;
+
+Bool_t plotPi0Spectra                                      = kTRUE;
+Bool_t plotEtaSpectra                                      = kTRUE;
+
+
+/** ----------------- end define which histograms to plot here -------------------------------*/
+
+
+
+/** ----------- Define the binning for the different plot types here -------------------------*/
+//R-plots
+Int_t nXBinsR = 1000;
+Double_t firstXBinR = 0.;
+Double_t lastXBinR = 250.;
+
+//ZR-plots
+Int_t nXBinsZR = 2000;
+Double_t firstXBinZR = -10.;
+Double_t lastXBinZR = 10.;
+Int_t nYBinsZR = 1000;
+Double_t firstYBinZR = 0.;
+Double_t lastYBinZR = 250.;
+
+//XY-plots
+Int_t nXBinsXY = 2000;
+Double_t firstXBinXY = -250.;
+Double_t lastXBinXY = 250.;
+Int_t nYBinsXY = 2000;
+Double_t firstYBinXY = -250.;
+Double_t lastYBinXY = 250.;
+
+//OpenAngle-plots
+Int_t nXBinsOpeningAngle = 200;
+Double_t firstXBinOpeningAngle = 0.;
+Double_t lastXBinOpeningAngle = TMath::Pi()/2;
+
+//Energy-plots
+Int_t nXBinsEnergy = 500;
+Double_t firstXBinEnergy = 0.;
+Double_t lastXBinEnergy = 5.;
+
+//Pt-plots
+Int_t nXBinsPt = 500;
+Double_t firstXBinPt = 0.;
+Double_t lastXBinPt = 5.;
+
+//Eta-plots
+Int_t nXBinsEta = 400;
+Double_t firstXBinEta = -2.;
+Double_t lastXBinEta = 2.;
+
+//Phi-plots
+Int_t nXBinsPhi = 720;
+Double_t firstXBinPhi = -TMath::Pi();
+Double_t lastXBinPhi = TMath::Pi();
+
+//Mapping-plots
+Int_t nXBinsMapping = 40;
+Double_t firstXBinMapping = -20.;
+Double_t lastXBinMapping = 20.;
+Int_t nYBinsMapping = 30;
+Double_t firstYBinMapping = -1.5;
+Double_t lastYBinMapping = 1.5;
+
+//ResolutionPlots
+//RESdPt
+Int_t nXBinsResdPt=500;
+Int_t firstXBinResdPt= 0;
+Int_t lastXBinResdPt=5;
+Int_t nYBinsResdPt=1000;
+Int_t firstYBinResdPt= -5;
+Int_t lastYBinResdPt=5;
+
+//RESdR
+Int_t nXBinsResdR=1000;
+Int_t firstXBinResdR= 0;
+Int_t lastXBinResdR=250;
+Int_t nYBinsResdR=1000;
+Int_t firstYBinResdR= -25;
+Int_t lastYBinResdR=25;
+
+//RESdZ
+Int_t nXBinsResdZ=2000;
+Int_t firstXBinResdZ= -20;
+Int_t lastXBinResdZ=20;
+Int_t nYBinsResdZ=1000;
+Int_t firstYBinResdZ= -20;
+Int_t lastYBinResdZ=20;
+
+//RESdRdPt
+Int_t nXBinsResdRdPt=1000;
+Int_t firstXBinResdRdPt= -22;
+Int_t lastXBinResdRdPt=22;
+Int_t nYBinsResdRdPt=1000;
+Int_t firstYBinResdRdPt= -5;
+Int_t lastYBinResdRdPt=5;
+
+
+//RESMCPt
+Int_t nXBinsResPt=500;
+Int_t firstXBinResPt= 0;
+Int_t lastXBinResPt=5;
+
+//RESMCR
+Int_t nXBinsResR=1000;
+Int_t firstXBinResR= 0;
+Int_t lastXBinResR=250;
+
+//RESMCZ
+Int_t nXBinsResZ=1000;
+Int_t firstXBinResZ= 0;
+Int_t lastXBinResZ=250;
+
+//GammaMass-plots
+Int_t nXBinsGammaMass = 100;
+Double_t firstXBinGammaMass = 0.;
+Double_t lastXBinGammaMass = 1.;
+
+//Pi0Mass-plots
+Int_t nXBinsPi0Mass = 100;
+Double_t firstXBinPi0Mass = 0.;
+Double_t lastXBinPi0Mass = 1.;
+
+//EtaMass-plots
+Int_t nXBinsEtaMass = 100;
+Double_t firstXBinEtaMass = 0.;
+Double_t lastXBinEtaMass = 1.;
+
+//GammaWidth-plots
+Int_t nXBinsGammaWidth = 100;
+Double_t firstXBinGammaWidth = 0.;
+Double_t lastXBinGammaWidth = 1.;
+
+//GammaChi2-plots
+Int_t nXBinsGammaChi2 = 100;
+Double_t firstXBinGammaChi2 = 0;
+Double_t lastXBinGammaChi2 = 100.;
+
+//GammaNDF-plots
+Int_t nXBinsGammaNDF = 10;
+Double_t firstXBinGammaNDF = 0.;
+Double_t lastXBinGammaNDF = 10.;
+
+//Spectra-plots
+Int_t nXBinsSpectra = 100;
+Double_t firstXBinSpectra = 0.;
+Double_t lastXBinSpectra = 1.;
+Int_t nYBinsSpectra = 500;
+Double_t firstYBinSpectra = 0.;
+Double_t lastYBinSpectra = 100.;
+
+/** ---------- end Define the binning for the different plot types here ----------------------*/
+
+
+
+/************************************************************************************************
+ *                                                                                              *
+ *                                                                                              *
+ *                     EVERYTHING BELOW IS FOR DEVELOPERS ONLY                                  *
+ *                                                                                              *
+ *                                                                                              *
+ ************************************************************************************************/
+
+void ConfigGammaConversion(const char *chainName, const char *sample, Bool_t writeNtuple = kFALSE){
+  
+  build();//build (if necessary) and load the libraries needed
+
+  gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); // load the CreateChain macro
+
+  AliLog::SetGlobalLogLevel(AliLog::kError);
+
+  //-------------------------------- Creating the histograms -------------------------------
+  AliGammaConversionHistograms * histograms = new AliGammaConversionHistograms();
+
+  if(plotMCEPR == kTRUE){ histograms->AddHistogram("MC_EP_R","Radius of gamma conversion points",nXBinsR, firstXBinR, lastXBinR,"counts","cm");}
+  if(plotMCEPZR == kTRUE){ histograms->AddHistogram("MC_EP_ZR","Radius of gamma conversion points vs Z",nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "cm", "cm");}
+  if(plotMCEPXY == kTRUE){ histograms->AddHistogram("MC_EP_XY","Gamma XY converison point.",nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "cm", "cm");}
+  if(plotMCEPOpeningAngle == kTRUE){ histograms->AddHistogram("MC_EP_OpeningAngle","Opening angle of e+e- pairs from gamma conversion",nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "counts", "cm");}
+
+  if(plotMCEEnergy == kTRUE){ histograms->AddHistogram("MC_E_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCEPt == kTRUE){ histograms->AddHistogram("MC_E_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCEEta == kTRUE){ histograms->AddHistogram("MC_E_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCEPhi == kTRUE){ histograms->AddHistogram("MC_E_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+
+  if(plotMCPEnergy == kTRUE){ histograms->AddHistogram("MC_P_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCPPt == kTRUE){ histograms->AddHistogram("MC_P_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCPEta == kTRUE){ histograms->AddHistogram("MC_P_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCPPhi == kTRUE){ histograms->AddHistogram("MC_P_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+
+  if(plotMCGammaEnergy == kTRUE){ histograms->AddHistogram("MC_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCGammaPt == kTRUE){ histograms->AddHistogram("MC_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCGammaEta == kTRUE){ histograms->AddHistogram("MC_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCGammaPhi == kTRUE){ histograms->AddHistogram("MC_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+
+  if(plotMCDirectGammaEnergy == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCDirectGammaPt == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCDirectGammaEta == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCDirectGammaPhi == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+
+  if(plotMCMatchGammaEta == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCMatchGammaPhi == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+  if(plotMCMatchGammaPt == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCMatchGammaEnergy == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCMatchGammaMass == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Mass" ,"" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass, "", "");}
+  if(plotMCMatchGammaOpeningAngle == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+  if(plotMCMatchGammaR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotMCMatchGammaZR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotMCMatchGammaXY == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+
+  if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+  if(plotMCPi0Pt == kTRUE){ histograms->AddHistogram("MC_Pi0_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCPi0Energy == kTRUE){ histograms->AddHistogram("MC_Pi0_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCPi0Mass == kTRUE){ histograms->AddHistogram("MC_Pi0_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}
+  if(plotMCPi0OpeningAngle == kTRUE){ histograms->AddHistogram("MC_Pi0_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+  if(plotMCPi0R == kTRUE){ histograms->AddHistogram("MC_Pi0_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+
+  if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+  if(plotMCPi0Pt == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCPi0Energy == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCPi0Mass == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}
+  if(plotMCPi0OpeningAngle == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+  if(plotMCPi0R == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+
+  if(plotMCEtaEta == kTRUE){ histograms->AddHistogram("MC_Eta_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotMCEtaPhi == kTRUE){ histograms->AddHistogram("MC_Eta_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+  if(plotMCEtaPt == kTRUE){ histograms->AddHistogram("MC_Eta_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotMCEtaEnergy == kTRUE){ histograms->AddHistogram("MC_Eta_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotMCEtaMass == kTRUE){ histograms->AddHistogram("MC_Eta_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}
+  if(plotMCEtaOpeningAngleGamma == kTRUE){ histograms->AddHistogram("MC_Eta_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+  if(plotMCEtaR == kTRUE){ histograms->AddHistogram("MC_Eta_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotMCEtaZR == kTRUE){ histograms->AddHistogram("MC_Eta_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotMCEtaXY == kTRUE){ histograms->AddHistogram("MC_Eta_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+    
+  // Histograms from esd tracks
+  if(plotESDEPR == kTRUE){ histograms->AddHistogram("ESD_EP_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotESDEPZR == kTRUE){ histograms->AddHistogram("ESD_EP_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotESDEPXY == kTRUE){ histograms->AddHistogram("ESD_EP_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+  if(plotESDEPOpeningAngle == kTRUE){ histograms->AddHistogram("ESD_EP_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+
+  if(plotESDEEnergy == kTRUE){ histograms->AddHistogram("ESD_E_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotESDEPt == kTRUE){ histograms->AddHistogram("ESD_E_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotESDEEta == kTRUE){ histograms->AddHistogram("ESD_E_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotESDEPhi == kTRUE){ histograms->AddHistogram("ESD_E_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+
+  if(plotESDPEnergy == kTRUE){ histograms->AddHistogram("ESD_P_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotESDPPt == kTRUE){ histograms->AddHistogram("ESD_P_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotESDPEta == kTRUE){ histograms->AddHistogram("ESD_P_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotESDPPhi == kTRUE){ histograms->AddHistogram("ESD_P_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+
+  if(plotESDGammaEnergy == kTRUE){ histograms->AddHistogram("ESD_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotESDGammaPt == kTRUE){ histograms->AddHistogram("ESD_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotESDGammaEta == kTRUE){ histograms->AddHistogram("ESD_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotESDGammaPhi == kTRUE){ histograms->AddHistogram("ESD_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+
+  if(plotESDMatchGammaOpeningAngle == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+  if(plotESDMatchGammaEnergy == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotESDMatchGammaPt == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotESDMatchGammaEta == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotESDMatchGammaPhi == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+  if(plotESDMatchGammaMass == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Mass" ,"" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass, "", "");}
+  if(plotESDMatchGammaWidth == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Width" ,"" , nXBinsGammaWidth, firstXBinGammaWidth, lastXBinGammaWidth, "", "");}
+  if(plotESDMatchGammaChi2 == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Chi2" ,"" , nXBinsGammaChi2, firstXBinGammaChi2, lastXBinGammaChi2, "", "");}
+  if(plotESDMatchGammaNDF == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_NDF" ,"" , nXBinsGammaNDF, firstXBinGammaNDF, lastXBinGammaNDF, "", "");}
+  if(plotESDMatchGammaR == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotESDMatchGammaZR == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotESDMatchGammaXY == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+
+  if(plotESDTwoGammaCombinationOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+  if(plotESDTwoGammaCombinationEnergy == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotESDTwoGammaCombinationPt == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotESDTwoGammaCombinationEta == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotESDTwoGammaCombinationPhi == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+  if(plotESDTwoGammaCombinationMass == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}
+  if(plotESDTwoGammaCombinationR == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotESDTwoGammaCombinationZR == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotESDTwoGammaCombinationXY == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+
+  if(plotESDBackgroundOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_Background_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
+  if(plotESDBackgroundEnergy == kTRUE){ histograms->AddHistogram("ESD_Background_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
+  if(plotESDBackgroundPt == kTRUE){ histograms->AddHistogram("ESD_Background_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
+  if(plotESDBackgroundEta == kTRUE){ histograms->AddHistogram("ESD_Background_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
+  if(plotESDBackgroundPhi == kTRUE){ histograms->AddHistogram("ESD_Background_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
+  if(plotESDBackgroundMass == kTRUE){ histograms->AddHistogram("ESD_Background_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}
+  if(plotESDBackgroundR == kTRUE){ histograms->AddHistogram("ESD_Background_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
+  if(plotESDBackgroundZR == kTRUE){ histograms->AddHistogram("ESD_Background_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
+  if(plotESDBackgroundXY == kTRUE){ histograms->AddHistogram("ESD_Background_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
+
+  if(plotMapping == kTRUE){
+    histograms->InitializeMappingValues(nPhiIndex,nRIndex,nXBinsMapping,minRadius,maxRadius,nYBinsMapping,minPhi,maxPhi);
+    histograms->AddMappingHistograms(nPhiIndex,nRIndex,nXBinsMapping,minRadius,maxRadius,nYBinsMapping,minPhi,maxPhi);
+  }
+
+  if(plotResolutiondPt == kTRUE){histograms->AddHistogram("Resolution_dPt" ,"" , nXBinsResdPt, firstXBinResdPt, lastXBinResdPt, nYBinsResdPt, firstYBinResdPt, lastYBinResdPt, "", "");}
+  if(plotResolutiondR == kTRUE){histograms->AddHistogram("Resolution_dR" ,"" , nXBinsResdR, firstXBinResdR, lastXBinResdR, nYBinsResdR, firstYBinResdR, lastYBinResdR, "", "");}
+  if(plotResolutiondZ == kTRUE){histograms->AddHistogram("Resolution_dZ" ,"" , nXBinsResdZ, firstXBinResdZ, lastXBinResdZ, nYBinsResdZ, firstYBinResdZ, lastYBinResdZ, "", "");}
+  
+  if(plotResolutiondRdPt == kTRUE){histograms->AddHistogram("Resolution_dR_dPt" ,"" , nXBinsResdRdPt, firstXBinResdRdPt, lastXBinResdRdPt, nYBinsResdRdPt, firstYBinResdRdPt, lastYBinResdRdPt, "", "");}
+  
+  if(plotResolutionMCPt == kTRUE){histograms->AddHistogram("Resolution_MC_Pt" ,"" , nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}
+  if(plotResolutionMCR == kTRUE){histograms->AddHistogram("Resolution_MC_R" ,"" , nXBinsResR, firstXBinResR, lastXBinResR,"","");}
+  if(plotResolutionMCZ == kTRUE){histograms->AddHistogram("Resolution_MC_Z" ,"" , nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}
+  
+  if(plotResolutionESDPt == kTRUE){histograms->AddHistogram("Resolution_ESD_Pt" ,"" , nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}
+  if(plotResolutionESDR == kTRUE){histograms->AddHistogram("Resolution_ESD_R" ,"" , nXBinsResR, firstXBinResR, lastXBinResR,"","");}
+  if(plotResolutionESDZ == kTRUE){histograms->AddHistogram("Resolution_ESD_Z" ,"" , nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}
+  
+  if(plotNumberOfV0s == kTRUE){histograms->AddHistogram("NumberOfV0s","Number of v0s",100, 0, 100,"","");}
+  if(plotNumberOfSurvivingV0s == kTRUE){histograms->AddHistogram("NumberOfSurvivingV0s","Number of surviving v0s",100, 0, 100,"","");}
+
+  //  debug histograms
+  if(plotV0MassDebugCut1 == kTRUE){histograms->AddHistogram("V0MassDebugCut1" ,"debug1" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+  if(plotV0MassDebugCut2 == kTRUE){histograms->AddHistogram("V0MassDebugCut2" ,"debug2" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+  if(plotV0MassDebugCut3 == kTRUE){histograms->AddHistogram("V0MassDebugCut3" ,"debug3" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+  if(plotV0MassDebugCut4 == kTRUE){histograms->AddHistogram("V0MassDebugCut4" ,"debug4" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+  if(plotV0MassDebugCut5 == kTRUE){histograms->AddHistogram("V0MassDebugCut5" ,"debug5" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+  if(plotV0MassDebugCut6 == kTRUE){histograms->AddHistogram("V0MassDebugCut6" ,"debug6" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+  if(plotV0MassDebugCut7 == kTRUE){histograms->AddHistogram("V0MassDebugCut7" ,"debug7" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+  if(plotV0MassDebugCut8 == kTRUE){histograms->AddHistogram("V0MassDebugCut8" ,"debug8" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
+
+
+  if(plotPi0Spectra == kTRUE){histograms->AddHistogram("InvMass_vs_Pt_Spectra" ,"Invariant Mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}
+
+  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]");}
+
+  
+
+  //------------------------------ end Creating the histograms -----------------------------
+
+  // Create the Analysis manager
+  AliAnalysisManager *mgr  = new AliAnalysisManager("My Manager", "My Analysis");
+
+  // Define Input Event Handler 
+  AliESDInputHandler* inpHandler = new AliESDInputHandler();
+
+  // Define Output Event Handler
+  AliAODHandler* aodHandler = new AliAODHandler();
+  aodHandler->SetOutputFileName("aodAliGammaConversion.root");
+  
+  // Define MC Truth Event Handler
+  AliMCEventHandler* mcHandler = new AliMCEventHandler();
+  
+  // Add Handlers to the Task Manager
+  mgr->SetInputEventHandler  (inpHandler);
+  mgr->SetOutputEventHandler (aodHandler);
+  mgr->SetMCtruthEventHandler(mcHandler);
+
+  // Be sure you are told what you are doing
+  mgr->SetDebugLevel(10);
+
+  // Declare Common Input Tchain
+  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("Chain",TChain::Class(),AliAnalysisManager::kInputContainer);
+
+  // Common Output Tree in common â\80\98defaultâ\80\99 output file
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),AliAnalysisManager::kOutputContainer, "default");
+
+  // Private output objects
+  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histogramsAliGammaConversion", TList::Class(),AliAnalysisManager::kOutputContainer, "histogramsAliGammaConversion.root");
+
+
+  //------------------------ END: Define input/output handlers ---------------------------------------------------
+
+
+  //check for errors in the specified data
+  if(useKFParticle == kTRUE && useESDTrack == kTRUE){
+    //Print warning, cannot use both
+  }
+  if(useKFParticle == kFALSE && useESDTrack == kFALSE){
+    //Print warning, one have to be specified
+  }
+
+
+  //Create the V0Reader
+  AliV0Reader * v0Reader = new AliV0Reader();
+  if(useKFParticle){
+    v0Reader->UseKFParticle();
+  }
+  else if(useESDTrack){
+    v0Reader->UseESDTrack();
+  }
+  v0Reader->SetNegativeTrackPID(pidOfNegativeTrack);
+  v0Reader->SetPositiveTrackPID(pidOfPositiveTrack);
+  v0Reader->SetMaxRCut(maxRCut);
+  v0Reader->SetEtaCut(etaCut);
+  v0Reader->SetPtCut(ptCut);
+  v0Reader->SetChi2CutConversion(chi2CutConversion);
+  v0Reader->SetChi2CutMeson(chi2CutMeson);
+  v0Reader->SetPIDProbability(probElectron);
+  v0Reader->SetXVertexCut(xVertexCut);
+  v0Reader->SetYVertexCut(yVertexCut);
+  v0Reader->SetZVertexCut(zVertexCut);
+  v0Reader->SetSigmaMass(sigmaCutGammaMass);
+  v0Reader->SetUseImprovedVertex(useImprovedVertex);
+  v0Reader->SetDoMCTruth(doMCTruth);
+
+  // Create the GammaConversionTask
+  AliAnalysisTaskGammaConversion *gammaconversion = new AliAnalysisTaskGammaConversion("GammaConversionTask");
+  gammaconversion->SetDebugLevel(10);
+
+  gammaconversion->SetWriteNtuple(writeNtuple);
+
+  gammaconversion->SetV0Reader(v0Reader);
+  gammaconversion->SetCalculateBackground(calculateBackground);
+  gammaconversion->Init();
+  
+  gammaconversion->SetElectronMass(electronMass);
+  gammaconversion->SetGammaMass(gammaMass);
+  gammaconversion->SetPi0Mass(pi0Mass);
+  gammaconversion->SetEtaMass(etaMass);
+
+  gammaconversion->SetGammaWidth(gammaWidth);
+  gammaconversion->SetPi0Width(pi0Width);
+  gammaconversion->SetEtaWidth(etaWidth);
+
+  // define the width constraint used by KF particle.
+  Double_t gammaWidth = 0.01;
+  Double_t pi0Width   = 0.01;
+  Double_t etaWidth   = 0.01;
+
+  gammaconversion->SetHistograms(histograms);
+  v0Reader->SetHistograms(histograms);// also give the pointer to the v0reader, for debugging cuts
+  
+  gammaconversion->SetDoMCTruth(doMCTruth);
+
+
+  // Add task to the manager 
+  mgr->AddTask(gammaconversion);
+
+  // Connect I/O to the task
+  mgr->ConnectInput (gammaconversion, 0, cinput1);
+  mgr->ConnectOutput(gammaconversion, 0, coutput1);
+  mgr->ConnectOutput(gammaconversion, 1, coutput2);
+
+  TChain* chain= CreateESDChain(sample,numberOfFilesToAnalyze);
+  
+  mgr->InitAnalysis();
+  
+  mgr->PrintStatus();
+  
+  mgr->StartAnalysis("local",chain);
+}
+
+
+
+
+void build() {
+  TStopwatch timer;
+  timer.Start();
+  gSystem->Load("libTree.so");
+  gSystem->Load("libGeom");
+  //  gSystem->Load("libANALYSISalice");
+
+  ////
+  //Setting up ESD.par//
+  ////
+  cout<<"compiling ESD"<<endl;
+  setupPar("ESD");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libESD.so");
+
+  ////
+  ////
+  //Setting up STEERBase.par//
+  ////
+  cout<<"compiling STEERBase"<<endl;
+  setupPar("STEERBase");
+  gSystem->Load("libSTEERBase.so");
+
+  ////
+  //Setting up AOD.par//
+  ////
+  cout<<"compiling AOD"<<endl;
+  setupPar("AOD");
+  gSystem->Load("libAOD.so");
+                                                                
+  ////
+  //Setting up ANALYSIS.par//
+  ////
+  cout<<"compiling ANALYSIS"<<endl;
+  setupPar("ANALYSIS");
+  gSystem->Load("libANALYSIS.so");
+
+  ////
+  //Setting up ANALYSISalice.par//
+  ////
+  cout<<"compiling ANALUSISalice"<<endl;
+  setupPar("ANALYSISalice");
+  gSystem->Load("libANALYSISalice.so");
+                                                                                                                                  
+  ////
+  //Setting up PWG4Gamma.par//
+  ////
+  //  cout<<"compiling GammaConv"<<endl;
+
+  if(usePWG4PartCorr == kTRUE){
+    cout<<"Using PWG4PartCorr library"<<endl;
+    setupPar("PWG4PartCorr");
+    gSystem->Load("libPWG4PartCorr.so");  
+  }
+  else{
+    setupPar("PWG4GammaConv");
+    gSystem->Load("libPWG4GammaConv.so");
+  }
+  //if head:: use PWG4PartCorr
+}
+
+Int_t setupPar(const char* pararchivename) {
+  ///////////////////
+  // Setup PAR File//
+  ///////////////////
+  if (pararchivename) {
+    char processline[1024];
+    sprintf(processline,".! tar xvzf %s.par",pararchivename);
+    gROOT->ProcessLine(processline);
+    const char* ocwd = gSystem->WorkingDirectory();
+    gSystem->ChangeDirectory(pararchivename);
+                                                                                                                                               
+    // check for BUILD.sh and execute
+    if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
+      printf("*******************************\n");
+      printf("*** Building PAR archive    ***\n");
+      printf("*******************************\n");
+                                                                                                                                               
+      if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
+        Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
+        return -1;
+      }
+    }
+    // check for SETUP.C and execute
+    if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
+      printf("*******************************\n");
+      printf("*** Setup PAR archive       ***\n");
+      printf("*******************************\n");
+      gROOT->Macro("PROOF-INF/SETUP.C");
+    }
+                                                                                                                                               
+    gSystem->ChangeDirectory("../");
+  }                                                                                                                                               
+  return 1;
+}