bugs corrected
[u/mrichter/AliRoot.git] / PWG4 / PartCorr / AliGammaConversionHistograms.cxx
index cd9f6ee..08ada54 100644 (file)
@@ -42,7 +42,8 @@ AliGammaConversionHistograms::AliGammaConversionHistograms() :
   fDeltaR(0.),\r
   fMinPhi(0.),\r
   fMaxPhi(0.),\r
-  fDeltaPhi(0.)\r
+  fDeltaPhi(0.),\r
+  fMappingContainer(NULL)\r
 {\r
   // see header file for documenation\r
 }\r
@@ -57,7 +58,8 @@ AliGammaConversionHistograms::AliGammaConversionHistograms(const AliGammaConvers
   fDeltaR(original.fDeltaR),\r
   fMinPhi(original.fMinPhi),\r
   fMaxPhi(original.fMaxPhi),\r
-  fDeltaPhi(original.fDeltaPhi)\r
+  fDeltaPhi(original.fDeltaPhi),\r
+  fMappingContainer(original.fMappingContainer)\r
 {    \r
   //see header file for documentation\r
 }\r
@@ -101,7 +103,7 @@ void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t
       tmp->Fill(xValue);\r
   }\r
   else{\r
-    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
+    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
   }\r
 }\r
 \r
@@ -112,208 +114,37 @@ void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t
     tmp->Fill(xValue, yValue);\r
   }\r
   else{\r
-    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
+    cout<<"Histogram does not exist"<<histogramName.Data()<<endl;\r
   }\r
 }\r
 \r
