]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG1/AliAnalysisTaskV0QA.cxx
attaching file writer to the StreamerInfo component
[u/mrichter/AliRoot.git] / PWG1 / AliAnalysisTaskV0QA.cxx
index 0bdfc456e8114291ae2e94fc3ff2c1f0fd80bccb..5e25e37bab2b18f0c8043b200b89ae1f3d697dc5 100644 (file)
@@ -1,15 +1,20 @@
+//------------------------------------------------
+// Implementation of AliAnalysisTaskV0QA class.
+// Calculates the "on the fly" V0 method efficiency 
+// for Gamma, K0s, lambda, antilambda
+// Needs MC information
+// Author: A. Marin  Revision 18/10/09
+//-------------------------------------------------
 #define AliAnalysisTaskV0QA_cxx
-#include "Riostream.h"
-#include "TROOT.h"
+
 #include "TChain.h"
 #include "TH1.h"
 #include "TH2.h"
 
-#include "TCanvas.h"
-#include "TSystem.h"
-#include "TLorentzVector.h"
 
-#include "AliAnalysisTask.h"
+//#include "TLorentzVector.h"
+
+#include "AliAnalysisTaskSE.h"
 #include "AliTrackReference.h"
 #include "AliKFParticle.h"
 #include "AliKFVertex.h"
 #include "AliAnalysisTaskV0QA.h"
 
 ClassImp(AliAnalysisTaskV0QA)
+AliAnalysisTaskV0QA::AliAnalysisTaskV0QA() :AliAnalysisTaskSE(), 
+fESD(0), 
+fStack(0),
+fMCtruth(0),
+fChain(0),
+fOutputContainer(0),
+fSparseV0(0),
+fSparseK0(0),
+fSparseL(0),
+fSparseAL(0),
+fnEv(0),
+fgDim(50),
+fnConvGamGeant(-1),
+fgConvGamGeantIndex(0),
+feNegConvGamGeantIndex(0),
+fePosConvGamGeantIndex(0),
+feNegConvGamGeantLength(0),
+fePosConvGamGeantLength(0),
+feNegConvGamSingleRecIndex(0),
+fePosConvGamSingleRecIndex(0),
+feNegConvGamV0RecIndex(0),
+fePosConvGamV0RecIndex(0),
+fConvGamV0RecIndexPos(0),
+fConvGamV0RecIndexNeg(0),
+fnDecayLGeant(-1),
+flDecayLGeantIndex(0),
+fpiNegDecayLGeantIndex(0),
+fpPosDecayLGeantIndex(0),
+fpiNegDecayLGeantLength(0),
+fpPosDecayLGeantLength(0),
+fpiNegDecayLSingleRecIndex(0),
+fpPosDecayLSingleRecIndex(0),
+fpiNegDecayLV0RecIndex(0),
+fpPosDecayLV0RecIndex(0),
+fDecayLV0RecIndexPos(0),
+fDecayLV0RecIndexNeg(0),
+fnDecayALGeant(-1),
+falDecayALGeantIndex(0),
+fpiPosDecayALGeantIndex(0),
+fapNegDecayALGeantIndex(0),
+fpiPosDecayALGeantLength(0),
+fapNegDecayALGeantLength(0),
+fpiPosDecayALSingleRecIndex(0),
+fapNegDecayALSingleRecIndex(0),
+fpiPosDecayALV0RecIndex(0),
+fapNegDecayALV0RecIndex(0),
+fDecayALV0RecIndexPos(0),
+fDecayALV0RecIndexNeg(0),
+fnDecayK0Geant(-1),
+fK0DecayK0GeantIndex(0),
+fpiNegDecayK0GeantIndex(0),
+fpiPosDecayK0GeantIndex(0),
+fpiNegDecayK0GeantLength(0),
+fpiPosDecayK0GeantLength(0),
+fpiNegDecayK0SingleRecIndex(0),
+fpiPosDecayK0SingleRecIndex(0),
+fpiNegDecayK0V0RecIndex(0),
+fpiPosDecayK0V0RecIndex(0),
+fDecayK0V0RecIndexPos(0),
+fDecayK0V0RecIndexNeg(0),
+fpiPosK0Index(-1),
+fpiNegK0Index(-1),
+fnTracksPrim(-1),
+ftpcRefit(0),
+fitsRefit(0),
+ftrdRefit(0),
+ftrdOut(0),
+fDim(37),
+fValueL(0),
+fValueAL(0),
+fValueK0(0),
+fValueV0(0),
+fxminV0(0),
+fxmaxV0(0),
+fbinsV0(0),
+fRefTPC(0),
+fclRefsN(0),
+fclRefsP(0)
+
+ {
+  // Default Constructor.
+
+ }
 
 //________________________________________________________________________
-AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTask(name,""), 
+AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTaskSE(name), 
 fESD(0), 
-stack(0),
-mctruth(0),
+fStack(0),
+fMCtruth(0),
 fChain(0),
 fOutputContainer(0),
 fSparseV0(0),
 fSparseK0(0),
 fSparseL(0),
 fSparseAL(0),
-nEv(0),
-nConvGamGeant(-1),
-gConvGamGeantIndex(0),
-eNegConvGamGeantIndex(0),
-ePosConvGamGeantIndex(0),
-eNegConvGamGeantLength(0),
-ePosConvGamGeantLength(0),
-eNegConvGamSingleRecIndex(0),
-ePosConvGamSingleRecIndex(0),
-eNegConvGamV0RecIndex(0),
-ePosConvGamV0RecIndex(0),
-ConvGamV0RecIndexPos(0),
-ConvGamV0RecIndexNeg(0),
-gDim(50),
-nDecayLGeant(-1),
-lDecayLGeantIndex(0),
-piNegDecayLGeantIndex(0),
-pPosDecayLGeantIndex(0),
-piNegDecayLGeantLength(0),
-pPosDecayLGeantLength(0),
-piNegDecayLSingleRecIndex(0),
-pPosDecayLSingleRecIndex(0),
-piNegDecayLV0RecIndex(0),
-pPosDecayLV0RecIndex(0),
-DecayLV0RecIndexPos(0),
-DecayLV0RecIndexNeg(0),
-nDecayALGeant(-1),
-alDecayALGeantIndex(0),
-piPosDecayALGeantIndex(0),
-apNegDecayALGeantIndex(0),
-piPosDecayALGeantLength(0),
-apNegDecayALGeantLength(0),
-piPosDecayALSingleRecIndex(0),
-apNegDecayALSingleRecIndex(0),
-piPosDecayALV0RecIndex(0),
-apNegDecayALV0RecIndex(0),
-DecayALV0RecIndexPos(0),
-DecayALV0RecIndexNeg(0),
-nDecayK0Geant(-1),
-K0DecayK0GeantIndex(0),
-piNegDecayK0GeantIndex(0),
-piPosDecayK0GeantIndex(0),
-piNegDecayK0GeantLength(0),
-piPosDecayK0GeantLength(0),
-piNegDecayK0SingleRecIndex(0),
-piPosDecayK0SingleRecIndex(0),
-piNegDecayK0V0RecIndex(0),
-piPosDecayK0V0RecIndex(0),
-DecayK0V0RecIndexPos(0),
-DecayK0V0RecIndexNeg(0),
-piPosK0Index(-1),
-piNegK0Index(-1),
-nTracksPrim(-1),
-tpcRefit(0),
-itsRefit(0),
-trdRefit(0),
-trdOut(0),
+fnEv(0),
+fgDim(50),
+fnConvGamGeant(-1),
+fgConvGamGeantIndex(0),
+feNegConvGamGeantIndex(0),
+fePosConvGamGeantIndex(0),
+feNegConvGamGeantLength(0),
+fePosConvGamGeantLength(0),
+feNegConvGamSingleRecIndex(0),
+fePosConvGamSingleRecIndex(0),
+feNegConvGamV0RecIndex(0),
+fePosConvGamV0RecIndex(0),
+fConvGamV0RecIndexPos(0),
+fConvGamV0RecIndexNeg(0),
+fnDecayLGeant(-1),
+flDecayLGeantIndex(0),
+fpiNegDecayLGeantIndex(0),
+fpPosDecayLGeantIndex(0),
+fpiNegDecayLGeantLength(0),
+fpPosDecayLGeantLength(0),
+fpiNegDecayLSingleRecIndex(0),
+fpPosDecayLSingleRecIndex(0),
+fpiNegDecayLV0RecIndex(0),
+fpPosDecayLV0RecIndex(0),
+fDecayLV0RecIndexPos(0),
+fDecayLV0RecIndexNeg(0),
+fnDecayALGeant(-1),
+falDecayALGeantIndex(0),
+fpiPosDecayALGeantIndex(0),
+fapNegDecayALGeantIndex(0),
+fpiPosDecayALGeantLength(0),
+fapNegDecayALGeantLength(0),
+fpiPosDecayALSingleRecIndex(0),
+fapNegDecayALSingleRecIndex(0),
+fpiPosDecayALV0RecIndex(0),
+fapNegDecayALV0RecIndex(0),
+fDecayALV0RecIndexPos(0),
+fDecayALV0RecIndexNeg(0),
+fnDecayK0Geant(-1),
+fK0DecayK0GeantIndex(0),
+fpiNegDecayK0GeantIndex(0),
+fpiPosDecayK0GeantIndex(0),
+fpiNegDecayK0GeantLength(0),
+fpiPosDecayK0GeantLength(0),
+fpiNegDecayK0SingleRecIndex(0),
+fpiPosDecayK0SingleRecIndex(0),
+fpiNegDecayK0V0RecIndex(0),
+fpiPosDecayK0V0RecIndex(0),
+fDecayK0V0RecIndexPos(0),
+fDecayK0V0RecIndexNeg(0),
+fpiPosK0Index(-1),
+fpiNegK0Index(-1),
+fnTracksPrim(-1),
+ftpcRefit(0),
+fitsRefit(0),
+ftrdRefit(0),
+ftrdOut(0),
+fDim(37),
 fValueL(0),
 fValueAL(0),
 fValueK0(0),
 fValueV0(0),
-xminV0(0),
-xmaxV0(0),
-binsV0(0),
-fDim(37),
+fxminV0(0),
+fxmaxV0(0),
+fbinsV0(0),
 fRefTPC(0),
