Changed to new naming scheme for histograms, added functionality to the analysis...
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliGammaConversionHistograms.cxx
index 08ada546385d5876a1d83d42c7ef4b7b1fd4996c..ea6377092a7231d4f9d772aeeeb1f51dc90b7b5f 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
@@ -74,8 +88,8 @@ AliGammaConversionHistograms & AliGammaConversionHistograms::operator = (const A
 \r
 AliGammaConversionHistograms::~AliGammaConversionHistograms() {\r
   //destructor\r
-\r
-\r
+       \r
+       \r
 }\r
 \r
 void AliGammaConversionHistograms::AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX,Double_t lastX,TString xAxisTitle, TString yAxisTitle){\r
@@ -100,10 +114,7 @@ void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t
   //see header file for documentation\r
   TH1 *tmp = (TH1*)fHistogramMap->GetValue(histogramName.Data());\r
   if(tmp){\r
-      tmp->Fill(xValue);\r
-  }\r
-  else{\r
-    cout<<"Histogram does not exist: "<<histogramName.Data()<<endl;\r
+    tmp->Fill(xValue);\r
   }\r
 }\r
 \r
@@ -113,19 +124,16 @@ 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
   //checking if the container is alrerady created\r
-\r
+       \r
   if(fOutputContainer == NULL){\r
     //print warning\r
     return;\r
   }\r
-\r
+       \r
   if(fHistogramMap != NULL){\r
     TIter iter(fHistogramMap);\r
     TObjString *histogramName;\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
@@ -172,7 +265,7 @@ Int_t AliGammaConversionHistograms::GetPhiBin(Double_t phi) const{
 \r
 void AliGammaConversionHistograms::InitializeMappingValues(Int_t nPhiIndex, Int_t nRIndex, Int_t nBinsR, Double_t minRadius, Double_t maxRadius,Int_t nBinsPhi, Double_t minPhi, Double_t maxPhi){\r
   // Initializing the valuse for the mapping\r
-\r
+       \r
   fNPhiIndex = nPhiIndex;\r
   fNRIndex   = nRIndex;\r
   fMinRadius      = minRadius;\r
@@ -191,11 +284,11 @@ void AliGammaConversionHistograms::InitializeMappingValues(Int_t nPhiIndex, Int_
 //mapping\r
 void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t nRIndex,Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){\r
   // see header file for documentation\r
-  \r
+       \r
   for(Int_t phi =0; phi<=fNPhiIndex;phi++){\r
-\r
+               \r
     for(Int_t r =0; r<fNRIndex;r++){\r
-\r
+                       \r
       // setting axis to "" changes below\r
       xAxisTitle="";\r
       yAxisTitle="";\r
@@ -203,32 +296,32 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
       if(xAxisTitle.Length() == 0){\r
        xAxisTitle.Form("Phi %02d",phi);\r
       }\r
-      \r
+                       \r
       if(yAxisTitle.Length() == 0){\r
        yAxisTitle.Form("R %02d",phi);\r
       }\r
-\r
+                       \r
       //MC\r
       TString nameMC="";\r
-      nameMC.Form("MC_EP_Mapping-Phi%02d-R%02d",phi,r);\r
+      nameMC.Form("MC_Conversion_Mapping-Phi%02d-R%02d",phi,r);\r
       TString titleMC="";\r
       titleMC.Form("Electron-Positron MC Mapping-Phi%02d-R%02d",phi,r);\r
-\r
+                       \r
       AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);\r
-\r
+                       \r
       //ESD\r
       TString nameESD="";\r
-      nameESD.Form("ESD_EP_Mapping-Phi%02d-R%02d",phi,r);\r
+      nameESD.Form("ESD_Conversion_Mapping-Phi%02d-R%02d",phi,r);\r
       TString titleESD="";\r
       titleESD.Form("Electron-Positron ESD Mapping-Phi%02d-R%02d",phi,r);\r
-\r
+                       \r
       AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);\r
     }\r
   }\r
-\r
-\r
+       \r
+       \r
   for(Int_t phi =0; phi<=nPhiIndex;phi++){ \r
-\r
+               \r
     // setting axis to "" changes below\r
     xAxisTitle="";\r
     yAxisTitle="";\r
@@ -239,27 +332,27 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
     if(yAxisTitle.Length() == 0){\r
       yAxisTitle = "Counts";\r
     }\r
-    \r
+               \r
     //MC\r
     TString nameMC="";\r
-    nameMC.Form("MC_EP_Mapping-Phi%02d",phi);\r
+    nameMC.Form("MC_Conversion_Mapping-Phi%02d",phi);\r
     TString titleMC="";\r
     titleMC.Form("Electron-Positron MC Mapping-Phi%02d",phi);\r
-    \r
+               \r
     AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
-\r
+               \r
     //MC\r
     TString nameESD="";\r
-    nameESD.Form("ESD_EP_Mapping-Phi%02d",phi);\r
+    nameESD.Form("ESD_Conversion_Mapping-Phi%02d",phi);\r
     TString titleESD="";\r
     titleESD.Form("Electron-Positron ESD Mapping-Phi%02d",phi);\r
-    \r
+               \r
     AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
   }\r
-\r
-\r
+       \r
+       \r
   for(Int_t r =0; r<=nRIndex;r++){\r
-\r
+               \r
     // setting axis to "" changes below\r
     xAxisTitle="";\r
     yAxisTitle="";\r
@@ -270,33 +363,33 @@ void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t n
     if(yAxisTitle.Length() == 0){\r
       yAxisTitle = "Counts";\r
     }\r
-    \r
+               \r
     //MC\r
     TString nameMC="";\r
-    nameMC.Form("MC_EP_Mapping-R%02d",r);\r
+    nameMC.Form("MC_Conversion_Mapping-R%02d",r);\r
     TString titleMC="";\r
     titleMC.Form("Electron-Positron MC Mapping-R%02d",r);\r
-    \r
+               \r
     AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
-\r
+               \r
     //ESD\r
     TString nameESD="";\r
-    nameESD.Form("ESD_EP_Mapping-R%02d",r);\r
+    nameESD.Form("ESD_Conversion_Mapping-R%02d",r);\r
     TString titleESD="";\r
     titleESD.Form("Electron-Positron ESD Mapping-R%02d",r);\r
-    \r
+               \r
     AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
-\r
+               \r
     //Mapping Phi in R\r
     TString nameMCPhiInR="";\r
-    nameMCPhiInR.Form("MC_EP_Mapping_Phi_R-%02d",r);\r
+    nameMCPhiInR.Form("MC_Conversion_Mapping_Phi_R-%02d",r);\r
     TString titleMCPhiInR="";\r
     titleMCPhiInR.Form("MC Mapping of Phi in R%02d",r);\r
     AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);\r
-\r
+               \r
     //Mapping Phi in R\r
     TString nameESDPhiInR="";\r
-    nameESDPhiInR.Form("ESD_EP_Mapping_Phi_R-%02d",r);\r
+    nameESDPhiInR.Form("ESD_Conversion_Mapping_Phi_R-%02d",r);\r
     TString titleESDPhiInR="";\r
     titleESDPhiInR.Form("ESD Mapping of Phi in R%02d",r);\r
     AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    \r