bugs corrected
[u/mrichter/AliRoot.git] / PWG4 / macros / ConfigGammaConversion.C
index d2fb671..7b1d101 100644 (file)
@@ -11,6 +11,8 @@ Bool_t useESDTrack   = kFALSE;
 \r
 Bool_t calculateBackground = kTRUE;\r
 \r
+Int_t numberOfFilesToAnalyze=100;\r
+\r
 /** ---------------------------------- define cuts here ------------------------------------*/\r
 \r
 Int_t pidOfNegativeTrack=11;\r
@@ -19,7 +21,8 @@ Int_t pidOfPositiveTrack=-11;
 Double_t maxRCut   = 200.;\r
 Double_t etaCut    = 1.2;\r
 Double_t ptCut     = 0.1;\r
-Double_t chi2Cut   = 20.;\r
+Double_t chi2CutConversion   = 20.;\r
+Double_t chi2CutMeson   = 20.;\r
 \r
 Double_t xVertexCut = 0.;\r
 Double_t yVertexCut = 0.;\r
@@ -59,8 +62,8 @@ Double_t maxPhi      = TMath::Pi();
 /** ------------------- define which histograms to plot here --------------------------------*/\r
 /**   NB: to change the bin numbers, see below the histogram flags                           */\r
 Bool_t plotMCEPR                             = kTRUE;\r
-Bool_t plotMCEPZR                           = kTRUE;\r
-Bool_t plotMCEPXY                           = kTRUE;\r
+Bool_t plotMCEPZR                            = kTRUE;\r
+Bool_t plotMCEPXY                            = kTRUE;\r
 Bool_t plotMCEPOpeningAngle                  = kTRUE;\r
 \r
 Bool_t plotMCEEnergy                         = kTRUE;\r
@@ -83,15 +86,15 @@ Bool_t plotMCDirectGammaPt                   = kTRUE;
 Bool_t plotMCDirectGammaEta                  = kTRUE;\r
 Bool_t plotMCDirectGammaPhi                  = kTRUE;\r
 \r
-Bool_t plotMCMatchGammaEta                  = kTRUE;\r
-Bool_t plotMCMatchGammaPhi                  = kTRUE;\r
-Bool_t plotMCMatchGammaPt                   = kTRUE;\r
-Bool_t plotMCMatchGammaEnergy               = kTRUE;\r
-Bool_t plotMCMatchGammaMass                 = kTRUE;\r
-Bool_t plotMCMatchGammaOpeningAngle         = kTRUE;\r
-Bool_t plotMCMatchGammaR                    = kTRUE;\r
-Bool_t plotMCMatchGammaZR                  = kTRUE;\r
-Bool_t plotMCMatchGammaXY                  = kTRUE;\r
+Bool_t plotMCMatchGammaEta                   = kTRUE;\r
+Bool_t plotMCMatchGammaPhi                   = kTRUE;\r
+Bool_t plotMCMatchGammaPt                    = kTRUE;\r
+Bool_t plotMCMatchGammaEnergy                = kTRUE;\r
+Bool_t plotMCMatchGammaMass                  = kTRUE;\r
+Bool_t plotMCMatchGammaOpeningAngle          = kTRUE;\r
+Bool_t plotMCMatchGammaR                     = kTRUE;\r
+Bool_t plotMCMatchGammaZR                    = kTRUE;\r
+Bool_t plotMCMatchGammaXY                    = kTRUE;\r
 \r
 Bool_t plotMCPi0Eta                          = kTRUE;\r
 Bool_t plotMCPi0Phi                          = kTRUE;\r
@@ -100,8 +103,8 @@ Bool_t plotMCPi0Energy                       = kTRUE;
 Bool_t plotMCPi0Mass                         = kTRUE;\r
 Bool_t plotMCPi0OpeningAngle                 = kTRUE;\r
 Bool_t plotMCPi0R                            = kTRUE;\r
-Bool_t plotMCPi0ZR                          = kTRUE;\r
-Bool_t plotMCPi0XY                          = kTRUE;\r
+Bool_t plotMCPi0ZR                           = kTRUE;\r
+Bool_t plotMCPi0XY                           = kTRUE;\r
 \r
 Bool_t plotMCEtaEta                          = kTRUE;\r
 Bool_t plotMCEtaPhi                          = kTRUE;\r