-clRefsN(0),
-clRefsP(0)
+fclRefsN(0),
+fclRefsP(0)
 
  {
-  // Constructor.
-  // Input slot #0 works with an Ntuple
-  DefineInput(0, TChain::Class());
-  // Output slot #0 writes into a TH1 container
-  //  DefineOutput(0,TObjArray::Class());
-  DefineOutput(0,TList::Class());
-
-  // Reconstructed arrays
-
-  nEv=0;
-  fDim=37; 
-  fValueK0 = new Double_t[fDim];
-  fValueL = new Double_t[fDim];
-  fValueAL = new Double_t[fDim];
-  fValueV0 = new Double_t[fDim];
-  xminV0 = new Double_t[fDim];
-  xmaxV0 = new Double_t[fDim];
-  binsV0 = new Int_t[fDim];
-
-
-  gDim=50; 
-  gConvGamGeantIndex = new Int_t[gDim];
-  eNegConvGamGeantIndex = new Int_t[gDim];
-  ePosConvGamGeantIndex = new Int_t[gDim];
-  eNegConvGamGeantLength = new Float_t[gDim];
-  ePosConvGamGeantLength = new Float_t[gDim];
-
-  eNegConvGamSingleRecIndex = new Int_t[gDim];
-  ePosConvGamSingleRecIndex = new Int_t[gDim];
-
-  eNegConvGamV0RecIndex = new Int_t[gDim];
-  ePosConvGamV0RecIndex = new Int_t[gDim];
-
-  ConvGamV0RecIndexPos = new Int_t[gDim];
-  ConvGamV0RecIndexNeg = new Int_t[gDim];
 
-  // Lambda to proton pi-
-  lDecayLGeantIndex = new Int_t[gDim];
-  piNegDecayLGeantIndex = new Int_t[gDim];
-  pPosDecayLGeantIndex = new Int_t[gDim];
-  piNegDecayLGeantLength = new Float_t[gDim];
-  pPosDecayLGeantLength = new Float_t[gDim];
+   fnEv=0;
+   fDim=37; 
 
-  piNegDecayLSingleRecIndex = new Int_t[gDim];
-  pPosDecayLSingleRecIndex = new Int_t[gDim];
+   fValueK0 = new Double_t[fDim];
+   fValueL = new Double_t[fDim];
+   fValueAL = new Double_t[fDim];
+   fValueV0 = new Double_t[fDim];
+   fxminV0 = new Double_t[fDim];
+   fxmaxV0 = new Double_t[fDim];
+   fbinsV0 = new Int_t[fDim];
 
-  piNegDecayLV0RecIndex = new Int_t[gDim];
-  pPosDecayLV0RecIndex = new Int_t[gDim];
 
-  DecayLV0RecIndexPos = new Int_t[gDim];
-  DecayLV0RecIndexNeg = new Int_t[gDim];
+  fgDim=50; 
+  fgConvGamGeantIndex = new Int_t[fgDim];
+  feNegConvGamGeantIndex = new Int_t[fgDim];
+  fePosConvGamGeantIndex = new Int_t[fgDim];
+  feNegConvGamGeantLength = new Float_t[fgDim];
+  fePosConvGamGeantLength = new Float_t[fgDim];
 
-  //K0S to pi+ pi-
-  K0DecayK0GeantIndex = new Int_t[gDim];
-  piNegDecayK0GeantIndex = new Int_t[gDim];
-  piPosDecayK0GeantIndex = new Int_t[gDim];
-  piNegDecayK0GeantLength = new Float_t[gDim];
-  piPosDecayK0GeantLength = new Float_t[gDim];
+  feNegConvGamSingleRecIndex = new Int_t[fgDim];
+  fePosConvGamSingleRecIndex = new Int_t[fgDim];
 
-  piNegDecayK0SingleRecIndex = new Int_t[gDim];
-  piPosDecayK0SingleRecIndex = new Int_t[gDim];
+  feNegConvGamV0RecIndex = new Int_t[fgDim];
+  fePosConvGamV0RecIndex = new Int_t[fgDim];
 
-  piNegDecayK0V0RecIndex = new Int_t[gDim];
-  piPosDecayK0V0RecIndex = new Int_t[gDim];
+  fConvGamV0RecIndexPos = new Int_t[fgDim];
+  fConvGamV0RecIndexNeg = new Int_t[fgDim];
 
-  DecayK0V0RecIndexPos = new Int_t[gDim];
-  DecayK0V0RecIndexNeg = new Int_t[gDim];
+  // Lambda to proton pi-
+  flDecayLGeantIndex = new Int_t[fgDim];
+  fpiNegDecayLGeantIndex = new Int_t[fgDim];
+  fpPosDecayLGeantIndex = new Int_t[fgDim];
+  fpiNegDecayLGeantLength = new Float_t[fgDim];
+  fpPosDecayLGeantLength = new Float_t[fgDim];
 
-  //Antilambda to antiproton piplus
-  alDecayALGeantIndex = new Int_t[gDim];
-  piPosDecayALGeantIndex = new Int_t[gDim];
-  apNegDecayALGeantIndex = new Int_t[gDim];
-  piPosDecayALGeantLength = new Float_t[gDim];
-  apNegDecayALGeantLength = new Float_t[gDim];
+  fpiNegDecayLSingleRecIndex = new Int_t[fgDim];
+  fpPosDecayLSingleRecIndex = new Int_t[fgDim];
 
-  piPosDecayALSingleRecIndex = new Int_t[gDim];
-  apNegDecayALSingleRecIndex = new Int_t[gDim];
+  fpiNegDecayLV0RecIndex = new Int_t[fgDim];
+  fpPosDecayLV0RecIndex = new Int_t[fgDim];
 
-  piPosDecayALV0RecIndex = new Int_t[gDim];
-  apNegDecayALV0RecIndex = new Int_t[gDim];
+  fDecayLV0RecIndexPos = new Int_t[fgDim];
+  fDecayLV0RecIndexNeg = new Int_t[fgDim];
 
-  DecayALV0RecIndexPos = new Int_t[gDim];
-  DecayALV0RecIndexNeg = new Int_t[gDim];
+  //K0S to pi+ pi-
+  fK0DecayK0GeantIndex = new Int_t[fgDim];
+  fpiNegDecayK0GeantIndex = new Int_t[fgDim];
+  fpiPosDecayK0GeantIndex = new Int_t[fgDim];
+  fpiNegDecayK0GeantLength = new Float_t[fgDim];
+  fpiPosDecayK0GeantLength = new Float_t[fgDim];
 
+  fpiNegDecayK0SingleRecIndex = new Int_t[fgDim];
+  fpiPosDecayK0SingleRecIndex = new Int_t[fgDim];
 
-  //////////////////////////////////////////////
-  clRefsP = new TClonesArray("AliTrackReference");
-  clRefsN = new TClonesArray("AliTrackReference");
+  fpiNegDecayK0V0RecIndex = new Int_t[fgDim];
+  fpiPosDecayK0V0RecIndex = new Int_t[fgDim];
 
-  //  SetESDtrackCuts();
+  fDecayK0V0RecIndexPos = new Int_t[fgDim];
+  fDecayK0V0RecIndexNeg = new Int_t[fgDim];
 
+  //Antilambda to antiproton piplus
+  falDecayALGeantIndex = new Int_t[fgDim];
+  fpiPosDecayALGeantIndex = new Int_t[fgDim];
+  fapNegDecayALGeantIndex = new Int_t[fgDim];
+  fpiPosDecayALGeantLength = new Float_t[fgDim];
+  fapNegDecayALGeantLength = new Float_t[fgDim];
 
-  AliLog::SetGlobalLogLevel(AliLog::kError);
+  fpiPosDecayALSingleRecIndex = new Int_t[fgDim];
+  fapNegDecayALSingleRecIndex = new Int_t[fgDim];
 
-}
+  fpiPosDecayALV0RecIndex = new Int_t[fgDim];
+  fapNegDecayALV0RecIndex = new Int_t[fgDim];
 
-//________________________________________________________________________
-void AliAnalysisTaskV0QA::ConnectInputData(Option_t *) {
-  printf("   ConnectInputData %s\n", GetName());
+  fDecayALV0RecIndexPos = new Int_t[fgDim];
+  fDecayALV0RecIndexNeg = new Int_t[fgDim];
 
 
-  
-  AliESDInputHandler* esdH = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
-  fESD = esdH->GetEvent();
-  
-  fChain = (TChain*)GetInputData(0);
+  fclRefsP = new TClonesArray("AliTrackReference");
+  fclRefsN = new TClonesArray("AliTrackReference");
+
+  //  SetESDtrackCuts();
+
 
+  AliLog::SetGlobalLogLevel(AliLog::kError);
+//
+  DefineOutput(1, TList::Class());
 }
 
 //_____________________________________________________
@@ -222,239 +291,240 @@ AliAnalysisTaskV0QA::~AliAnalysisTaskV0QA()
   // Remove all pointers
 
 
-  delete [] clRefsP;
-  delete [] clRefsN;
+  delete [] fclRefsP;
+  delete [] fclRefsN;
 
 
   delete [] fValueK0;
   delete [] fValueL;
   delete [] fValueAL;
   delete [] fValueV0;
-  delete [] binsV0;
-  delete [] xminV0;
-  delete [] xmaxV0;
+  delete [] fbinsV0;
+  delete [] fxminV0;
+  delete [] fxmaxV0;
 
-  delete [] gConvGamGeantIndex;
-  delete [] eNegConvGamGeantIndex;
-  delete [] ePosConvGamGeantIndex;
+  delete [] fgConvGamGeantIndex;
+  delete [] feNegConvGamGeantIndex;
+  delete [] fePosConvGamGeantIndex;
 
-  delete [] eNegConvGamSingleRecIndex;
-  delete [] ePosConvGamSingleRecIndex;
+  delete [] feNegConvGamSingleRecIndex;
+  delete [] fePosConvGamSingleRecIndex;
 
-  delete [] eNegConvGamV0RecIndex;
-  delete [] ePosConvGamV0RecIndex;
-  delete [] ConvGamV0RecIndexPos;
-  delete [] ConvGamV0RecIndexNeg;
+  delete [] feNegConvGamV0RecIndex;
+  delete [] fePosConvGamV0RecIndex;
+  delete [] fConvGamV0RecIndexPos;
+  delete [] fConvGamV0RecIndexNeg;
 
-  delete [] lDecayLGeantIndex;
-  delete [] piNegDecayLGeantIndex;
-  delete [] pPosDecayLGeantIndex;
+  delete [] flDecayLGeantIndex;
+  delete [] fpiNegDecayLGeantIndex;
+  delete [] fpPosDecayLGeantIndex;
 
-  delete [] piNegDecayLGeantLength;
-  delete [] pPosDecayLGeantLength;
-  delete [] piNegDecayLSingleRecIndex;
-  delete [] pPosDecayLSingleRecIndex;
+  delete [] fpiNegDecayLGeantLength;
+  delete [] fpPosDecayLGeantLength;
+  delete [] fpiNegDecayLSingleRecIndex;
+  delete [] fpPosDecayLSingleRecIndex;
 
-  delete [] piNegDecayLV0RecIndex;
-  delete [] pPosDecayLV0RecIndex;
-  delete [] DecayLV0RecIndexPos;
-  delete [] DecayLV0RecIndexNeg;
+  delete [] fpiNegDecayLV0RecIndex;
+  delete [] fpPosDecayLV0RecIndex;
+  delete [] fDecayLV0RecIndexPos;
+  delete [] fDecayLV0RecIndexNeg;
 
-  delete [] alDecayALGeantIndex;
-  delete [] piPosDecayALGeantIndex;
-  delete [] apNegDecayALGeantIndex;
+  delete [] falDecayALGeantIndex;
+  delete [] fpiPosDecayALGeantIndex;
+  delete [] fapNegDecayALGeantIndex;
 
-  delete [] piPosDecayALGeantLength;
-  delete [] apNegDecayALGeantLength;
-  delete [] piPosDecayALSingleRecIndex;
-  delete [] apNegDecayALSingleRecIndex;
+  delete [] fpiPosDecayALGeantLength;
+  delete [] fapNegDecayALGeantLength;
+  delete [] fpiPosDecayALSingleRecIndex;
+  delete [] fapNegDecayALSingleRecIndex;
 
-  delete [] piPosDecayALV0RecIndex;
-  delete [] apNegDecayALV0RecIndex;
-  delete [] DecayALV0RecIndexPos;
-  delete [] DecayALV0RecIndexNeg;
+  delete [] fpiPosDecayALV0RecIndex;
+  delete [] fapNegDecayALV0RecIndex;
+  delete [] fDecayALV0RecIndexPos;
+  delete [] fDecayALV0RecIndexNeg;
 
 
-  delete [] piNegDecayK0GeantIndex;
-  delete [] piPosDecayK0GeantIndex;
+  delete [] fpiNegDecayK0GeantIndex;
+  delete [] fpiPosDecayK0GeantIndex;
 
-  delete [] piNegDecayK0GeantLength;
-  delete [] piPosDecayK0GeantLength;
-  delete [] piNegDecayK0SingleRecIndex;
-  delete [] piPosDecayK0SingleRecIndex;
+  delete [] fpiNegDecayK0GeantLength;
+  delete [] fpiPosDecayK0GeantLength;
+  delete [] fpiNegDecayK0SingleRecIndex;
+  delete [] fpiPosDecayK0SingleRecIndex;
 