-void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer) const{\r
+void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){\r
   //checking if the container is alrerady created\r
 \r
   if(fOutputContainer == NULL){\r
     //print warning\r
     return;\r
   }\r
-  cout<<"Creating the histogram output container"<<endl;\r
 \r
-  if(fHistogramMap){\r
+  if(fHistogramMap != NULL){\r
     TIter iter(fHistogramMap);\r
     TObjString *histogramName;\r
     while ((histogramName = (TObjString*) iter.Next())) {\r
-      cout<<"Histohram name "<<histogramName->GetString().Data()<<endl;\r
       TString histogramString = histogramName->GetString();\r
+      if(histogramString.Contains("Mapping")){// means it should be put in the mapping folder\r
+       if(fMappingContainer == NULL){\r
+         fMappingContainer = new TList();\r
+         fMappingContainer->SetName("Mapping histograms");\r
+       }\r
+       if(fMappingContainer != NULL){\r
+         fMappingContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
+       }\r
+      }\r
       fOutputContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));\r
       histogramName = NULL;\r
-    }  \r
-  }\r
-\r
-  //remember mapping stuff!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r
-\r
-\r
-  /*\r
-  TList*  fMappingContainer = new TList();\r
-  fMappingContainer->SetName("Mapping Histograms");\r
-\r
-  if(fMCEPR != NULL){ fOutputContainer->Add(fMCEPR);}\r
-  if(fMCEPZR != NULL){ fOutputContainer->Add(fMCEPZR);}\r
-  if(fMCEPXY != NULL){ fOutputContainer->Add(fMCEPXY);}\r
-  if(fMCEPOpeningAngle != NULL){ fOutputContainer->Add(fMCEPOpeningAngle);}\r
-\r
-  if(fMCEEnergy != NULL){ fOutputContainer->Add(fMCEEnergy);}\r
-  if(fMCEPt != NULL){ fOutputContainer->Add(fMCEPt);}\r
-  if(fMCEEta != NULL){ fOutputContainer->Add(fMCEEta);}\r
-  if(fMCEPhi != NULL){ fOutputContainer->Add(fMCEPhi);}\r
-\r
-  if(fMCPEnergy != NULL){ fOutputContainer->Add(fMCPEnergy);}\r
-  if(fMCPPt != NULL){ fOutputContainer->Add(fMCPPt);}\r
-  if(fMCPEta != NULL){ fOutputContainer->Add(fMCPEta);}\r
-  if(fMCPPhi != NULL){ fOutputContainer->Add(fMCPPhi);}\r
-\r
-  if(fMCGammaEnergy != NULL){ fOutputContainer->Add(fMCGammaEnergy);}\r
-  if(fMCGammaPt != NULL){ fOutputContainer->Add(fMCGammaPt);}\r
-  if(fMCGammaEta != NULL){ fOutputContainer->Add(fMCGammaEta);}\r
-  if(fMCGammaPhi != NULL){ fOutputContainer->Add(fMCGammaPhi);}\r
-\r
-  if(fMCDirectGammaEnergy != NULL){ fOutputContainer->Add(fMCDirectGammaEnergy);}\r
-  if(fMCDirectGammaPt != NULL){ fOutputContainer->Add(fMCDirectGammaPt);}\r
-  if(fMCDirectGammaEta != NULL){ fOutputContainer->Add(fMCDirectGammaEta);}\r
-  if(fMCDirectGammaPhi != NULL){ fOutputContainer->Add(fMCDirectGammaPhi);}\r
-\r
-  //mapping\r
-  for(UInt_t i=0;i<fMCMapping.size();i++){\r
-    for(UInt_t j=0;j<fMCMapping[i].size();j++){\r
-      if(fMCMapping[i][j] != NULL){fMappingContainer->Add(fMCMapping[i][j]);}\r
-    }\r
+    } // end while\r
+    //   fOutputContainer->Add(fMappingContainer);\r
   }\r
-  for(UInt_t i=0;i<fMCMappingPhi.size();i++){\r
-    if(fMCMappingPhi[i] != NULL){fMappingContainer->Add(fMCMappingPhi[i]);}\r
-  }\r
-  for(UInt_t i=0;i<fMCMappingR.size();i++){\r
-    if(fMCMappingR[i] != NULL){fMappingContainer->Add(fMCMappingR[i]);}\r
-  }\r
-  if(fMCMatchGammaEta != NULL){ fOutputContainer->Add(fMCMatchGammaEta);}\r
-  if(fMCMatchGammaPhi != NULL){ fOutputContainer->Add(fMCMatchGammaPhi);}\r
-  if(fMCMatchGammaPt != NULL){ fOutputContainer->Add(fMCMatchGammaPt);}\r
-  if(fMCMatchGammaEnergy != NULL){ fOutputContainer->Add(fMCMatchGammaEnergy);}\r
-  if(fMCMatchGammaMass != NULL){ fOutputContainer->Add(fMCMatchGammaMass);}\r
-  if(fMCMatchGammaOpeningAngle != NULL){ fOutputContainer->Add(fMCMatchGammaOpeningAngle);}\r
-  if(fMCMatchGammaR != NULL){ fOutputContainer->Add(fMCMatchGammaR);}\r
-  if(fMCMatchGammaZR != NULL){ fOutputContainer->Add(fMCMatchGammaZR);}\r
-  if(fMCMatchGammaXY != NULL){ fOutputContainer->Add(fMCMatchGammaXY);}\r
-\r
-  if(fMCPi0Eta != NULL){ fOutputContainer->Add(fMCPi0Eta);}\r
-  if(fMCPi0Phi != NULL){ fOutputContainer->Add(fMCPi0Phi);}\r
-  if(fMCPi0Pt != NULL){ fOutputContainer->Add(fMCPi0Pt);}\r
-  if(fMCPi0Energy != NULL){ fOutputContainer->Add(fMCPi0Energy);}\r
-  if(fMCPi0Mass != NULL){ fOutputContainer->Add(fMCPi0Mass);}\r
-  if(fMCPi0OpeningAngleGamma != NULL){ fOutputContainer->Add(fMCPi0OpeningAngleGamma);}\r
-  if(fMCPi0R != NULL){ fOutputContainer->Add(fMCPi0R);}\r
-  if(fMCPi0ZR != NULL){ fOutputContainer->Add(fMCPi0ZR);}\r
-  if(fMCPi0XY != NULL){ fOutputContainer->Add(fMCPi0XY);}\r
-  if(fMCPi0SecondariesXY != NULL){ fOutputContainer->Add(fMCPi0SecondariesXY);}\r
-\r
-  if(fMCEtaEta != NULL){ fOutputContainer->Add(fMCEtaEta);}\r
-  if(fMCEtaPhi != NULL){ fOutputContainer->Add(fMCEtaPhi);}\r
-  if(fMCEtaPt != NULL){ fOutputContainer->Add(fMCEtaPt);}\r
-  if(fMCEtaEnergy != NULL){ fOutputContainer->Add(fMCEtaEnergy);}\r
-  if(fMCEtaMass != NULL){ fOutputContainer->Add(fMCEtaMass);}\r
-  if(fMCEtaOpeningAngleGamma != NULL){ fOutputContainer->Add(fMCEtaOpeningAngleGamma);}\r
-  if(fMCEtaR != NULL){ fOutputContainer->Add(fMCEtaR);}\r
-  if(fMCEtaZR != NULL){ fOutputContainer->Add(fMCEtaZR);}\r
-  if(fMCEtaXY != NULL){ fOutputContainer->Add(fMCEtaXY);}\r
-    \r
-  // Histograms from esd tracks\r
-  if(fESDEPR != NULL){ fOutputContainer->Add(fESDEPR);}\r
-  if(fESDEPZR != NULL){ fOutputContainer->Add(fESDEPZR);}\r
-  if(fESDEPXY != NULL){ fOutputContainer->Add(fESDEPXY);}\r
-  if(fESDEPOpeningAngle != NULL){ fOutputContainer->Add(fESDEPOpeningAngle);}\r
-\r
-  if(fESDEEnergy != NULL){ fOutputContainer->Add(fESDEEnergy);}\r
-  if(fESDEPt != NULL){ fOutputContainer->Add(fESDEPt);}\r
-  if(fESDEEta != NULL){ fOutputContainer->Add(fESDEEta);}\r
-  if(fESDEPhi != NULL){ fOutputContainer->Add(fESDEPhi);}\r
-\r
-  if(fESDPEnergy != NULL){ fOutputContainer->Add(fESDPEnergy);}\r
-  if(fESDPPt != NULL){ fOutputContainer->Add(fESDPPt);}\r
-  if(fESDPEta != NULL){ fOutputContainer->Add(fESDPEta);}\r
-  if(fESDPPhi != NULL){ fOutputContainer->Add(fESDPPhi);}\r
-\r
-  if(fESDGammaEnergy != NULL){ fOutputContainer->Add(fESDGammaEnergy);}\r
-  if(fESDGammaPt != NULL){ fOutputContainer->Add(fESDGammaPt);}\r
-  if(fESDGammaEta != NULL){ fOutputContainer->Add(fESDGammaEta);}\r
-  if(fESDGammaPhi != NULL){ fOutputContainer->Add(fESDGammaPhi);}\r
-\r
-  //mapping\r
-  for(UInt_t i=0;i<fESDMapping.size();i++){\r
-    for(UInt_t j=0;j<fESDMapping[i].size();j++){\r
-      if(fESDMapping[i][j] != NULL){fMappingContainer->Add(fESDMapping[i][j]);}\r
-    }\r
-  }\r
-  for(UInt_t i=0;i<fESDMappingPhi.size();i++){\r
-    if(fESDMappingPhi[i] != NULL){fMappingContainer->Add(fESDMappingPhi[i]);}\r
-  }\r
-  for(UInt_t i=0;i<fESDMappingR.size();i++){\r
-    if(fESDMappingR[i] != NULL){fMappingContainer->Add(fESDMappingR[i]);}\r
-  }\r
-\r
-  fOutputContainer->Add(fMappingContainer);\r
-\r
-  if(fESDMatchGammaOpeningAngle != NULL){ fOutputContainer->Add(fESDMatchGammaOpeningAngle);}\r
-  if(fESDMatchGammaEnergy != NULL){ fOutputContainer->Add(fESDMatchGammaEnergy);}\r
-  if(fESDMatchGammaPt != NULL){ fOutputContainer->Add(fESDMatchGammaPt);}\r
-  if(fESDMatchGammaEta != NULL){ fOutputContainer->Add(fESDMatchGammaEta);}\r
-  if(fESDMatchGammaPhi != NULL){ fOutputContainer->Add(fESDMatchGammaPhi);}\r
-  if(fESDMatchGammaMass != NULL){ fOutputContainer->Add(fESDMatchGammaMass);}\r
-  if(fESDMatchGammaWidth != NULL){ fOutputContainer->Add(fESDMatchGammaWidth);}\r
-  if(fESDMatchGammaChi2 != NULL){ fOutputContainer->Add(fESDMatchGammaChi2);}\r
-  if(fESDMatchGammaNDF != NULL){ fOutputContainer->Add(fESDMatchGammaNDF);}\r
-  if(fESDMatchGammaR != NULL){ fOutputContainer->Add(fESDMatchGammaR);}\r
-  if(fESDMatchGammaZR != NULL){ fOutputContainer->Add(fESDMatchGammaZR);}\r
-  if(fESDMatchGammaXY != NULL){ fOutputContainer->Add(fESDMatchGammaXY);}\r
-\r
-  if(fESDPi0OpeningAngleGamma != NULL){ fOutputContainer->Add(fESDPi0OpeningAngleGamma);}\r
-  if(fESDPi0Energy != NULL){ fOutputContainer->Add(fESDPi0Energy);}\r
-  if(fESDPi0Pt != NULL){ fOutputContainer->Add(fESDPi0Pt);}\r
-  if(fESDPi0Eta != NULL){ fOutputContainer->Add(fESDPi0Eta);}\r
-  if(fESDPi0Phi != NULL){ fOutputContainer->Add(fESDPi0Phi);}\r
-  if(fESDPi0Mass != NULL){ fOutputContainer->Add(fESDPi0Mass);}\r
-  if(fESDPi0R != NULL){ fOutputContainer->Add(fESDPi0R);}\r
-  if(fESDPi0ZR != NULL){ fOutputContainer->Add(fESDPi0ZR);}\r
-  if(fESDPi0XY != NULL){ fOutputContainer->Add(fESDPi0XY);}\r
-\r
-  if(fESDEtaOpeningAngleGamma != NULL){ fOutputContainer->Add(fESDEtaOpeningAngleGamma);}\r
-  if(fESDEtaEnergy != NULL){ fOutputContainer->Add(fESDEtaEnergy);}\r
-  if(fESDEtaPt != NULL){ fOutputContainer->Add(fESDEtaPt);}\r
-  if(fESDEtaEta != NULL){ fOutputContainer->Add(fESDEtaEta);}\r
-  if(fESDEtaPhi != NULL){ fOutputContainer->Add(fESDEtaPhi);}\r
-  if(fESDEtaMass != NULL){ fOutputContainer->Add(fESDEtaMass);}\r
-  if(fESDEtaR != NULL){ fOutputContainer->Add(fESDEtaR);}\r
-  if(fESDEtaZR != NULL){ fOutputContainer->Add(fESDEtaZR);}\r
-  if(fESDEtaXY != NULL){ fOutputContainer->Add(fESDEtaXY);}\r
-\r
-  if(fESDBackgroundOpeningAngleGamma != NULL){ fOutputContainer->Add(fESDBackgroundOpeningAngleGamma);}\r
-  if(fESDBackgroundEnergy != NULL){ fOutputContainer->Add(fESDBackgroundEnergy);}\r
-  if(fESDBackgroundPt != NULL){ fOutputContainer->Add(fESDBackgroundPt);}\r
-  if(fESDBackgroundEta != NULL){ fOutputContainer->Add(fESDBackgroundEta);}\r
-  if(fESDBackgroundPhi != NULL){ fOutputContainer->Add(fESDBackgroundPhi);}\r
-  if(fESDBackgroundMass != NULL){ fOutputContainer->Add(fESDBackgroundMass);}\r
-  if(fESDBackgroundR != NULL){ fOutputContainer->Add(fESDBackgroundR);}\r
-  if(fESDBackgroundZR != NULL){ fOutputContainer->Add(fESDBackgroundZR);}\r
-  if(fESDBackgroundXY != NULL){ fOutputContainer->Add(fESDBackgroundXY);}\r
-\r
-  if(fResolutiondPt != NULL){ fOutputContainer->Add(fResolutiondPt);}\r
-  if(fResolutiondR != NULL){ fOutputContainer->Add(fResolutiondR);}\r
-  if(fResolutiondZ != NULL){ fOutputContainer->Add(fResolutiondZ);}\r
-  if(fResolutiondRdPt != NULL){ fOutputContainer->Add(fResolutiondRdPt);}\r
-  if(fResolutionMCPt != NULL){ fOutputContainer->Add(fResolutionMCPt);}\r
-  if(fResolutionMCR != NULL){ fOutputContainer->Add(fResolutionMCR);}\r
-  if(fResolutionMCZ != NULL){ fOutputContainer->Add(fResolutionMCZ);}\r
-  if(fResolutionESDPt != NULL){ fOutputContainer->Add(fResolutionESDPt);}\r
-  if(fResolutionESDR != NULL){ fOutputContainer->Add(fResolutionESDR);}\r
-  if(fResolutionESDZ != NULL){ fOutputContainer->Add(fResolutionESDZ);}\r
-\r
-  if(fNumberOfV0s != NULL){fOutputContainer->Add(fNumberOfV0s);}\r
-  if(fNumberOfSurvivingV0s != NULL){fOutputContainer->Add(fNumberOfSurvivingV0s);}\r
-  if(fV0MassDebugCut1 != NULL){fOutputContainer->Add(fV0MassDebugCut1);}\r
-  if(fV0MassDebugCut2 != NULL){fOutputContainer->Add(fV0MassDebugCut2);}\r
-  if(fV0MassDebugCut3 != NULL){fOutputContainer->Add(fV0MassDebugCut3);}\r
-  if(fV0MassDebugCut4 != NULL){fOutputContainer->Add(fV0MassDebugCut4);}\r
-  if(fV0MassDebugCut5 != NULL){fOutputContainer->Add(fV0MassDebugCut5);}\r
-  if(fV0MassDebugCut6 != NULL){fOutputContainer->Add(fV0MassDebugCut6);}\r
-  if(fV0MassDebugCut7 != NULL){fOutputContainer->Add(fV0MassDebugCut7);}\r
-  if(fV0MassDebugCut8 != NULL){fOutputContainer->Add(fV0MassDebugCut8);}\r
-  \r
-  return fOutputContainer;\r
-*/\r
 }\r
 \r
 Int_t AliGammaConversionHistograms::GetRBin(Double_t radius) const{\r
@@ -365,6 +196,9 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
 \r
     for(Int_t r =0; r<fNRIndex;r++){\r
 \r
+      // setting axis to "" changes below\r
+      xAxisTitle="";\r
+      yAxisTitle="";\r
       //Creating the axis titles\r
       if(xAxisTitle.Length() == 0){\r
        xAxisTitle.Form("Phi %02d",phi);\r
@@ -392,8 +226,12 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
     }\r
   }\r
 \r
+\r
   for(Int_t phi =0; phi<=nPhiIndex;phi++){ \r
 \r
+    // setting axis to "" changes below\r
+    xAxisTitle="";\r
+    yAxisTitle="";\r
     //Creating the axis titles\r
     if(xAxisTitle.Length() == 0){\r
       xAxisTitle.Form("Phi %02d",phi);\r
@@ -412,15 +250,19 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
 \r
     //MC\r
     TString nameESD="";\r
-    nameMC.Form("ESD_EP_Mapping-Phi%02d",phi);\r
+    nameESD.Form("ESD_EP_Mapping-Phi%02d",phi);\r
     TString titleESD="";\r
-    titleMC.Form("Electron-Positron ESD Mapping-Phi%02d",phi);\r
+    titleESD.Form("Electron-Positron ESD Mapping-Phi%02d",phi);\r
     \r
     AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
   }\r
 \r
 \r
   for(Int_t r =0; r<=nRIndex;r++){\r
+\r
+    // setting axis to "" changes below\r
+    xAxisTitle="";\r
+    yAxisTitle="";\r
     //Creating the axis titles\r
     if(xAxisTitle.Length() == 0){\r
       xAxisTitle.Form("R %02d",r);\r
@@ -447,15 +289,16 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
 \r
     //Mapping Phi in R\r
     TString nameMCPhiInR="";\r
-    nameMCPhiInR.Form("MC_EP_Mapping_Phi_vs_R_R-%02d",r);\r
+    nameMCPhiInR.Form("MC_EP_Mapping_Phi_R-%02d",r);\r
     TString titleMCPhiInR="";\r
-    titleMCPhiInR.Form("Electron-Positron MC Mapping of Phi in R%02d",r);\r
-    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);\r
+    titleMCPhiInR.Form("MC Mapping of Phi in R%02d",r);\r
+    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
 \r
+    //Mapping Phi in R\r
     TString nameESDPhiInR="";\r
-    nameESDPhiInR.Form("ESD_EP_Mapping_Phi_vs_R_R-%02d",r);\r
+    nameESDPhiInR.Form("ESD_EP_Mapping_Phi_R-%02d",r);\r
     TString titleESDPhiInR="";\r
-    titleESDPhiInR.Form("Electron-Positron ESD Mapping of Phi in R%02d",r);\r
-    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);    \r
+    titleESDPhiInR.Form("ESD Mapping of Phi in R%02d",r);\r
+    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    \r
   }\r
 }\r