@@ -110,13 +113,13 @@ Bool_t plotMCEtaEnergy                       = kTRUE;
 Bool_t plotMCEtaMass                         = kTRUE;\r
 Bool_t plotMCEtaOpeningAngleGamma            = kTRUE;\r
 Bool_t plotMCEtaR                            = kTRUE;\r
-Bool_t plotMCEtaZR                          = kTRUE;\r
-Bool_t plotMCEtaXY                          = kTRUE;\r
+Bool_t plotMCEtaZR                           = kTRUE;\r
+Bool_t plotMCEtaXY                           = kTRUE;\r
     \r
 // Histograms from esd tracks\r
 Bool_t plotESDEPR                            = kTRUE;\r
-Bool_t plotESDEPZR                          = kTRUE;\r
-Bool_t plotESDEPXY                          = kTRUE;\r
+Bool_t plotESDEPZR                           = kTRUE;\r
+Bool_t plotESDEPXY                           = kTRUE;\r
 Bool_t plotESDEPOpeningAngle                 = kTRUE;\r
 \r
 Bool_t plotESDEEnergy                        = kTRUE;\r
@@ -135,28 +138,28 @@ Bool_t plotESDGammaPt                        = kTRUE;
 Bool_t plotESDGammaEta                       = kTRUE;\r
 Bool_t plotESDGammaPhi                       = kTRUE;\r
 \r
-Bool_t plotESDMatchGammaOpeningAngle        = kTRUE;\r
-Bool_t plotESDMatchGammaEnergy              = kTRUE;\r
-Bool_t plotESDMatchGammaPt                  = kTRUE;\r
-Bool_t plotESDMatchGammaEta                 = kTRUE;\r
-Bool_t plotESDMatchGammaPhi                 = kTRUE;\r
-Bool_t plotESDMatchGammaMass                = kTRUE;\r
-Bool_t plotESDMatchGammaWidth               = kTRUE;\r
-Bool_t plotESDMatchGammaChi2                = kTRUE;\r
-Bool_t plotESDMatchGammaNDF                 = kTRUE;\r
-Bool_t plotESDMatchGammaR                   = kTRUE;\r
-Bool_t plotESDMatchGammaZR                 = kTRUE;\r
-Bool_t plotESDMatchGammaXY                 = kTRUE;\r
+Bool_t plotESDMatchGammaOpeningAngle         = kTRUE;\r
+Bool_t plotESDMatchGammaEnergy               = kTRUE;\r
+Bool_t plotESDMatchGammaPt                   = kTRUE;\r
+Bool_t plotESDMatchGammaEta                  = kTRUE;\r
+Bool_t plotESDMatchGammaPhi                  = kTRUE;\r
+Bool_t plotESDMatchGammaMass                 = kTRUE;\r
+Bool_t plotESDMatchGammaWidth                = kTRUE;\r
+Bool_t plotESDMatchGammaChi2                 = kTRUE;\r
+Bool_t plotESDMatchGammaNDF                  = kTRUE;\r
+Bool_t plotESDMatchGammaR                    = kTRUE;\r
+Bool_t plotESDMatchGammaZR                   = kTRUE;\r
+Bool_t plotESDMatchGammaXY                   = kTRUE;\r
 \r
 Bool_t plotESDTwoGammaCombinationOpeningAngleGamma         = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationEnergy    = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationPt        = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationEta       = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationPhi       = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationMass      = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationR         = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationZR        = kTRUE;\r
-Bool_t plotESDTwoGammaCombinationXY        = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationEnergy      = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationPt          = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationEta         = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationPhi         = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationMass        = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationR           = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationZR          = kTRUE;\r
+Bool_t plotESDTwoGammaCombinationXY          = kTRUE;\r
 \r
 Bool_t plotESDBackgroundOpeningAngleGamma    = kTRUE;\r
 Bool_t plotESDBackgroundEnergy               = kTRUE;\r