-  delete [] piNegDecayK0V0RecIndex;
-  delete [] piPosDecayK0V0RecIndex;
+  delete [] fpiNegDecayK0V0RecIndex;
+  delete [] fpiPosDecayK0V0RecIndex;
 
-  delete [] DecayK0V0RecIndexPos;
-  delete [] DecayK0V0RecIndexNeg;
+  delete [] fDecayK0V0RecIndexPos;
+  delete [] fDecayK0V0RecIndexNeg;
 
 }
 
 
 //________________________________________________________________________
-void AliAnalysisTaskV0QA::CreateOutputObjects() {
+void AliAnalysisTaskV0QA::UserCreateOutputObjects() {
+  // Create Ouptut objects
 
   for(Int_t d=0;d<fDim;d++){
-    binsV0[d]=70;
+    fbinsV0[d]=70;
   }
-  xminV0[0]=   0;     // 1/sqrt(pt) Gamma geant
-  xmaxV0[0]=   8;
+  fxminV0[0]=   0;     // 1/sqrt(pt) Gamma geant
+  fxmaxV0[0]=   8;
 
 
-  xminV0[1]=-2.5;   // eta Gamma Geant
-  xmaxV0[1]= 1.5;
+  fxminV0[1]=-2.5;   // eta Gamma Geant
+  fxmaxV0[1]= 1.5;
 
 
-  xminV0[2]=-2*TMath::Pi();   // phi Gamma geant
-  xmaxV0[2]= TMath::Pi();
+  fxminV0[2]=-2*TMath::Pi();   // phi Gamma geant
+  fxmaxV0[2]= TMath::Pi();
 
 
-  xminV0[3]=   0;     // r geant
-  xmaxV0[3]= 200;
+  fxminV0[3]=   0;     // r geant
+  fxmaxV0[3]= 200;
 
 
-  xminV0[4]=-250;   // z geant
-  xmaxV0[4]= 250;
+  fxminV0[4]=-250;   // z geant
+  fxmaxV0[4]= 250;
 
 
-  xminV0[5]=   0;     // 1/sqrt(pt) Geant Pos
-  xmaxV0[5]=   8;
+  fxminV0[5]=   0;     // 1/sqrt(pt) Geant Pos
+  fxmaxV0[5]=   8;
 
 
-  xminV0[6]=-2.5;   // eta geant Pos
-  xmaxV0[6]= 1.5;
+  fxminV0[6]=-2.5;   // eta geant Pos
+  fxmaxV0[6]= 1.5;
 
 
-  xminV0[7]=-2*TMath::Pi();   // phi Geant Pos
-  xmaxV0[7]= TMath::Pi();
+  fxminV0[7]=-2*TMath::Pi();   // phi Geant Pos
+  fxmaxV0[7]= TMath::Pi();
 
   
-  xminV0[8]=0;   // Track Length TPC Geant Pos
-  xmaxV0[8]= 200;
+  fxminV0[8]=0;   // Track Length TPC Geant Pos
+  fxmaxV0[8]= 200;
 
 
-  xminV0[9]=   0;     // 1/sqrt(pt) Geant Neg
-  xmaxV0[9]=   8;
+  fxminV0[9]=   0;     // 1/sqrt(pt) Geant Neg
+  fxmaxV0[9]=   8;
 
 
-  xminV0[10]=-2.5;   // eta Geant Neg
-  xmaxV0[10]= 1.5;
+  fxminV0[10]=-2.5;   // eta Geant Neg
+  fxmaxV0[10]= 1.5;
 
 
-  xminV0[11]=-2*TMath::Pi();   // phi Geant Neg
-  xmaxV0[11]= TMath::Pi();
+  fxminV0[11]=-2*TMath::Pi();   // phi Geant Neg
+  fxmaxV0[11]= TMath::Pi();
 
 
-  xminV0[12]=0;   // Track Length TPC Geant Neg
-  xmaxV0[12]= 200;
+  fxminV0[12]=0;   // Track Length TPC Geant Neg
+  fxmaxV0[12]= 200;
 
 
 
   //-----------Rec single variables
 
-  xminV0[13]=   -0.5;     // (pt-ptGeant)/ptGeant rec Pos
-  xmaxV0[13]=   0.5;
+  fxminV0[13]=   -0.5;     // (pt-ptGeant)/ptGeant rec Pos
+  fxmaxV0[13]=   0.5;
 
 
-  xminV0[14]=-2.5;   // eta  rec Pos
-  xmaxV0[14]= 1.5;
+  fxminV0[14]=-2.5;   // eta  rec Pos
+  fxmaxV0[14]= 1.5;
 
 
-  xminV0[15]=-2*TMath::Pi();   // phi rec Pos
-  xmaxV0[15]= TMath::Pi();
+  fxminV0[15]=-2*TMath::Pi();   // phi rec Pos
+  fxmaxV0[15]= TMath::Pi();
 
 
-  xminV0[16]=   0;     // Impact parameter rec Pos
-  xmaxV0[16]=   100;
+  fxminV0[16]=   0;     // Impact parameter rec Pos
+  fxmaxV0[16]=   100;
 
 
-  xminV0[17]=   0;     // nsigmas Impact parameter rec Pos
-  xmaxV0[17]=   100;
+  fxminV0[17]=   0;     // nsigmas Impact parameter rec Pos
+  fxmaxV0[17]=   100;
 
 
 
-  xminV0[18]=   -1;     // Ncls ITS rec Pos
-  xmaxV0[18]=   6;
+  fxminV0[18]=   -1;     // Ncls ITS rec Pos
+  fxmaxV0[18]=   6;
 
 
-  xminV0[19]=   -1;     // Ncls TPC rec Pos
-  xmaxV0[19]=   180;
+  fxminV0[19]=   -1;     // Ncls TPC rec Pos
+  fxmaxV0[19]=   180;
 
 
-  xminV0[20]=   -2;     // Status Single  TPC rec Pos
-  xmaxV0[20]=   2;
+  fxminV0[20]=   -2;     // Status Single  TPC rec Pos
+  fxmaxV0[20]=   2;
 
 
-  xminV0[21]=   -0.5;     // (pt-ptGeant)/ptGeant rec Neg
-  xmaxV0[21]=   0.5;
+  fxminV0[21]=   -0.5;     // (pt-ptGeant)/ptGeant rec Neg
+  fxmaxV0[21]=   0.5;
 
 
-  xminV0[22]=-2.5;   // eta  rec Neg
-  xmaxV0[22]= 1.5;
+  fxminV0[22]=-2.5;   // eta  rec Neg
+  fxmaxV0[22]= 1.5;
 
 
-  xminV0[23]=-2*TMath::Pi();   // phi rec Neg
-  xmaxV0[23]= TMath::Pi();
+  fxminV0[23]=-2*TMath::Pi();   // phi rec Neg
+  fxmaxV0[23]= TMath::Pi();
 
 
-  xminV0[24]=   0;     // Impact parameter rec Neg
-  xmaxV0[24]=   100;
+  fxminV0[24]=   0;     // Impact parameter rec Neg
+  fxmaxV0[24]=   100;
 
 
-  xminV0[25]=   0;     // Sigmas Impact parameter rec Neg
-  xmaxV0[25]=   100;
+  fxminV0[25]=   0;     // Sigmas Impact parameter rec Neg
+  fxmaxV0[25]=   100;
 
 
 
-  xminV0[26]=   -1;     // Ncls ITS rec Neg
-  xmaxV0[26]=   6;
+  fxminV0[26]=   -1;     // Ncls ITS rec Neg
+  fxmaxV0[26]=   6;
 
 
-  xminV0[27]=   -1;     // Ncls TPC rec Neg
-  xmaxV0[27]=   180;
+  fxminV0[27]=   -1;     // Ncls TPC rec Neg
+  fxmaxV0[27]=   180;
 
 
-  xminV0[28]=   -2;     // Status Single  TPC rec Neg
-  xmaxV0[28]=   2;
+  fxminV0[28]=   -2;     // Status Single  TPC rec Neg
+  fxmaxV0[28]=   2;
 
   // ------------------Rec V0 variables
 
 
 
-  xminV0[29]=   -0.5;     // (pt-ptGeant)/ptGeant rec V0 Pos
-  xmaxV0[29]=   0.5;
+  fxminV0[29]=   -0.5;     // (pt-ptGeant)/ptGeant rec V0 Pos
+  fxmaxV0[29]=   0.5;
 
 
-  xminV0[30]=-2.5;   // eta  rec V0 Pos
-  xmaxV0[30]= 1.5;
+  fxminV0[30]=-2.5;   // eta  rec V0 Pos
+  fxmaxV0[30]= 1.5;
 
 
-  xminV0[31]=-2*TMath::Pi();   // phi rec V0 Pos
-  xmaxV0[31]= TMath::Pi();
+  fxminV0[31]=-2*TMath::Pi();   // phi rec V0 Pos
+  fxmaxV0[31]= TMath::Pi();
 
 
-  xminV0[32]=   -2;     // Status V0 TPC rec Pos
-  xmaxV0[32]=   2;
+  fxminV0[32]=   -2;     // Status V0 TPC rec Pos
+  fxmaxV0[32]=   2;
 
 
 
 
-  xminV0[33]=   -0.5;     // 1/sqrt(pt) rec V0 Neg
-  xmaxV0[33]=   0.5;
+  fxminV0[33]=   -0.5;     // 1/sqrt(pt) rec V0 Neg
+  fxmaxV0[33]=   0.5;
 
 
-  xminV0[34]=-2.5;   // eta  rec V0 Neg
-  xmaxV0[34]= 1.5;
+  fxminV0[34]=-2.5;   // eta  rec V0 Neg
+  fxmaxV0[34]= 1.5;
 
 
-  xminV0[35]=-2*TMath::Pi();   // phi rec V0 Neg
-  xmaxV0[35]= TMath::Pi();
+  fxminV0[35]=-2*TMath::Pi();   // phi rec V0 Neg
+  fxmaxV0[35]= TMath::Pi();
 
 
 
-  xminV0[36]=   -2;     // Status V0 TPC rec Neg
-  xmaxV0[36]=   2;
+  fxminV0[36]=   -2;     // Status V0 TPC rec Neg
+  fxmaxV0[36]=   2;
 
 
 
@@ -497,7 +567,7 @@ void AliAnalysisTaskV0QA::CreateOutputObjects() {
                          "statusV0SingleNeg"};
 
 
-  fSparseV0= new THnSparseF("sparseV0","sparseV0",fDim,binsV0,xminV0,xmaxV0);
+  fSparseV0= new THnSparseF("sparseV0","sparseV0",fDim,fbinsV0,fxminV0,fxmaxV0);
 
   for (Int_t iaxis=0; iaxis<fDim; iaxis++){
    fSparseV0->GetAxis(iaxis)->SetName(axisName[iaxis]);
@@ -544,7 +614,7 @@ void AliAnalysisTaskV0QA::CreateOutputObjects() {
 
 
 
-  fSparseK0= new THnSparseF("sparseK0","sparseK0",fDim,binsV0,xminV0,xmaxV0);
+  fSparseK0= new THnSparseF("sparseK0","sparseK0",fDim,fbinsV0,fxminV0,fxmaxV0);
   for (Int_t iaxis=0; iaxis<fDim; iaxis++){
    fSparseK0->GetAxis(iaxis)->SetName(axisNameK0[iaxis]);
    fSparseK0->GetAxis(iaxis)->SetTitle(axisNameK0[iaxis]);
@@ -589,7 +659,7 @@ void AliAnalysisTaskV0QA::CreateOutputObjects() {
                          "statusRecV0Neg"};
 
 
-  fSparseL= new THnSparseF("sparseL","sparseL",fDim,binsV0,xminV0,xmaxV0);
+  fSparseL= new THnSparseF("sparseL","sparseL",fDim,fbinsV0,fxminV0,fxmaxV0);
   for (Int_t iaxis=0; iaxis<fDim; iaxis++){
    fSparseL->GetAxis(iaxis)->SetName(axisNameL[iaxis]);
    fSparseL->GetAxis(iaxis)->SetTitle(axisNameL[iaxis]);
@@ -634,7 +704,7 @@ void AliAnalysisTaskV0QA::CreateOutputObjects() {
                          "statusRecV0Neg"};
 
 
-  fSparseAL= new THnSparseF("sparseAL","sparseAL",fDim,binsV0,xminV0,xmaxV0);
+  fSparseAL= new THnSparseF("sparseAL","sparseAL",fDim,fbinsV0,fxminV0,fxmaxV0);
   for (Int_t iaxis=0; iaxis<fDim; iaxis++){
    fSparseAL->GetAxis(iaxis)->SetName(axisNameAL[iaxis]);
    fSparseAL->GetAxis(iaxis)->SetTitle(axisNameAL[iaxis]);
@@ -654,24 +724,27 @@ void AliAnalysisTaskV0QA::CreateOutputObjects() {
 }
 
 //________________________________________________________________________
-void AliAnalysisTaskV0QA::Exec(Option_t *) {
+void AliAnalysisTaskV0QA::UserExec(Option_t *) {
+  // Execution of the Task
 
+    fESD = dynamic_cast<AliESDEvent*>(InputEvent());
+    
   if (!fESD) {
-    cout<< "not a tree"<< endl;
+    //cout<< "not a tree"<< endl;
     return;
   }
 
-  nEv++;
+  fnEv++;
 
 
   //Get MC data 
-  mctruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
+  fMCtruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
 
   //  Double_t vertex[3];
-  Double_t MaxVertex=150.;
-  Double_t MaxEta=1.2;
-  Double_t LineCutZRSlope=0.662486;
-  Double_t LineCutZValue=7.;
+  Double_t maxVertex=150.;
+  Double_t maxEta=1.2;
+  Double_t lineCutZRSlope=0.662486;
+  Double_t lineCutZValue=7.;
   Int_t elecGIndex=-1;
   Int_t posiGIndex=-1;
   Int_t pPosLIndex=-1;
@@ -680,62 +753,62 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
   Int_t apNegALIndex=-1;
   Int_t piPosALIndex=-1;
 
-  nConvGamGeant=-1;
-  nDecayK0Geant=-1;
-  nDecayLGeant=-1;
-  nDecayALGeant=-1;
+  fnConvGamGeant=-1;
+  fnDecayK0Geant=-1;
+  fnDecayLGeant=-1;
+  fnDecayALGeant=-1;
 
-  for(Int_t i=0; i<gDim;i++){
-    gConvGamGeantIndex[i] = -1;
-    eNegConvGamGeantIndex[i] = -1;
-    ePosConvGamGeantIndex[i] = -1;
+  for(Int_t i=0; i<fgDim;i++){
+    fgConvGamGeantIndex[i] = -1;
+    feNegConvGamGeantIndex[i] = -1;
+    fePosConvGamGeantIndex[i] = -1;
     
-    eNegConvGamSingleRecIndex[i] = -1;
-    ePosConvGamSingleRecIndex[i] = -1;
+    feNegConvGamSingleRecIndex[i] = -1;
+    fePosConvGamSingleRecIndex[i] = -1;
 
-    eNegConvGamV0RecIndex[i] = -1;
-    ePosConvGamV0RecIndex[i] = -1;
-    ConvGamV0RecIndexPos[i] = -1;
-    ConvGamV0RecIndexNeg[i] = -1;
+    feNegConvGamV0RecIndex[i] = -1;
+    fePosConvGamV0RecIndex[i] = -1;
+    fConvGamV0RecIndexPos[i] = -1;
+    fConvGamV0RecIndexNeg[i] = -1;
 
 
-    K0DecayK0GeantIndex[i] = -1;
-    piNegDecayK0GeantIndex[i] = -1;
-    piPosDecayK0GeantIndex[i] = -1;
+    fK0DecayK0GeantIndex[i] = -1;
+    fpiNegDecayK0GeantIndex[i] = -1;
+    fpiPosDecayK0GeantIndex[i] = -1;
     
-    piNegDecayK0SingleRecIndex[i] = -1;
-    piPosDecayK0SingleRecIndex[i] = -1;
+    fpiNegDecayK0SingleRecIndex[i] = -1;
+    fpiPosDecayK0SingleRecIndex[i] = -1;
 
-    piNegDecayK0V0RecIndex[i] = -1;
-    piPosDecayK0V0RecIndex[i] = -1;
-    DecayK0V0RecIndexPos[i] = -1;
-    DecayK0V0RecIndexNeg[i] = -1;
+    fpiNegDecayK0V0RecIndex[i] = -1;
+    fpiPosDecayK0V0RecIndex[i] = -1;
+    fDecayK0V0RecIndexPos[i] = -1;
+    fDecayK0V0RecIndexNeg[i] = -1;
 
 
-    lDecayLGeantIndex[i] = -1;
-    piNegDecayLGeantIndex[i] = -1;
-    pPosDecayLGeantIndex[i] = -1;
+    flDecayLGeantIndex[i] = -1;
+    fpiNegDecayLGeantIndex[i] = -1;
+    fpPosDecayLGeantIndex[i] = -1;
     
-    piNegDecayLSingleRecIndex[i] = -1;
-    pPosDecayLSingleRecIndex[i] = -1;
+    fpiNegDecayLSingleRecIndex[i] = -1;
+    fpPosDecayLSingleRecIndex[i] = -1;
 
-    piNegDecayLV0RecIndex[i] = -1;
-    pPosDecayLV0RecIndex[i] = -1;
-    DecayLV0RecIndexPos[i] = -1;
-    DecayLV0RecIndexNeg[i] = -1;
+    fpiNegDecayLV0RecIndex[i] = -1;
+    fpPosDecayLV0RecIndex[i] = -1;
+    fDecayLV0RecIndexPos[i] = -1;
+    fDecayLV0RecIndexNeg[i] = -1;
 
     // Antilambda
-    alDecayALGeantIndex[i] = -1;
-    piPosDecayALGeantIndex[i] = -1;
-    apNegDecayALGeantIndex[i] = -1;
+    falDecayALGeantIndex[i] = -1;
+    fpiPosDecayALGeantIndex[i] = -1;
+    fapNegDecayALGeantIndex[i] = -1;
     
-    piPosDecayALSingleRecIndex[i] = -1;
-    apNegDecayALSingleRecIndex[i] = -1;
+    fpiPosDecayALSingleRecIndex[i] = -1;
+    fapNegDecayALSingleRecIndex[i] = -1;
 
-    piPosDecayALV0RecIndex[i] = -1;
-    apNegDecayALV0RecIndex[i] = -1;
-    DecayALV0RecIndexPos[i] = -1;
-    DecayALV0RecIndexNeg[i] = -1;
+    fpiPosDecayALV0RecIndex[i] = -1;
+    fapNegDecayALV0RecIndex[i] = -1;
+    fDecayALV0RecIndexPos[i] = -1;
+    fDecayALV0RecIndexNeg[i] = -1;
 
 
   }
@@ -743,20 +816,20 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
   Int_t doMC=1;
 
   AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
-  nTracksPrim=primVtx.GetNContributors();
+  fnTracksPrim=primVtx.GetNContributors();
 
 
-  if(mctruth && nTracksPrim>0){
+  if(fMCtruth && fnTracksPrim>0){
 
-   stack = mctruth->MCEvent()->Stack();
+   fStack = fMCtruth->MCEvent()->Stack();
 
 
    if ( doMC){
 
-    for (Int_t iTracks = 0; iTracks < mctruth->MCEvent()->GetNumberOfTracks(); iTracks++) {
+    for (Int_t iTracks = 0; iTracks < fMCtruth->MCEvent()->GetNumberOfTracks(); iTracks++) {
       
 
-     TParticle* particle = stack->Particle(iTracks);
+     TParticle* particle = fStack->Particle(iTracks);
 
 
 
@@ -772,11 +845,11 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
      if (particle->GetPdgCode()== 22){
        
        
-       if(particle->GetMother(0) >-1 && stack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
+       if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
         continue; // no photon as mothers!
        }
        
-       if(particle->GetMother(0) >= stack->GetNprimary()){
+       if(particle->GetMother(0) >= fStack->GetNprimary()){
         continue; // the gamma has a mother, and it is not a primary particle
        }
        
@@ -787,7 +860,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
   
        if(particle->GetNDaughters() >= 2){
         for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
-          TParticle *tmpDaughter = stack->Particle(daughterIndex);
+          TParticle *tmpDaughter = fStack->Particle(daughterIndex);
           if(tmpDaughter->GetUniqueID() == 5){
             if(tmpDaughter->GetPdgCode() == 11){
               eNeg = tmpDaughter;
@@ -806,16 +879,16 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
         continue;
        }
        
-       if(TMath::Abs(ePos->Eta())> MaxEta || TMath::Abs(eNeg->Eta())> MaxEta){
+       if(TMath::Abs(ePos->Eta())> maxEta || TMath::Abs(eNeg->Eta())> maxEta){
         continue;
        }       
        
-       if(ePos->R()> MaxVertex ){
+       if(ePos->R()> maxVertex ){
         continue; // cuts on distance from collision point
        }
       
       
-       if( (TMath::Abs(ePos->Vz()) * LineCutZRSlope - LineCutZValue)  > ePos->R() ){
+       if( (TMath::Abs(ePos->Vz()) * lineCutZRSlope - lineCutZValue)  > ePos->R() ){
         continue;               // line cut to exclude regions where we do not reconstruct
        }               
 
@@ -823,9 +896,9 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        // Looking at the existance of TPC references
 
        TParticle* ePosTPC;
-       mctruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,clRefsP);
+       fMCtruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,fclRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(posiGIndex);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(posiGIndex));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
@@ -833,13 +906,13 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
 
  
 
-       int nPointsP =  clRefsP->GetEntries();
+       int nPointsP =  fclRefsP->GetEntries();
 
-       if (fRefTPC) delete fRefTPC;
+       if (fRefTPC) delete fRefTPC;fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsP; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsP->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -860,20 +933,20 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
 
 
        TParticle* eNegTPC;
-       mctruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,clRefsN);
+       fMCtruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,fclRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(elecGIndex);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(elecGIndex));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
        Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0); 
-       int nPointsN =  clRefsN->GetEntries();
+       int nPointsN =  fclRefsN->GetEntries();
 
-       if (fRefTPC) delete fRefTPC;
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsN; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsN->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -896,33 +969,33 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        ////////////////////////////////////////////////////////////////////
        
        
-       nConvGamGeant++;
-       gConvGamGeantIndex[nConvGamGeant]=iTracks;
-       eNegConvGamGeantIndex[nConvGamGeant] = elecGIndex;
-       ePosConvGamGeantIndex[nConvGamGeant] = posiGIndex;
+       fnConvGamGeant++;
+       fgConvGamGeantIndex[fnConvGamGeant]=iTracks;
+       feNegConvGamGeantIndex[fnConvGamGeant] = elecGIndex;
+       fePosConvGamGeantIndex[fnConvGamGeant] = posiGIndex;
        
-       eNegConvGamGeantLength[nConvGamGeant] = tpcTrackLengtheNeg;
-       ePosConvGamGeantLength[nConvGamGeant] = tpcTrackLengthePos;
+       feNegConvGamGeantLength[fnConvGamGeant] = tpcTrackLengtheNeg;
+       fePosConvGamGeantLength[fnConvGamGeant] = tpcTrackLengthePos;
 
      }
 
      
      TParticle* piPos = NULL;
      TParticle* piNeg = NULL;
-     piPosK0Index=-1;
-     piNegK0Index=-1;
+     fpiPosK0Index=-1;
+     fpiNegK0Index=-1;
 
      if (particle->GetPdgCode()== 310){          // k0short
        if(particle->GetNDaughters() == 2){
         for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
-          TParticle *tmpDaughter = stack->Particle(daughterIndex);
+          TParticle *tmpDaughter = fStack->Particle(daughterIndex);
           if(tmpDaughter->GetPdgCode() == 211){
             piPos= tmpDaughter;
-            piPosK0Index=daughterIndex;
+            fpiPosK0Index=daughterIndex;
           }
           else if(tmpDaughter->GetPdgCode() == -211){
             piNeg = tmpDaughter;
-            piNegK0Index=daughterIndex;
+            fpiNegK0Index=daughterIndex;
           }
         }
        }
@@ -931,37 +1004,37 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
         continue;
        }
        
-       if(TMath::Abs(piPos->Eta())> MaxEta || TMath::Abs(piNeg->Eta())> MaxEta){
+       if(TMath::Abs(piPos->Eta())> maxEta || TMath::Abs(piNeg->Eta())> maxEta){
         continue;
        }       
        
-       if(piPos->R()> MaxVertex ){
+       if(piPos->R()> maxVertex ){
         continue; // cuts on distance from collision point
        }
       
       
-       if( (TMath::Abs(piPos->Vz()) * LineCutZRSlope - LineCutZValue)  > piPos->R() ){
+       if( (TMath::Abs(piPos->Vz()) * lineCutZRSlope - lineCutZValue)  > piPos->R() ){
         continue;               // line cut to exclude regions where we do not reconstruct
        }               
 
       // Looking at the existance of TPC references
 
        TParticle* ePosTPC;
-       mctruth->MCEvent()->GetParticleAndTR(piPosK0Index,ePosTPC,clRefsP);
+       fMCtruth->MCEvent()->GetParticleAndTR(fpiPosK0Index,ePosTPC,fclRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(piPosK0Index);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiPosK0Index));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
        Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0); 
  
 
-       int nPointsP =  clRefsP->GetEntries();
-       if (fRefTPC) delete fRefTPC;
+       int nPointsP =  fclRefsP->GetEntries();
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsP; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsP->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -974,7 +1047,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        int labelPosRefs=0;
        for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
         AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
-        if (aRef->GetTrack() != piPosK0Index ) break;                  
+        if (aRef->GetTrack() != fpiPosK0Index ) break;                 
         ++labelPosRefs;
        }
      
@@ -982,20 +1055,20 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
 
 
        TParticle* eNegTPC;
-       mctruth->MCEvent()->GetParticleAndTR(piNegK0Index,eNegTPC,clRefsN);
+       fMCtruth->MCEvent()->GetParticleAndTR(fpiNegK0Index,eNegTPC,fclRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(piNegK0Index);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiNegK0Index));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
        Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0); 
 
-       int nPointsN =  clRefsN->GetEntries();
-       if (fRefTPC) delete fRefTPC;
+       int nPointsN =  fclRefsN->GetEntries();
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsN; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsN->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -1008,20 +1081,20 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        int labelNegRefs=0;
        for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
         AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
-        if (aRef->GetTrack() != piNegK0Index ) break;                  
+        if (aRef->GetTrack() != fpiNegK0Index ) break;                 
         ++labelNegRefs;
        }
        
        if ( labelNegRefs==0 || labelPosRefs==0) continue; // if pi+/pi- do not have a TPC ref continue;
        ////////////////////////////////////////////////////////////////////
        
-       nDecayK0Geant++;
+       fnDecayK0Geant++;
 
-       K0DecayK0GeantIndex[nDecayK0Geant]=iTracks;
-       piNegDecayK0GeantIndex[nDecayK0Geant]=piNegK0Index;
-       piPosDecayK0GeantIndex[nDecayK0Geant]=piPosK0Index;
-       piNegDecayK0GeantLength[nDecayK0Geant]=tpcTrackLengtheNeg;
-       piPosDecayK0GeantLength[nDecayK0Geant]=tpcTrackLengthePos;
+       fK0DecayK0GeantIndex[fnDecayK0Geant]=iTracks;
+       fpiNegDecayK0GeantIndex[fnDecayK0Geant]=fpiNegK0Index;
+       fpiPosDecayK0GeantIndex[fnDecayK0Geant]=fpiPosK0Index;
+       fpiNegDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengtheNeg;
+       fpiPosDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengthePos;
       
      }    
 
@@ -1036,7 +1109,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
       
        if(particle->GetNDaughters() == 2){
         for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
-          TParticle *tmpDaughter = stack->Particle(daughterIndex);
+          TParticle *tmpDaughter = fStack->Particle(daughterIndex);
           if(tmpDaughter->GetPdgCode() == 2212){
             pPos= tmpDaughter;
             pPosLIndex=daughterIndex;
@@ -1052,16 +1125,16 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
         continue;
        }
 
-       if(TMath::Abs(pPos->Eta())> MaxEta || TMath::Abs(piNegL->Eta())> MaxEta){
+       if(TMath::Abs(pPos->Eta())> maxEta || TMath::Abs(piNegL->Eta())> maxEta){
         continue;
        }       
        
-       if(pPos->R()> MaxVertex ){
+       if(pPos->R()> maxVertex ){
         continue; // cuts on distance from collision point
        }
       
       
-       if( (TMath::Abs(pPos->Vz()) * LineCutZRSlope - LineCutZValue)  > pPos->R() ){
+       if( (TMath::Abs(pPos->Vz()) * lineCutZRSlope - lineCutZValue)  > pPos->R() ){
         continue;               // line cut to exclude regions where we do not reconstruct
        }
 
@@ -1069,21 +1142,21 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
      // Looking at the existance of TPC references
 
        TParticle* ePosTPC;
-       mctruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,clRefsP);
+       fMCtruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,fclRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(pPosLIndex);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(pPosLIndex));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
        Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0); 
  
 
-       int nPointsP =  clRefsP->GetEntries();
-       if (fRefTPC) delete fRefTPC;
+       int nPointsP =  fclRefsP->GetEntries();
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsP; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsP->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -1104,20 +1177,20 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
 
 
        TParticle* eNegTPC;
-       mctruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,clRefsN);
+       fMCtruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,fclRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(piNegLIndex);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piNegLIndex));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
        Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0); 
 
-       int nPointsN =  clRefsN->GetEntries();
+       int nPointsN =  fclRefsN->GetEntries();
        if (fRefTPC) delete fRefTPC;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsN; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsN->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -1137,15 +1210,15 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
        ////////////////////////////////////////////////////////////////////
      
-       nDecayLGeant++;
+       fnDecayLGeant++;
 
-       lDecayLGeantIndex[nDecayLGeant]=iTracks;
+       flDecayLGeantIndex[fnDecayLGeant]=iTracks;
      
-       piNegDecayLGeantIndex[nDecayLGeant]=piNegLIndex;
-       pPosDecayLGeantIndex[nDecayLGeant]=pPosLIndex;
+       fpiNegDecayLGeantIndex[fnDecayLGeant]=piNegLIndex;
+       fpPosDecayLGeantIndex[fnDecayLGeant]=pPosLIndex;
 
-       piNegDecayLGeantLength[nDecayLGeant]=tpcTrackLengtheNeg;
-       pPosDecayLGeantLength[nDecayLGeant]=tpcTrackLengthePos;
+       fpiNegDecayLGeantLength[fnDecayLGeant]=tpcTrackLengtheNeg;
+       fpPosDecayLGeantLength[fnDecayLGeant]=tpcTrackLengthePos;
 
      
      }
@@ -1163,7 +1236,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
 
        if(particle->GetNDaughters() == 2){
         for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
-          TParticle *tmpDaughter = stack->Particle(daughterIndex);
+          TParticle *tmpDaughter = fStack->Particle(daughterIndex);
           if(tmpDaughter->GetPdgCode() == -2212){
             apNeg= tmpDaughter;
             apNegALIndex=daughterIndex;
@@ -1179,16 +1252,16 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
         continue;
        }
 
-       if(TMath::Abs(apNeg->Eta())> MaxEta || TMath::Abs(piPosAL->Eta())> MaxEta){
+       if(TMath::Abs(apNeg->Eta())> maxEta || TMath::Abs(piPosAL->Eta())> maxEta){
         continue;
        }       
        
-       if(apNeg->R()> MaxVertex ){
+       if(apNeg->R()> maxVertex ){
         continue; // cuts on distance from collision point
        }
       
       
-       if( (TMath::Abs(apNeg->Vz()) * LineCutZRSlope - LineCutZValue)  > apNeg->R() ){
+       if( (TMath::Abs(apNeg->Vz()) * lineCutZRSlope - lineCutZValue)  > apNeg->R() ){
         continue;               // line cut to exclude regions where we do not reconstruct
        }
 
@@ -1196,20 +1269,20 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
      // Looking at the existance of TPC references
 
        TParticle* ePosTPC;
-       mctruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,clRefsP);
+       fMCtruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,fclRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(piPosALIndex);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piPosALIndex));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
        Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0); 
 
-       int nPointsP =  clRefsP->GetEntries();
+       int nPointsP =  fclRefsP->GetEntries();
        if (fRefTPC) delete fRefTPC;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsP; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsP->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -1228,20 +1301,20 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
      
 
        TParticle* eNegTPC;
-       mctruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,clRefsN);
+       fMCtruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,fclRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(apNegALIndex);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(apNegALIndex));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
        Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0); 
 
-       int nPointsN =  clRefsN->GetEntries();
+       int nPointsN =  fclRefsN->GetEntries();
        if (fRefTPC) delete fRefTPC;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsN; iPoint++) {
-        AliTrackReference *ref = (AliTrackReference*)clRefsN->At(iPoint);
+        AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
         if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));    
        }
 
@@ -1263,14 +1336,14 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
        ////////////////////////////////////////////////////////////////////
      
-       nDecayALGeant++;
-       alDecayALGeantIndex[nDecayALGeant]=iTracks;
+       fnDecayALGeant++;
+       falDecayALGeantIndex[fnDecayALGeant]=iTracks;
      
-       piPosDecayALGeantIndex[nDecayALGeant]=piPosALIndex;
-       apNegDecayALGeantIndex[nDecayALGeant]=apNegALIndex;
+       fpiPosDecayALGeantIndex[fnDecayALGeant]=piPosALIndex;
+       fapNegDecayALGeantIndex[fnDecayALGeant]=apNegALIndex;
 
-       piPosDecayALGeantLength[nDecayALGeant]=tpcTrackLengthePos;
-       apNegDecayALGeantLength[nDecayALGeant]=tpcTrackLengtheNeg;
+       fpiPosDecayALGeantLength[fnDecayALGeant]=tpcTrackLengthePos;
+       fapNegDecayALGeantLength[fnDecayALGeant]=tpcTrackLengtheNeg;
 
      
      }  // AntiLambda    