@@ -165,14 +168,14 @@ Bool_t plotESDBackgroundEta                  = kTRUE;
 Bool_t plotESDBackgroundPhi                  = kTRUE;\r
 Bool_t plotESDBackgroundMass                 = kTRUE;\r
 Bool_t plotESDBackgroundR                    = kTRUE;\r
-Bool_t plotESDBackgroundZR                  = kTRUE;\r
-Bool_t plotESDBackgroundXY                  = kTRUE;\r
+Bool_t plotESDBackgroundZR                   = kTRUE;\r
+Bool_t plotESDBackgroundXY                   = kTRUE;\r
 \r
-Bool_t plotMapping                             = kTRUE;       \r
+Bool_t plotMapping                           = kTRUE;       \r
 \r
-Bool_t plotResolutiondPt                      = kTRUE;\r
-Bool_t plotResolutiondR                       = kTRUE;\r
-Bool_t plotResolutiondZ                       = kTRUE;\r
+Bool_t plotResolutiondPt                     = kTRUE;\r
+Bool_t plotResolutiondR                      = kTRUE;\r
+Bool_t plotResolutiondZ                      = kTRUE;\r
   \r
 Bool_t plotResolutiondRdPt                   = kTRUE;\r
 \r
@@ -184,21 +187,21 @@ Bool_t plotResolutionESDPt                   = kTRUE;
 Bool_t plotResolutionESDR                    = kTRUE;\r
 Bool_t plotResolutionESDZ                    = kTRUE;\r
 \r
-Bool_t plotNumberOfV0s                         = kTRUE;\r
-Bool_t plotNumberOfSurvivingV0s                = kTRUE;\r
+Bool_t plotNumberOfV0s                       = kTRUE;\r
+Bool_t plotNumberOfSurvivingV0s              = kTRUE;\r
 \r
   //  debug histograms\r
-Bool_t plotV0MassDebugCut1                     = kTRUE;\r
-Bool_t plotV0MassDebugCut2                     = kTRUE;\r
-Bool_t plotV0MassDebugCut3                     = kTRUE;\r
-Bool_t plotV0MassDebugCut4                     = kTRUE;\r
-Bool_t plotV0MassDebugCut5                     = kTRUE;\r
-Bool_t plotV0MassDebugCut6                     = kTRUE;\r
-Bool_t plotV0MassDebugCut7                     = kTRUE;\r
-Bool_t plotV0MassDebugCut8                     = kTRUE;\r
+Bool_t plotV0MassDebugCut1                   = kTRUE;\r
+Bool_t plotV0MassDebugCut2                   = kTRUE;\r
+Bool_t plotV0MassDebugCut3                   = kTRUE;\r
+Bool_t plotV0MassDebugCut4                   = kTRUE;\r
+Bool_t plotV0MassDebugCut5                   = kTRUE;\r
+Bool_t plotV0MassDebugCut6                   = kTRUE;\r
+Bool_t plotV0MassDebugCut7                   = kTRUE;\r
+Bool_t plotV0MassDebugCut8                   = kTRUE;\r
 \r
-Bool_t plotPi0Spectra                          = kTRUE;\r
-Bool_t plotEtaSpectra                          = kTRUE;\r
+Bool_t plotPi0Spectra                        = kTRUE;\r
+Bool_t plotEtaSpectra                        = kTRUE;\r
 \r
 \r
 /** ----------------- end define which histograms to plot here -------------------------------*/\r
@@ -401,9 +404,9 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotMCMatchGammaEnergy == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
   if(plotMCMatchGammaMass == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Mass" ,"" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass, "", "");}\r
   if(plotMCMatchGammaOpeningAngle == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotMCMatchGammaR == kTRUE){ histograms->AddHistogram("MC_Match_GammaR" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotMCMatchGammaZR == kTRUE){ histograms->AddHistogram("MC_Match_GammaZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotMCMatchGammaXY == kTRUE){ histograms->AddHistogram("MC_Match_GammaXY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
+  if(plotMCMatchGammaR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
+  if(plotMCMatchGammaZR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
+  if(plotMCMatchGammaXY == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
 \r
   if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
   if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
@@ -415,6 +418,16 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
   if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
 \r
+  if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
+  if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
+  if(plotMCPi0Pt == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
+  if(plotMCPi0Energy == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
+  if(plotMCPi0Mass == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}\r
+  if(plotMCPi0OpeningAngle == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
+  if(plotMCPi0R == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
+  if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
+  if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
+\r
   if(plotMCEtaEta == kTRUE){ histograms->AddHistogram("MC_Eta_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
   if(plotMCEtaPhi == kTRUE){ histograms->AddHistogram("MC_Eta_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
   if(plotMCEtaPt == kTRUE){ histograms->AddHistogram("MC_Eta_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
@@ -469,17 +482,6 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotESDTwoGammaCombinationZR == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
   if(plotESDTwoGammaCombinationXY == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
 \r
-  /*\r
-  if(plotESDEtaOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_Eta_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
-  if(plotESDEtaEnergy == kTRUE){ histograms->AddHistogram("ESD_Eta_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
-  if(plotESDEtaPt == kTRUE){ histograms->AddHistogram("ESD_Eta_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
-  if(plotESDEtaEta == kTRUE){ histograms->AddHistogram("ESD_Eta_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}\r
-  if(plotESDEtaPhi == kTRUE){ histograms->AddHistogram("ESD_Eta_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}\r
-  if(plotESDEtaMass == kTRUE){ histograms->AddHistogram("ESD_Eta_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}\r
-  if(plotESDEtaR == kTRUE){ histograms->AddHistogram("ESD_Eta_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}\r
-  if(plotESDEtaZR == kTRUE){ histograms->AddHistogram("ESD_Eta_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}\r
-  if(plotESDEtaXY == kTRUE){ histograms->AddHistogram("ESD_Eta_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}\r
-  */\r
   if(plotESDBackgroundOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_Background_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}\r
   if(plotESDBackgroundEnergy == kTRUE){ histograms->AddHistogram("ESD_Background_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}\r
   if(plotESDBackgroundPt == kTRUE){ histograms->AddHistogram("ESD_Background_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}\r
@@ -523,7 +525,9 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   if(plotV0MassDebugCut8 == kTRUE){histograms->AddHistogram("V0MassDebugCut8" ,"debug8" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}\r
 \r
 \r
-  if(plotPi0Spectra == kTRUE){histograms->AddHistogram("InvMass_vs_Pt__Spectra" ,"Inv mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}\r
+  if(plotPi0Spectra == kTRUE){histograms->AddHistogram("InvMass_vs_Pt_Spectra" ,"Invariant Mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}\r
+\r
+  if(plotPi0Spectra == kTRUE && calculateBackground == kTRUE){histograms->AddHistogram("Background_InvMass_vs_Pt_Spectra" ,"Background Invariant Mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}\r
 \r
   \r
 \r
@@ -585,13 +589,15 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   v0Reader->SetMaxRCut(maxRCut);\r
   v0Reader->SetEtaCut(etaCut);\r
   v0Reader->SetPtCut(ptCut);\r
-  v0Reader->SetChi2Cut(chi2Cut);\r
+  v0Reader->SetChi2CutConversion(chi2CutConversion);\r
+  v0Reader->SetChi2CutMeson(chi2CutMeson);\r
   v0Reader->SetPIDProbability(probElectron);\r
   v0Reader->SetXVertexCut(xVertexCut);\r
   v0Reader->SetYVertexCut(yVertexCut);\r
   v0Reader->SetZVertexCut(zVertexCut);\r
   v0Reader->SetSigmaMass(sigmaCutGammaMass);\r
   v0Reader->SetUseImprovedVertex(useImprovedVertex);\r
+  v0Reader->SetDoMCTruth(doMCTruth);\r
 \r
   // Create the GammaConversionTask\r
   AliAnalysisTaskGammaConversion *gammaconversion = new AliAnalysisTaskGammaConversion("GammaConversionTask");\r
@@ -629,7 +635,7 @@ void ConfigGammaConversion(const char *chainName, const char *sample, int limit
   mgr->ConnectOutput(gammaconversion, 0, coutput1);\r
   mgr->ConnectOutput(gammaconversion, 1, coutput2);\r
 \r
-  TChain* chain= CreateESDChain(sample);\r
+  TChain* chain= CreateESDChain(sample,numberOfFilesToAnalyze);\r
   \r
   mgr->InitAnalysis();\r
   \r