@@ -1287,32 +1360,32 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
   Double_t xyzVtx[3];
   pvertex->GetXYZ(xyzVtx);
 
-  if(nTracksPrim>0) {
+  if(fnTracksPrim>0) {
 
     InspectListOfChargedParticles();
     InspectListOfV0s();
 
 
-    if(nConvGamGeant>-1){
+    if(fnConvGamGeant>-1){
       FillHnSparseGamma();
     }
 
-    if(nDecayK0Geant>-1){
+    if(fnDecayK0Geant>-1){
       FillHnSparseK0();
     }
 
-    if(nDecayLGeant>-1){
+    if(fnDecayLGeant>-1){
       FillHnSparseL();
     }
 
-    if(nDecayALGeant>-1){
+    if(fnDecayALGeant>-1){
       FillHnSparseAL();
     }
 
   }
 
  
-  PostData(0,fOutputContainer );
+  PostData(1, fOutputContainer );
   
 
 }
@@ -1324,6 +1397,7 @@ void AliAnalysisTaskV0QA::Terminate(Option_t *) {
 
 
 Int_t AliAnalysisTaskV0QA::GetTPCReference(Int_t label) {
+  // Get TPC References
 
   int start = TMath::BinarySearch(fRefTPC->GetEntries(), fLabelsTPC, label);
 
@@ -1341,7 +1415,7 @@ Int_t AliAnalysisTaskV0QA::GetTPCReference(Int_t label) {
 
 
 void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
-
+  // Look at the list of particles for the single track reconstruction
 
   for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++){
 
@@ -1359,10 +1433,10 @@ void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
 
     Int_t labelMC = TMath::Abs(curTrack->GetLabel());
 
-    if ( labelMC > stack->GetNtrack() ) continue;
+    if ( labelMC > fStack->GetNtrack() ) continue;
 
 
-    TParticle* curParticle = stack->Particle(labelMC);
+    TParticle* curParticle = fStack->Particle(labelMC);
     if(curParticle->GetMother(0)==-1){
       continue;
     }
@@ -1370,19 +1444,19 @@ void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
      
     if(TMath::Abs(curParticle->GetPdgCode()) == 11){ // e+/e-
       
-      if( stack->Particle(curParticle->GetMother(0))->GetPdgCode()==22 ){  // e+/e- from gamma
+      if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==22 ){  // e+/e- from gamma
        if( curParticle->GetUniqueID()!=5 ){ // e+/e- from gamma conversion
          continue;
        }
 
-       for(Int_t iGamConv=0;iGamConv<nConvGamGeant+1;iGamConv++ ){
+       for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
          if(curTrack->GetSign()>0){
-           if (labelMC== ePosConvGamGeantIndex[iGamConv]){
-             ePosConvGamSingleRecIndex[iGamConv]=iTracks;
+           if (labelMC== fePosConvGamGeantIndex[iGamConv]){
+             fePosConvGamSingleRecIndex[iGamConv]=iTracks;
            }
          }else{
-           if (labelMC== eNegConvGamGeantIndex[iGamConv]){
-             eNegConvGamSingleRecIndex[iGamConv]=iTracks;
+           if (labelMC== feNegConvGamGeantIndex[iGamConv]){
+             feNegConvGamSingleRecIndex[iGamConv]=iTracks;
            }
          }
        } // loop over geant converted gammas
@@ -1394,42 +1468,42 @@ void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
 
     if(TMath::Abs(curParticle->GetPdgCode()) == 211 || TMath::Abs(curParticle->GetPdgCode())==2212 ){ // pi+/pi-
       
-      if( stack->Particle(curParticle->GetMother(0))->GetPdgCode()==310 || 
-         stack->Particle(curParticle->GetMother(0))->GetPdgCode()==3122 || 
-         stack->Particle(curParticle->GetMother(0))->GetPdgCode()==-3122 ){  // pi+/proton/pi- from K0/Lambda
+      if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==310 || 
+         fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==3122 || 
+         fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==-3122 ){  // pi+/proton/pi- from K0/Lambda
 
-       for(Int_t iK0Dec=0;iK0Dec<nDecayK0Geant+1;iK0Dec++ ){
+       for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
          if(curTrack->GetSign()>0){
-           if (labelMC== piPosDecayK0GeantIndex[iK0Dec]){
-             piPosDecayK0SingleRecIndex[iK0Dec]=iTracks;
+           if (labelMC== fpiPosDecayK0GeantIndex[iK0Dec]){
+             fpiPosDecayK0SingleRecIndex[iK0Dec]=iTracks;
            }
          }else{
-           if (labelMC== piNegDecayK0GeantIndex[iK0Dec]){
-             piNegDecayK0SingleRecIndex[iK0Dec]=iTracks;
+           if (labelMC== fpiNegDecayK0GeantIndex[iK0Dec]){
+             fpiNegDecayK0SingleRecIndex[iK0Dec]=iTracks;
            }
          }
        } // loop over geant decay K0
 
-       for(Int_t iLDec=0;iLDec<nDecayLGeant+1;iLDec++ ){
+       for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
          if(curTrack->GetSign()>0){
-           if (labelMC== pPosDecayLGeantIndex[iLDec]){
-             pPosDecayLSingleRecIndex[iLDec]=iTracks;
+           if (labelMC== fpPosDecayLGeantIndex[iLDec]){
+             fpPosDecayLSingleRecIndex[iLDec]=iTracks;
            }
          }else{
-           if (labelMC== piNegDecayLGeantIndex[iLDec]){
-             piNegDecayLSingleRecIndex[iLDec]=iTracks;
+           if (labelMC== fpiNegDecayLGeantIndex[iLDec]){
+             fpiNegDecayLSingleRecIndex[iLDec]=iTracks;
            }
          }
        } // loop over geant decay Lambda
 
-       for(Int_t iALDec=0;iALDec<nDecayALGeant+1;iALDec++ ){
+       for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
          if(curTrack->GetSign()<0){
-           if (labelMC== apNegDecayALGeantIndex[iALDec]){
-             apNegDecayALSingleRecIndex[iALDec]=iTracks;
+           if (labelMC== fapNegDecayALGeantIndex[iALDec]){
+             fapNegDecayALSingleRecIndex[iALDec]=iTracks;
            }
          }else{
-           if (labelMC== piPosDecayALGeantIndex[iALDec]){
-             piPosDecayALSingleRecIndex[iALDec]=iTracks;
+           if (labelMC== fpiPosDecayALGeantIndex[iALDec]){
+             fpiPosDecayALSingleRecIndex[iALDec]=iTracks;
            }
          }
        } // loop over geant decay antiLambda
@@ -1441,6 +1515,7 @@ void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
 }
 
 void AliAnalysisTaskV0QA::InspectListOfV0s(){
+  // Look at the list of particles for the V0 reconstruction
 
   AliESDtrack* trackPos= NULL;
   AliESDtrack* trackNeg= NULL;
@@ -1459,7 +1534,7 @@ void AliAnalysisTaskV0QA::InspectListOfV0s(){
     if ( !fV0MIs->GetOnFlyStatus() ){
        continue;
     }
-    if(nTracksPrim<=0) {
+    if(fnTracksPrim<=0) {
       continue;
     }
 
@@ -1498,76 +1573,76 @@ void AliAnalysisTaskV0QA::InspectListOfV0s(){
     }
 
     Int_t labelNeg=TMath::Abs(trackNeg->GetLabel());
-    if(labelNeg > stack->GetNtrack() ) continue;
-    TParticle * particleNeg= stack->Particle(labelNeg);
+    if(labelNeg > fStack->GetNtrack() ) continue;
+    TParticle * particleNeg= fStack->Particle(labelNeg);
 
     Int_t labelPos=TMath::Abs(trackPos->GetLabel());
-    if(labelPos > stack->GetNtrack() ) continue;
-    TParticle * particlePos= stack->Particle(labelPos);
+    if(labelPos > fStack->GetNtrack() ) continue;
+    TParticle * particlePos= fStack->Particle(labelPos);
 
 
     if(particlePos->GetMother(0)>-1){
-      grandMotherPos=stack->Particle(particlePos->GetMother(0))->GetMother(0);
+      grandMotherPos=fStack->Particle(particlePos->GetMother(0))->GetMother(0);
       motherPos=particlePos->GetMother(0);
     }
     
     if(particleNeg->GetMother(0)>-1){
-      grandMotherNeg=stack->Particle(particleNeg->GetMother(0))->GetMother(0);
+      grandMotherNeg=fStack->Particle(particleNeg->GetMother(0))->GetMother(0);
       motherNeg=particleNeg->GetMother(0);
     }
 
     if(motherPos == motherNeg &&  motherPos!=-1 ){
       if( particlePos->GetPdgCode() ==-11  &&   particleNeg->GetPdgCode()==11 ){
-       for(Int_t iGamConv=0;iGamConv<nConvGamGeant+1;iGamConv++ ){
-         if (labelPos== ePosConvGamGeantIndex[iGamConv]){
-           ePosConvGamV0RecIndex[iGamConv]=pIndex;
-           ConvGamV0RecIndexPos[iGamConv]=iV0MI;
+       for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
+         if (labelPos== fePosConvGamGeantIndex[iGamConv]){
+           fePosConvGamV0RecIndex[iGamConv]=pIndex;
+           fConvGamV0RecIndexPos[iGamConv]=iV0MI;
          }
-         if (labelNeg== eNegConvGamGeantIndex[iGamConv]){
-           eNegConvGamV0RecIndex[iGamConv]=nIndex;
-           ConvGamV0RecIndexNeg[iGamConv]=iV0MI;
+         if (labelNeg== feNegConvGamGeantIndex[iGamConv]){
+           feNegConvGamV0RecIndex[iGamConv]=nIndex;
+           fConvGamV0RecIndexNeg[iGamConv]=iV0MI;
          }
 
        } // loop over geant converted gammas
       }
 
       if( particlePos->GetPdgCode()==211  &&   particleNeg->GetPdgCode()==-211 ){
-       for(Int_t iK0Dec=0;iK0Dec<nDecayK0Geant+1;iK0Dec++ ){
-         if (labelPos== piPosDecayK0GeantIndex[iK0Dec]){
-           piPosDecayK0V0RecIndex[iK0Dec]=pIndex;
-           DecayK0V0RecIndexPos[iK0Dec]=iV0MI;
+       for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
+         if (labelPos== fpiPosDecayK0GeantIndex[iK0Dec]){
+           fpiPosDecayK0V0RecIndex[iK0Dec]=pIndex;
+           fDecayK0V0RecIndexPos[iK0Dec]=iV0MI;
          }
-         if (labelNeg== piNegDecayK0GeantIndex[iK0Dec]){
-           piNegDecayK0V0RecIndex[iK0Dec]=nIndex;
-           DecayK0V0RecIndexNeg[iK0Dec]=iV0MI;
+         if (labelNeg== fpiNegDecayK0GeantIndex[iK0Dec]){
+           fpiNegDecayK0V0RecIndex[iK0Dec]=nIndex;
+           fDecayK0V0RecIndexNeg[iK0Dec]=iV0MI;
          }
 
        } // loop over geant K0
       }
 
       if( particlePos->GetPdgCode()==2212  && particleNeg->GetPdgCode()==-211 ){
-       for(Int_t iLDec=0;iLDec<nDecayLGeant+1;iLDec++ ){
-         if (labelPos== pPosDecayLGeantIndex[iLDec]){
-           pPosDecayLV0RecIndex[iLDec]=pIndex;
-           DecayLV0RecIndexPos[iLDec]=iV0MI;
+       for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
+         if (labelPos== fpPosDecayLGeantIndex[iLDec]){
+           fpPosDecayLV0RecIndex[iLDec]=pIndex;
+           fDecayLV0RecIndexPos[iLDec]=iV0MI;
          }
-         if (labelNeg== piNegDecayLGeantIndex[iLDec]){
-           piNegDecayLV0RecIndex[iLDec]=nIndex;
-           DecayLV0RecIndexNeg[iLDec]=iV0MI;
+         if (labelNeg== fpiNegDecayLGeantIndex[iLDec]){
+           fpiNegDecayLV0RecIndex[iLDec]=nIndex;
+           fDecayLV0RecIndexNeg[iLDec]=iV0MI;
          }
 
        } // loop over geant Lambda
       }
 
       if( particleNeg->GetPdgCode()==-2212  && particlePos->GetPdgCode()==211 ){
-       for(Int_t iALDec=0;iALDec<nDecayALGeant+1;iALDec++ ){
-         if (labelNeg== apNegDecayALGeantIndex[iALDec]){
-           apNegDecayALV0RecIndex[iALDec]=nIndex;
-           DecayALV0RecIndexNeg[iALDec]=iV0MI;
+       for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
+         if (labelNeg== fapNegDecayALGeantIndex[iALDec]){
+           fapNegDecayALV0RecIndex[iALDec]=nIndex;
+           fDecayALV0RecIndexNeg[iALDec]=iV0MI;
          }
-         if (labelPos== piPosDecayALGeantIndex[iALDec]){
-           piPosDecayALV0RecIndex[iALDec]=pIndex;
-           DecayALV0RecIndexPos[iALDec]=iV0MI;
+         if (labelPos== fpiPosDecayALGeantIndex[iALDec]){
+           fpiPosDecayALV0RecIndex[iALDec]=pIndex;
+           fDecayALV0RecIndexPos[iALDec]=iV0MI;
          }
 
        } // loop over geant antiLambda
@@ -1577,40 +1652,40 @@ void AliAnalysisTaskV0QA::InspectListOfV0s(){
     }
     
   }
-  for(Int_t iGamConv=0;iGamConv<nConvGamGeant+1;iGamConv++ ){
-    if ( ConvGamV0RecIndexNeg[iGamConv]!=  ConvGamV0RecIndexPos[iGamConv]){
-      ePosConvGamV0RecIndex[iGamConv]=-1;
-      eNegConvGamV0RecIndex[iGamConv]=-1; 
-      ConvGamV0RecIndexNeg[iGamConv]=-1;
-      ConvGamV0RecIndexPos[iGamConv]=-1;
+  for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
+    if ( fConvGamV0RecIndexNeg[iGamConv]!=  fConvGamV0RecIndexPos[iGamConv]){
+      fePosConvGamV0RecIndex[iGamConv]=-1;
+      feNegConvGamV0RecIndex[iGamConv]=-1; 
+      fConvGamV0RecIndexNeg[iGamConv]=-1;
+      fConvGamV0RecIndexPos[iGamConv]=-1;
 
     }
   }
 
-  for(Int_t iLDec=0;iLDec<nDecayLGeant+1;iLDec++ ){
-    if(DecayLV0RecIndexPos[iLDec] !=  DecayLV0RecIndexNeg[iLDec]){
-      piNegDecayLV0RecIndex[iLDec]=-1;
-      pPosDecayLV0RecIndex[iLDec]=-1;
-      DecayLV0RecIndexNeg[iLDec]=-1;
-      DecayLV0RecIndexPos[iLDec]=-1;
+  for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
+    if(fDecayLV0RecIndexPos[iLDec] !=  fDecayLV0RecIndexNeg[iLDec]){
+      fpiNegDecayLV0RecIndex[iLDec]=-1;
+      fpPosDecayLV0RecIndex[iLDec]=-1;
+      fDecayLV0RecIndexNeg[iLDec]=-1;
+      fDecayLV0RecIndexPos[iLDec]=-1;
     }
   }
 
-  for(Int_t iALDec=0;iALDec<nDecayALGeant+1;iALDec++ ){
-    if(DecayALV0RecIndexPos[iALDec] !=  DecayALV0RecIndexNeg[iALDec]){
-      piPosDecayALV0RecIndex[iALDec]=-1;
-      apNegDecayALV0RecIndex[iALDec]=-1;
-      DecayALV0RecIndexNeg[iALDec]=-1;
-      DecayALV0RecIndexPos[iALDec]=-1;
+  for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
+    if(fDecayALV0RecIndexPos[iALDec] !=  fDecayALV0RecIndexNeg[iALDec]){
+      fpiPosDecayALV0RecIndex[iALDec]=-1;
+      fapNegDecayALV0RecIndex[iALDec]=-1;
+      fDecayALV0RecIndexNeg[iALDec]=-1;
+      fDecayALV0RecIndexPos[iALDec]=-1;
     }
   }
 
-  for(Int_t iK0Dec=0;iK0Dec<nDecayK0Geant+1;iK0Dec++ ){
-    if(DecayK0V0RecIndexPos[iK0Dec] !=  DecayK0V0RecIndexNeg[iK0Dec]){
-      piNegDecayK0V0RecIndex[iK0Dec]=-1;
-      piPosDecayK0V0RecIndex[iK0Dec]=-1;
-      DecayK0V0RecIndexNeg[iK0Dec]=-1;
-      DecayK0V0RecIndexPos[iK0Dec]=-1;
+  for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
+    if(fDecayK0V0RecIndexPos[iK0Dec] !=  fDecayK0V0RecIndexNeg[iK0Dec]){
+      fpiNegDecayK0V0RecIndex[iK0Dec]=-1;
+      fpiPosDecayK0V0RecIndex[iK0Dec]=-1;
+      fDecayK0V0RecIndexNeg[iK0Dec]=-1;
+      fDecayK0V0RecIndexPos[iK0Dec]=-1;
     }
   }
   
@@ -1618,6 +1693,8 @@ void AliAnalysisTaskV0QA::InspectListOfV0s(){
 }
 void AliAnalysisTaskV0QA::FillHnSparseGamma()
 {
+  // Fill THnSparse Gamma
+
   Double_t massE=0.00051099892;
   Double_t ppSgl[3];
   Double_t pmSgl[3];
@@ -1653,12 +1730,12 @@ void AliAnalysisTaskV0QA::FillHnSparseGamma()
   Int_t statusV0Neg=-1;
 
 
-  for(Int_t i=0;i<nConvGamGeant+1;i++){
-    TParticle* gamPart = stack->Particle(gConvGamGeantIndex[i]);
-    TParticle* ePosPart = stack->Particle(ePosConvGamGeantIndex[i]);
-    TParticle* eNegPart = stack->Particle(eNegConvGamGeantIndex[i]);
-    if (ePosConvGamSingleRecIndex[i]!=-1){
-      AliESDtrack * ePosSglTrack = fESD->GetTrack(ePosConvGamSingleRecIndex[i]);
+  for(Int_t i=0;i<fnConvGamGeant+1;i++){
+    TParticle* gamPart = fStack->Particle(fgConvGamGeantIndex[i]);
+    TParticle* ePosPart = fStack->Particle(fePosConvGamGeantIndex[i]);
+    TParticle* eNegPart = fStack->Particle(feNegConvGamGeantIndex[i]);
+    if (fePosConvGamSingleRecIndex[i]!=-1){
+      AliESDtrack * ePosSglTrack = fESD->GetTrack(fePosConvGamSingleRecIndex[i]);
       ePosSglTrack->GetPxPyPz(ppSgl); 
       posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massE);
       posPt  = posSglTrack.Pt();
@@ -1681,8 +1758,8 @@ void AliAnalysisTaskV0QA::FillHnSparseGamma()
       statusSingPos=-1;
     }
     
-    if (eNegConvGamSingleRecIndex[i]!=-1){
-      AliESDtrack * eNegSglTrack = fESD->GetTrack(eNegConvGamSingleRecIndex[i]);
+    if (feNegConvGamSingleRecIndex[i]!=-1){
+      AliESDtrack * eNegSglTrack = fESD->GetTrack(feNegConvGamSingleRecIndex[i]);
       eNegSglTrack->GetPxPyPz(pmSgl); 
       negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massE);
       negPt  = negSglTrack.Pt();
@@ -1712,12 +1789,12 @@ void AliAnalysisTaskV0QA::FillHnSparseGamma()
     negV0Eta = -2.;
     negV0Phi = -2*TMath::Pi();
     
-    if(ConvGamV0RecIndexPos[i]!=-1){
-      AliESDv0 * fV0MIs = fESD->GetV0(ConvGamV0RecIndexPos[i]);
+    if(fConvGamV0RecIndexPos[i]!=-1){
+      AliESDv0 * fV0MIs = fESD->GetV0(fConvGamV0RecIndexPos[i]);
       AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
       AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
 
-      if (ePosConvGamV0RecIndex[i]!=-1 ){
+      if (fePosConvGamV0RecIndex[i]!=-1 ){
        //      AliESDtrack * ePosV0Track = fESD->GetTrack(ePosConvGamV0RecIndex[i]);
        if ( trackPosTest->GetSign()==1 ) {
          fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
@@ -1737,7 +1814,7 @@ void AliAnalysisTaskV0QA::FillHnSparseGamma()
        statusV0Pos=-1;
       }
       
-      if (eNegConvGamV0RecIndex[i]!=-1 ){
+      if (feNegConvGamV0RecIndex[i]!=-1 ){
        //      AliESDtrack * eNegV0Track = fESD->GetTrack(eNegConvGamV0RecIndex[i]);
        if ( trackNegTest->GetSign()==-1 ) {
          fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
@@ -1784,7 +1861,7 @@ void AliAnalysisTaskV0QA::FillHnSparseGamma()
       tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
     }
      fValueV0[7] = tmpPPhi;
-     fValueV0[8] = ePosConvGamGeantLength[i];
+     fValueV0[8] = fePosConvGamGeantLength[i];
 
     fValueV0[9] = 1./TMath::Sqrt(eNegPart->Pt());
     fValueV0[10] = eNegPart->Eta();
@@ -1794,7 +1871,7 @@ void AliAnalysisTaskV0QA::FillHnSparseGamma()
       tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
     }
     fValueV0[11] = tmpNPhi;
-    fValueV0[12] = eNegConvGamGeantLength[i];    
+    fValueV0[12] = feNegConvGamGeantLength[i];    
 
     //---- Single track variables----------------------
 
@@ -1839,6 +1916,7 @@ void AliAnalysisTaskV0QA::FillHnSparseGamma()
 
 void AliAnalysisTaskV0QA::FillHnSparseK0()
 {
+  // Fill THnSparse K0
 
   Double_t massPi=0.13957018;
   Double_t ppSgl[3];
@@ -1874,12 +1952,12 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
   Int_t statusV0Pos=-1;
   Int_t statusV0Neg=-1;
   
-  for(Int_t i=0;i<nDecayK0Geant+1;i++){
-    TParticle* K0Part = stack->Particle(K0DecayK0GeantIndex[i]);
-    TParticle* ePosPart = stack->Particle(piPosDecayK0GeantIndex[i]);
-    TParticle* eNegPart = stack->Particle(piNegDecayK0GeantIndex[i]);
-    if (piPosDecayK0SingleRecIndex[i]!=-1){
-      AliESDtrack * ePosSglTrack = fESD->GetTrack(piPosDecayK0SingleRecIndex[i]);
+  for(Int_t i=0;i<fnDecayK0Geant+1;i++){
+    TParticle* k0Part = fStack->Particle(fK0DecayK0GeantIndex[i]);
+    TParticle* ePosPart = fStack->Particle(fpiPosDecayK0GeantIndex[i]);
+    TParticle* eNegPart = fStack->Particle(fpiNegDecayK0GeantIndex[i]);
+    if (fpiPosDecayK0SingleRecIndex[i]!=-1){
+      AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayK0SingleRecIndex[i]);
       ePosSglTrack->GetPxPyPz(ppSgl); 
       posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
       posPt  = posSglTrack.Pt();
@@ -1903,8 +1981,8 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
       statusSingPos=-1;
     }
 
-    if (piNegDecayK0SingleRecIndex[i]!=-1){
-      AliESDtrack * eNegSglTrack = fESD->GetTrack(piNegDecayK0SingleRecIndex[i]);
+    if (fpiNegDecayK0SingleRecIndex[i]!=-1){
+      AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayK0SingleRecIndex[i]);
       eNegSglTrack->GetPxPyPz(pmSgl); 
       negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
       negPt  = negSglTrack.Pt();
@@ -1934,12 +2012,12 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
     negV0Eta = -2.;
     negV0Phi = -2*TMath::Pi();
 
-    if(DecayK0V0RecIndexPos[i]!=-1){
-      AliESDv0 * fV0MIs = fESD->GetV0(DecayK0V0RecIndexPos[i]);
+    if(fDecayK0V0RecIndexPos[i]!=-1){
+      AliESDv0 * fV0MIs = fESD->GetV0(fDecayK0V0RecIndexPos[i]);
       AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
       AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
 
-      if (piPosDecayK0V0RecIndex[i]!=-1 ){
+      if (fpiPosDecayK0V0RecIndex[i]!=-1 ){
        //      AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayK0V0RecIndex[i]);
        if ( trackPosTest->GetSign()==1 ) {
          fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
@@ -1959,7 +2037,7 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
        statusV0Pos=-1;
       }
       
-      if (piNegDecayK0V0RecIndex[i]!=-1 ){
+      if (fpiNegDecayK0V0RecIndex[i]!=-1 ){
        //      AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayK0V0RecIndex[i]);
        if ( trackNegTest->GetSign()==-1 ) {
          fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
@@ -1986,12 +2064,12 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
     
     
     //--------- Geant variables ----------------------
-    fValueK0[0] = 1./TMath::Sqrt(K0Part->Pt());
-    fValueK0[1] = K0Part->Eta();
+    fValueK0[0] = 1./TMath::Sqrt(k0Part->Pt());
+    fValueK0[1] = k0Part->Eta();
 
-    Double_t tmpGPhi=K0Part->Phi();
-    if( K0Part->Phi()>TMath::Pi()){
-      tmpGPhi=K0Part->Phi()-2*TMath::Pi();
+    Double_t tmpGPhi=k0Part->Phi();
+    if( k0Part->Phi()>TMath::Pi()){
+      tmpGPhi=k0Part->Phi()-2*TMath::Pi();
     }
     fValueK0[2] = tmpGPhi;
 
@@ -2007,7 +2085,7 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
       tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
     }
      fValueK0[7] = tmpPPhi;
-     fValueK0[8] = piPosDecayK0GeantLength[i];
+     fValueK0[8] = fpiPosDecayK0GeantLength[i];
 
     fValueK0[9] = 1./TMath::Sqrt(eNegPart->Pt());
     fValueK0[10] = eNegPart->Eta();
@@ -2017,7 +2095,7 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
       tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
     }
     fValueK0[11] = tmpNPhi;
-    fValueK0[12] = piNegDecayK0GeantLength[i];    
+    fValueK0[12] = fpiNegDecayK0GeantLength[i];    
     //---- Single track variables----------------------
 
     fValueK0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt() ;
@@ -2059,6 +2137,7 @@ void AliAnalysisTaskV0QA::FillHnSparseK0()
 }
 void AliAnalysisTaskV0QA::FillHnSparseL()
 {
+  // Fill THnSparse Lambda
 
   Double_t massPi=0.13957018;
   Double_t massP=0.93827203;
@@ -2097,12 +2176,12 @@ void AliAnalysisTaskV0QA::FillHnSparseL()
   Int_t statusV0Pos=-1;
   Int_t statusV0Neg=-1;
 
-  for(Int_t i=0;i<nDecayLGeant+1;i++){
-    TParticle* lPart = stack->Particle(lDecayLGeantIndex[i]);
-    TParticle* ePosPart = stack->Particle(pPosDecayLGeantIndex[i]);
-    TParticle* eNegPart = stack->Particle(piNegDecayLGeantIndex[i]);
-    if (pPosDecayLSingleRecIndex[i]!=-1){
-      AliESDtrack * ePosSglTrack = fESD->GetTrack(pPosDecayLSingleRecIndex[i]);
+  for(Int_t i=0;i<fnDecayLGeant+1;i++){
+    TParticle* lPart = fStack->Particle(flDecayLGeantIndex[i]);
+    TParticle* ePosPart = fStack->Particle(fpPosDecayLGeantIndex[i]);
+    TParticle* eNegPart = fStack->Particle(fpiNegDecayLGeantIndex[i]);
+    if (fpPosDecayLSingleRecIndex[i]!=-1){
+      AliESDtrack * ePosSglTrack = fESD->GetTrack(fpPosDecayLSingleRecIndex[i]);
       ePosSglTrack->GetPxPyPz(ppSgl); 
       posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massP);
       posPt  = posSglTrack.Pt();
@@ -2125,8 +2204,8 @@ void AliAnalysisTaskV0QA::FillHnSparseL()
       statusSingPos=-1;
     }
     
-    if (piNegDecayLSingleRecIndex[i]!=-1){
-      AliESDtrack * eNegSglTrack = fESD->GetTrack(piNegDecayLSingleRecIndex[i]);
+    if (fpiNegDecayLSingleRecIndex[i]!=-1){
+      AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayLSingleRecIndex[i]);
       eNegSglTrack->GetPxPyPz(pmSgl); 
       negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
       negPt  = negSglTrack.Pt();
@@ -2156,12 +2235,12 @@ void AliAnalysisTaskV0QA::FillHnSparseL()
     negV0Eta = -2.;
     negV0Phi = -2*TMath::Pi();
     
-    if(DecayLV0RecIndexPos[i]!=-1){
-      AliESDv0 * fV0MIs = fESD->GetV0(DecayLV0RecIndexPos[i]);
+    if(fDecayLV0RecIndexPos[i]!=-1){
+      AliESDv0 * fV0MIs = fESD->GetV0(fDecayLV0RecIndexPos[i]);
       AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
       AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
 
-      if (pPosDecayLV0RecIndex[i]!=-1 ){
+      if (fpPosDecayLV0RecIndex[i]!=-1 ){
        //      AliESDtrack * ePosV0Track = fESD->GetTrack(pPosDecayLV0RecIndex[i]);
        if ( trackPosTest->GetSign()==1 ) {
          fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
@@ -2181,7 +2260,7 @@ void AliAnalysisTaskV0QA::FillHnSparseL()
        statusV0Pos=-1;
       }
       
-      if (piNegDecayLV0RecIndex[i]!=-1 ){
+      if (fpiNegDecayLV0RecIndex[i]!=-1 ){
        //      AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayLV0RecIndex[i]);
        if ( trackNegTest->GetSign()==-1 ) {
          fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
@@ -2228,7 +2307,7 @@ void AliAnalysisTaskV0QA::FillHnSparseL()
       tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
     }
      fValueL[7] = tmpPPhi;
-     fValueL[8] = pPosDecayLGeantLength[i];
+     fValueL[8] = fpPosDecayLGeantLength[i];
 
     fValueL[9] = 1./TMath::Sqrt(eNegPart->Pt());
     fValueL[10] = eNegPart->Eta();
@@ -2238,7 +2317,7 @@ void AliAnalysisTaskV0QA::FillHnSparseL()
       tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
     }
     fValueL[11] = tmpNPhi;
-    fValueL[12] = piNegDecayLGeantLength[i];    
+    fValueL[12] = fpiNegDecayLGeantLength[i];    
     //---- Single track variables----------------------
 
     fValueL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
@@ -2282,6 +2361,7 @@ void AliAnalysisTaskV0QA::FillHnSparseL()
 
 void AliAnalysisTaskV0QA::FillHnSparseAL()
 {
+  // Fill THnSparse Antilambda
 
   Double_t massPi=0.13957018;
   Double_t massP=0.93827203;
@@ -2321,12 +2401,12 @@ void AliAnalysisTaskV0QA::FillHnSparseAL()
   Int_t statusV0Neg=-1;
 
 
-  for(Int_t i=0;i<nDecayALGeant+1;i++){
-    TParticle* alPart = stack->Particle(alDecayALGeantIndex[i]);
-    TParticle* eNegPart = stack->Particle(apNegDecayALGeantIndex[i]);
-    TParticle* ePosPart = stack->Particle(piPosDecayALGeantIndex[i]);
-    if (piPosDecayALSingleRecIndex[i]!=-1){
-      AliESDtrack * ePosSglTrack = fESD->GetTrack(piPosDecayALSingleRecIndex[i]);
+  for(Int_t i=0;i<fnDecayALGeant+1;i++){
+    TParticle* alPart = fStack->Particle(falDecayALGeantIndex[i]);
+    TParticle* eNegPart = fStack->Particle(fapNegDecayALGeantIndex[i]);
+    TParticle* ePosPart = fStack->Particle(fpiPosDecayALGeantIndex[i]);
+    if (fpiPosDecayALSingleRecIndex[i]!=-1){
+      AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayALSingleRecIndex[i]);
       ePosSglTrack->GetPxPyPz(ppSgl); 
       posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
       posPt  = posSglTrack.Pt();
@@ -2349,8 +2429,8 @@ void AliAnalysisTaskV0QA::FillHnSparseAL()
       statusSingPos=-1;
     }
     
-    if (apNegDecayALSingleRecIndex[i]!=-1){
-      AliESDtrack * eNegSglTrack = fESD->GetTrack(apNegDecayALSingleRecIndex[i]);
+    if (fapNegDecayALSingleRecIndex[i]!=-1){
+      AliESDtrack * eNegSglTrack = fESD->GetTrack(fapNegDecayALSingleRecIndex[i]);
       eNegSglTrack->GetPxPyPz(pmSgl); 
       negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massP);
       negPt  = negSglTrack.Pt();
@@ -2380,12 +2460,12 @@ void AliAnalysisTaskV0QA::FillHnSparseAL()
     negV0Eta = -2.;
     negV0Phi = -2*TMath::Pi();
     
-    if(DecayALV0RecIndexPos[i]!=-1){
-      AliESDv0 * fV0MIs = fESD->GetV0(DecayALV0RecIndexPos[i]);
+    if(fDecayALV0RecIndexPos[i]!=-1){
+      AliESDv0 * fV0MIs = fESD->GetV0(fDecayALV0RecIndexPos[i]);
       AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
       AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
 
-      if (piPosDecayALV0RecIndex[i]!=-1 ){
+      if (fpiPosDecayALV0RecIndex[i]!=-1 ){
        //      AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayALV0RecIndex[i]);
        if ( trackPosTest->GetSign()==1 ) {
          fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
@@ -2405,7 +2485,7 @@ void AliAnalysisTaskV0QA::FillHnSparseAL()
        statusV0Pos=-1;
       }
       
-      if (apNegDecayALV0RecIndex[i]!=-1 ){
+      if (fapNegDecayALV0RecIndex[i]!=-1 ){
        //      AliESDtrack * eNegV0Track = fESD->GetTrack(apNegDecayALV0RecIndex[i]);
        if ( trackNegTest->GetSign()==-1 ) {
          fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
@@ -2452,7 +2532,7 @@ void AliAnalysisTaskV0QA::FillHnSparseAL()
       tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
     }
      fValueAL[7] = tmpPPhi;
-     fValueAL[8] = piPosDecayALGeantLength[i];
+     fValueAL[8] = fpiPosDecayALGeantLength[i];
 
     fValueAL[9] = 1./TMath::Sqrt(eNegPart->Pt());
     fValueAL[10] = eNegPart->Eta();
@@ -2462,7 +2542,7 @@ void AliAnalysisTaskV0QA::FillHnSparseAL()
       tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
     }
     fValueAL[11] = tmpNPhi;
-    fValueAL[12] = apNegDecayALGeantLength[i];    
+    fValueAL[12] = fapNegDecayALGeantLength[i];    
     //---- Single track variables----------------------
 
     fValueAL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();