]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/GammaConv/AliV0Reader.h
Added new background scheeme, did some cleanup. added new bethe block parameters...
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliV0Reader.h
index e9185a80ae57741e3624b4a3ee43325d19ded8dd..c937e14dd2a5229eb662b1b631fda27c822d0e80 100644 (file)
-#ifndef ALIV0READER_H\r
-#define ALIV0READER_H\r
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice     */\r
-\r
-////////////////////////////////////////////////\r
-//--------------------------------------------- \r
-// Class used to do analysis on conversion pairs\r
-//---------------------------------------------\r
-////////////////////////////////////////////////\r
-\r
-// --- ROOT system ---\r
-#include "TObject.h" \r
-#include "AliESDv0.h"\r
-#include "AliESDEvent.h"\r
-#include "AliKFParticle.h"\r
-#include "TParticle.h"\r
-#include "AliGammaConversionHistograms.h"\r
-#include <vector>\r
-\r
-class TClonesArray; \r
-class TFormula;\r
-class Riostream;\r
-class TChain;\r
-//--- AliRoot system ---\r
-\r
-class AliStack;\r
-class AliESDEvent; \r
-class AliMCEventHandler;\r
-class AliESDInputHandler;\r
-class AliESDVertex;\r
-class AliLog;\r
-class TChain;\r
-class TChain;\r
-\r
-\r
-\r
-class AliV0Reader : public TObject {\r
-\r
- public: \r
-\r
-  AliV0Reader();                                        //constructor\r
-  AliV0Reader(const AliV0Reader & g);                   //copy constructor\r
-  AliV0Reader & operator = (const AliV0Reader & g);     //assignment operator\r
-  virtual ~AliV0Reader() {;}                            //virtual destructor\r
-  /*\r
-   *Initialize the reader\r
-   */\r
-  void Initialize();\r
-\r
-  /*\r
-   * Returns  AliESDEvent\r
-   */                  \r
-   AliESDEvent* GetESDEvent() const{return fESDEvent;} \r
-\r
-  /*\r
-   *Returns the number of v0s in the event, no cuts applied.\r
-   */\r
-  Int_t GetNumberOfV0s() const{return fESDEvent->GetNumberOfV0s();}\r
-\r
-  /*\r
-   * Check if there are any more good v0s left in the v0 stack\r
-   * if so, fCurrent v0 is set to this v0 and can be retrieved\r
-   * by GetCurrentV0 function.\r
-   * returns kFALSE if there is no more good v0s in the v0 stack\r
-   */\r
-  Bool_t NextV0();\r
-  \r
-  /*\r
-   * Returns the v0 at the given index, no checks are done on the v0. \r
-   */\r
-  AliESDv0* GetV0(Int_t index);\r
-\r
-  /*\r
-   * Returns the current v0\r
-   */\r
-  AliESDv0* GetCurrentV0() const{return fCurrentV0;}\r
-\r
-  /*\r
-   * Returns the negative ESD track which belongs to fCurrentV0\r
-   */\r
-  AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());}\r
-\r
-  /*\r
-   * Returns the positive ESD track which belongs to fCurrentV0\r
-   */\r
-  AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());}\r
-\r
-  /*\r
-   * Returns the negative KF particle which belongs to fCurrentV0\r
-   */\r
-  AliKFParticle* GetNegativeKFParticle() const{return fCurrentNegativeKFParticle;}\r
-\r
-  /*\r
-   * Returns the positive KF particle which belongs to fCurrentV0\r
-   */\r
-  AliKFParticle* GetPositiveKFParticle() const{return fCurrentPositiveKFParticle;}\r
-\r
-  /*\r
-   * Returns the KFParticle object of the 2 tracks.\r
-   */\r
-  AliKFParticle* GetMotherCandidateKFCombination() const{return fCurrentMotherKFCandidate;}\r
-\r
-  /*\r
-   * Checks the probablity that the PID of the particle is what we want it to be.\r
-   */\r
-  Bool_t CheckPIDProbability(Double_t negProbCut, Double_t posProbCut);\r
-  \r
-  /*\r
-   * Checks if the PID of the two particles are within our cuts.\r
-   */\r
-  void GetPIDProbability(Double_t &negPIDProb, Double_t &posPIDProb);\r
-\r
-  /*\r
-   *Get the negative MC TParticle from the stack \r
-   */\r
-  TParticle * GetNegativeMCParticle() const{return fNegativeMCParticle;}\r
-\r
-  /*\r
-   *Get the positive MC TParticle from the stack \r
-   */\r
-  TParticle * GetPositiveMCParticle() const{return fPositiveMCParticle;}\r
-\r
-  /*\r
-   *Get the mother MC TParticle from the stack \r
-   */\r
-  TParticle * GetMotherMCParticle() const{return fMotherMCParticle;}\r
-\r
-  /*\r
-   * Flag to see if the v0 particles share the same mother\r
-   */\r
-  Bool_t HasSameMCMother();\r
-\r
-\r
-  /*\r
-   *Get the PID of the MC mother particle\r
-   */\r
-  Int_t GetMotherMCParticlePDGCode() const{if(fMotherMCParticle != NULL){ cout<<"MCParticle exists"<<endl;} return fMotherMCParticle->GetPdgCode();}\r
-\r
-  /*\r
-   *Get the MC stack \r
-   */\r
-  AliStack* GetMCStack() const{return fMCStack;}\r
-\r
-  /*\r
-   *Get the magnetic field from the ESD event \r
-   */\r
-  Double_t GetMagneticField() const{return fESDEvent->GetMagneticField();}\r
-\r
-  /*\r
-   *Get the primary vertex from the esd event\r
-   */\r
-  const AliESDVertex *GetPrimaryVertex() const {return fESDEvent->GetPrimaryVertex();}\r
-\r
-  /*\r
-   * Set the PID of the negative track\r
-   */\r
-  void SetNegativeTrackPID(Int_t negTrackPID){fNegativeTrackPID=negTrackPID;}\r
-\r
-  /*\r
-   * Set the PID of the positive track\r
-   */\r
-  void SetPositiveTrackPID(Int_t posTrackPID){fPositiveTrackPID=posTrackPID;}\r
-\r
-  /*\r
-   * Set the flag to use the kfparticle class. Will also disable the use of esd tracks\r
-   */\r
-  void UseKFParticle(){fUseKFParticle = kTRUE; fUseESDTrack = kFALSE;}\r
-\r
-  /*\r
-   *  Set the flag to use the esd track class. Will also disable the use of kf particles\r
-   */\r
-  void UseESDTrack(){fUseESDTrack = kTRUE; fUseKFParticle = kFALSE;}\r
-\r
-  /*\r
-   *  Set the flag to use improved vertex or not\r
-   */\r
-  void SetUseImprovedVertex(Bool_t useImprovedVertex){fUseImprovedVertex=useImprovedVertex;}\r
-\r
-  /*\r
-   * Return the number in the species array belonging to the negative or positive track pid.\r
-   */\r
-  Int_t GetSpeciesIndex(Int_t chargeOfTrack);\r
-\r
-  /*\r
-   * Return the x coordinate of the v0\r
-   */\r
-  Double_t GetX() const{return fCurrentXValue;}\r
-\r
-  /*\r
-   * Return the y coordinate of the v0\r
-   */\r
-  Double_t GetY() const{return fCurrentYValue;}\r
-\r
-  /*\r
-   * Return the Z coordinate of the v0\r
-   */\r
-  Double_t GetZ() const{return fCurrentZValue;}\r
-\r
-  /*\r
-   * Return the radius of the v0\r
-   */\r
-  Double_t GetXYRadius() const{return sqrt((Double_t)(fCurrentXValue*fCurrentXValue + fCurrentYValue*fCurrentYValue));}\r
-\r
-  /*\r
-   * Get the opening angle between the two tracks\r
-   */\r
-  Double_t GetOpeningAngle(){return fNegativeTrackLorentzVector->Angle(fPositiveTrackLorentzVector->Vect());}\r
-\r
-  /*\r
-   * Gets the Energy of the negative track.\r
-   */\r
-  Double_t GetNegativeTrackEnergy() const{return fCurrentNegativeKFParticle->E();}\r
-\r
-  /*\r
-   * Gets the Energy of the positive track.\r
-   */\r
-  Double_t GetPositiveTrackEnergy() const{return fCurrentPositiveKFParticle->E();}\r
-\r
-  /*\r
-   * Gets the Energy of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidateEnergy() const{return fCurrentMotherKFCandidate->E();}\r
-\r
-  /*\r
-   * Gets the Pt of the negative track.\r
-   */\r
-  Double_t GetNegativeTrackPt() const{return fNegativeTrackLorentzVector->Pt();}\r
-\r
-  /*\r
-   * Gets the Pt of the positive track.\r
-   */\r
-  Double_t GetPositiveTrackPt() const{return fPositiveTrackLorentzVector->Pt();}\r
-\r
-  /*\r
-   * Gets the Pt of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidatePt() const{return fMotherCandidateLorentzVector->Pt();}\r
-\r
-  /*\r
-   * Gets the Eta of the negative track.\r
-   */\r
-  Double_t GetNegativeTrackEta() const{return fNegativeTrackLorentzVector->Eta();}\r
-  /*\r
-   * Gets the Eta of the positive track.\r
-   */\r
-  Double_t GetPositiveTrackEta() const{return fPositiveTrackLorentzVector->Eta();}\r
-  /*\r
-   * Gets the Eta of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidateEta() const{return fMotherCandidateLorentzVector->Eta();}\r
-\r
-  /*\r
-   * Gets the NDF of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidateNDF() const{return fCurrentMotherKFCandidate->GetNDF();}\r
-\r
-  /*\r
-   * Gets the Chi2 of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidateChi2() const{return fCurrentMotherKFCandidate->GetChi2();}\r
-\r
-  /*\r
-   * Gets the Mass of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidateMass() const{return fMotherCandidateKFMass;}\r
-\r
-  /*\r
-   * Gets the Width of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidateWidth() const{return fMotherCandidateKFWidth;}\r
-\r
-  /*\r
-   * Gets the Phi of the negative track.\r
-   */\r
-  Double_t GetNegativeTrackPhi() const;\r
-\r
-  /*\r
-   * Gets the Phi of the positive track.\r
-   */\r
-  Double_t GetPositiveTrackPhi() const;\r
-\r
-  /*\r
-   * Gets the Phi of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidatePhi() const;\r
-\r
-  /*\r
-   * Gets the Rapidity of the mother candidate.\r
-   */\r
-  Double_t GetMotherCandidateRapidity() const;\r
-\r
-\r
-  /*\r
-   * Update data which need to be updated every event.\r
-   */\r
-  void UpdateEventByEventData();\r
-  \r
-  /*\r
-   * Gets the MaxRCut value.\r
-   */\r
-  Double_t GetMaxRCut() const{return fMaxR;}\r
-\r
-  /*\r
-   * Gets the Eta cut value.\r
-   */\r
-  Double_t GetEtaCut() const{return fEtaCut;}\r
-\r
-  /*\r
-   * Gets the Pt cut value.\r
-   */\r
-  Double_t GetPtCut() const{return fPtCut;}\r
-\r
-  /*\r
-   * Gets the line cut values.\r
-   */\r
-  Double_t GetLineCutZRSlope() const{return fLineCutZRSlope;}\r
-  Double_t GetLineCutZValue() const{return fLineCutZValue;}\r
-  \r
-  /*\r
-   * Gets the Chi2 cut value for the conversions.\r
-   */\r
-  Double_t GetChi2CutConversion() const{return fChi2CutConversion;}\r
-\r
-  /*\r
-   * Gets the Chi2 cut value for the mesons.\r
-   */\r
-  Double_t GetChi2CutMeson() const{return fChi2CutMeson;}\r
-\r
-  Double_t GetPositiveTrackLength() const{return fCurrentPositiveESDTrack->GetIntegratedLength();}\r
-  Double_t GetNegativeTrackLength() const{return fCurrentNegativeESDTrack->GetIntegratedLength();}\r
-\r
-  Double_t GetPositiveNTPCClusters() const{return fCurrentPositiveESDTrack->GetTPCNcls();}\r
-  Double_t GetNegativeNTPCClusters() const{return fCurrentNegativeESDTrack->GetTPCNcls();}\r
-\r
-  /*\r
-   * Sets the MaxRCut value.\r
-   */\r
-  void SetMaxRCut(Double_t maxR){fMaxR=maxR;}\r
-\r
-  /*\r
-   * Sets the EtaCut value.\r
-   */\r
-  void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}\r
-\r
-  /*\r
-   * Sets the PtCut value.\r
-   */\r
-  void SetPtCut(Double_t ptCut){fPtCut=ptCut;}\r
-\r
-  /*\r
-   * Sets the LineCut values.\r
-   */\r
-  void SetLineCutZRSlope(Double_t LineCutZRSlope){fLineCutZRSlope=LineCutZRSlope;}\r
-  void SetLineCutZValue(Double_t LineCutZValue){fLineCutZValue=LineCutZValue;}\r
-\r
-  /*\r
-   * Sets the Chi2Cut value for conversions.\r
-   */\r
-  void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}\r
-\r
-  /*\r
-   * Sets the Chi2Cut for the mesons.\r
-   */\r
-  void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}\r
-  \r
-  /*\r
-   * Sets the XVertexCut value.\r
-   */\r
-  void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;}\r
-\r
-  /*\r
-   * Sets the YVertexCut value.\r
-   */\r
-  void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;}\r
-\r
-  /*\r
-   * Sets the ZVertexCut value.\r
-   */\r
-  void SetZVertexCut(Double_t zVtx){fCurrentZValue=zVtx;}\r
-\r
-  /*\r
-   * Sets the PIDProbabilityCut value for track particles.\r
-   */\r
-  void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;}\r
-\r
-  /*\r
-   * Sets the PIDProbability cut value for the negative track.\r
-   */\r
-  void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}\r
-\r
-  /*\r
-   * Sets the PIDProbability cut value for the positive track.\r
-   */\r
-  void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}\r
-\r
-  /*\r
-   * Sets the SigmaMassCut value.\r
-   */\r
-  void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}\r
-\r
-  /*\r
-   * Sets the flag to enable/disable the usage of MC information. \r
-   */\r
-  void SetDoMCTruth(Bool_t doMC){fDoMC = doMC;}\r
-\r
-  /*\r
-   * Updates the V0 information of the current V0.\r
-   */\r
-  Bool_t UpdateV0Information();\r
-\r
-  /*\r
-   * Resets the V0 index.\r
-   */\r
-  void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}\r
-\r
-  /*\r
-   * Sets the histograms.\r
-   */\r
-  void SetHistograms(AliGammaConversionHistograms *histograms){fHistograms=histograms;}\r
-\r
-  /*\r
-   * Check for primary vertex.\r
-   */\r
-  Bool_t CheckForPrimaryVertex();\r
-\r
-  /*\r
-   * Gets a vector of good v0s.\r
-   */\r
-  vector<AliKFParticle> GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;}\r
-\r
-  /*\r
-   * Gets the vector of previous events v0s (for bacground analysis)\r
-   */\r
-  vector<AliKFParticle> GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;}\r
-\r
- private:\r
-  AliStack * fMCStack;           // pointer to MonteCarlo particle stack \r
-  AliMCEventHandler* fMCTruth;   // pointer to the MC event handler\r
-  TChain * fChain;               // pointer to the TChain\r
-  \r
-  AliESDInputHandler* fESDHandler;      //! pointer to esd object\r
-  AliESDEvent *fESDEvent;               //! pointer to esd object\r
-\r
-  AliGammaConversionHistograms *fHistograms;\r
-  \r
-  Int_t fCurrentV0IndexNumber;\r
-  AliESDv0 * fCurrentV0;                //! pointer to the current v0\r
-  AliKFParticle * fCurrentNegativeKFParticle;  //! pointer to the negative KF particle\r
-  AliKFParticle * fCurrentPositiveKFParticle;  //! pointer to the positive KF particle\r
-  AliKFParticle * fCurrentMotherKFCandidate;   //! pointer to the positive KF particle\r
-\r
-  AliESDtrack * fCurrentNegativeESDTrack;      //! pointer to the negative ESD track\r
-  AliESDtrack * fCurrentPositiveESDTrack;      //! pointer to the positive ESD track\r
\r
-  TLorentzVector * fNegativeTrackLorentzVector; //! pointer to the negative Track Lorentz Vector\r
-  TLorentzVector * fPositiveTrackLorentzVector; //! pointer to the positive Track Lorentz Vector\r
-  TLorentzVector * fMotherCandidateLorentzVector;   //! pointer to the mother candidate Track Lorentz Vector\r
-\r
-  Double_t fCurrentXValue;\r
-  Double_t fCurrentYValue;\r
-  Double_t fCurrentZValue;\r
-\r
-  Int_t fPositiveTrackPID;\r
-  Int_t fNegativeTrackPID;\r
-\r
-  TParticle *fNegativeMCParticle;      //!\r
-  TParticle *fPositiveMCParticle;      //!\r
-  TParticle *fMotherMCParticle;        //!\r
-\r
-  Double_t fMotherCandidateKFMass;\r
-  Double_t fMotherCandidateKFWidth;\r
-\r
-  Bool_t fUseKFParticle;\r
-  Bool_t fUseESDTrack;\r
-  Bool_t fDoMC;\r
-\r
-  //cuts\r
-  Double_t fMaxR;\r
-  Double_t fEtaCut;\r
-  Double_t fPtCut;\r
-  Double_t fLineCutZRSlope;\r
-  Double_t fLineCutZValue;\r
-  Double_t fChi2CutConversion;\r
-  Double_t fChi2CutMeson;\r
-  Double_t fPIDProbabilityCutNegativeParticle;\r
-  Double_t fPIDProbabilityCutPositiveParticle;\r
-  Double_t fXVertexCut;\r
-  Double_t fYVertexCut;\r
-  Double_t fZVertexCut;\r
-  \r
-  Double_t fNSigmaMass;\r
-  \r
-  Bool_t fUseImprovedVertex;\r
-  \r
-  vector<AliKFParticle> fCurrentEventGoodV0s;\r
-  vector<AliKFParticle> fPreviousEventGoodV0s;\r
-\r
-  ClassDef(AliV0Reader,2)\r
-};\r
-\r
-\r
-#endif\r
-\r
-\r
-\r
+#ifndef ALIV0READER_H
+#define ALIV0READER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+
+////////////////////////////////////////////////
+//--------------------------------------------- 
+// Class used to do analysis on conversion pairs
+//---------------------------------------------
+////////////////////////////////////////////////
+
+// --- ROOT system ---
+#include "TObject.h" 
+#include "AliMCEvent.h"   // for CF
+#include "AliESDv0.h"
+#include "AliESDEvent.h"
+#include "AliKFParticle.h"
+#include "TParticle.h"
+#include "AliGammaConversionHistograms.h"
+#include <vector>
+#include "AliCFManager.h"
+#include "AliGammaConversionBGHandler.h"
+
+class TClonesArray; 
+class TFormula;
+class Riostream;
+class TChain;
+
+//--- AliRoot system ---
+
+class AliStack;
+class AliMCEvent;       // for CF
+class AliESDEvent; 
+class AliMCEventHandler;
+class AliESDInputHandler;
+class AliESDVertex;
+class AliLog;
+class TChain;
+class TChain;
+class AliCFManager;   // for CF
+class AliCFContainer;  // for CF
+class AliTPCpidESD; // for dEdx cut based on nSigma to particle lines 
+
+
+class AliV0Reader : public TObject {
+       
+ public: 
+       
+       
+  // for CF
+  enum{
+    kStepGenerated = 0,
+    kStepReconstructable = 1, 
+    kStepLikeSign = 2,
+    kStepTPCRefit = 3,
+    kStepKinks = 4,
+    kStepGetOnFly = 5,
+    kStepNContributors = 6,
+    kStepTPCPID = 7,
+    kStepR = 8,
+    kStepLine = 9,
+    kStepZ = 10,
+    kStepNDF = 11,
+    kStepChi2 = 12,
+    kStepEta = 13,
+    kStepPt = 14
+  };
+       
+       
+       
+  AliV0Reader();                                        //constructor
+  AliV0Reader(const AliV0Reader & g);                   //copy constructor
+  AliV0Reader & operator = (const AliV0Reader & g);     //assignment operator
+  //  virtual ~AliV0Reader() {;}                            //virtual destructor
+  virtual ~AliV0Reader();                            //virtual destructor
+  /*
+   *Initialize the reader
+   */
+  void Initialize();
+       
+       
+  // for CF
+  void SetCFManager(AliCFManager * const io){fCFManager = io;};
+  AliCFManager *GetCFManager() const {return fCFManager;}
+       
+       
+       
+       
+  /*
+   * Returns  AliESDEvent
+   */                  
+  AliESDEvent* GetESDEvent() const{return fESDEvent;}  
+       
+  /*
+   *Returns the number of v0s in the event, no cuts applied.
+   */
+  Int_t GetNumberOfV0s() const{return fESDEvent->GetNumberOfV0s();}
+       
+  /*
+   *Returns the number of contributors to the vertex
+   */
+  Int_t GetNumberOfContributorsVtx() const{return fESDEvent->GetPrimaryVertex()->GetNContributors();}
+  
+  /*
+   * Check if there are any more good v0s left in the v0 stack
+   * if so, fCurrent v0 is set to this v0 and can be retrieved
+   * by GetCurrentV0 function.
+   * returns kFALSE if there is no more good v0s in the v0 stack
+   */
+  Bool_t NextV0();
+       
+  /*
+   * Returns the v0 at the given index, no checks are done on the v0. 
+   */
+  AliESDv0* GetV0(Int_t index);
+       
+  /*
+   * Returns the current v0
+   */
+  AliESDv0* GetCurrentV0() const{return fCurrentV0;}
+       
+  /*
+   * Returns the negative ESD track which belongs to fCurrentV0
+   */
+  AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());}
+       
+  /*
+   * Returns the positive ESD track which belongs to fCurrentV0
+   */
+  AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());}
+       
+  /*
+   * Returns the negative KF particle which belongs to fCurrentV0
+   */
+  AliKFParticle* GetNegativeKFParticle() const{return fCurrentNegativeKFParticle;}
+       
+  /*
+   * Returns the positive KF particle which belongs to fCurrentV0
+   */
+  AliKFParticle* GetPositiveKFParticle() const{return fCurrentPositiveKFParticle;}
+       
+  /*
+   * Returns the KFParticle object of the 2 tracks.
+   */
+  AliKFParticle* GetMotherCandidateKFCombination() const{return fCurrentMotherKFCandidate;}
+       
+  /*
+   * Checks the probablity that the PID of the particle is what we want it to be.
+   */
+  Bool_t CheckPIDProbability(Double_t negProbCut, Double_t posProbCut);
+       
+  /*
+   * Checks if the PID of the two particles are within our cuts.
+   */
+  void GetPIDProbability(Double_t &negPIDProb, Double_t &posPIDProb);
+       
+  /*
+   *Get the negative MC TParticle from the stack 
+   */
+  TParticle * GetNegativeMCParticle() const{return fNegativeMCParticle;}
+       
+  /*
+   *Get the positive MC TParticle from the stack 
+   */
+  TParticle * GetPositiveMCParticle() const{return fPositiveMCParticle;}
+       
+  /*
+   *Get the mother MC TParticle from the stack 
+   */
+  TParticle * GetMotherMCParticle() const{return fMotherMCParticle;}
+       
+  /*
+   * Flag to see if the v0 particles share the same mother
+   */
+  Bool_t HasSameMCMother();
+       
+       
+  /*
+   *Get the PID of the MC mother particle
+   */
+  Int_t GetMotherMCParticlePDGCode() const{if(fMotherMCParticle != NULL){ cout<<"MCParticle exists"<<endl;} return fMotherMCParticle->GetPdgCode();}
+       
+  /*
+   *Get the MC stack 
+   */
+  AliStack* GetMCStack() const{return fMCStack;}
+       
+       
+  /*
+   * Setup  AliMCEventHandler
+   */                  
+  AliMCEventHandler* GetMCTruth() const{return fMCTruth;}      // for CF
+       
+       
+  /*
+   *Get the MC stack 
+   */
+  AliMCEvent* GetMCEvent() const{return fMCEvent;}   // for CF
+       
+       
+  /*
+   *Get the magnetic field from the ESD event 
+   */
+  Double_t GetMagneticField() const{return fESDEvent->GetMagneticField();}
+       
+  /*
+   *Get the primary vertex from the esd event
+   */
+  const AliESDVertex *GetPrimaryVertex() const {return fESDEvent->GetPrimaryVertex();}
+       
+  /*
+   * Set the PID of the negative track
+   */
+  void SetNegativeTrackPID(Int_t negTrackPID){fNegativeTrackPID=negTrackPID;}
+       
+  /*
+   * Set the PID of the positive track
+   */
+  void SetPositiveTrackPID(Int_t posTrackPID){fPositiveTrackPID=posTrackPID;}
+       
+  /*
+   * Set the flag to use the kfparticle class. Will also disable the use of esd tracks
+   */
+  void UseKFParticle(){fUseKFParticle = kTRUE; fUseESDTrack = kFALSE;}
+       
+  /*
+   *  Set the flag to use the esd track class. Will also disable the use of kf particles
+   */
+  void UseESDTrack(){fUseESDTrack = kTRUE; fUseKFParticle = kFALSE;}
+       
+  /*
+   *  Set the flag to use improved vertex or not
+   */
+  void SetUseImprovedVertex(Bool_t useImprovedVertex){fUseImprovedVertex=useImprovedVertex;}
+       
+  /*
+   * Return the number in the species array belonging to the negative or positive track pid.
+   */
+  Int_t GetSpeciesIndex(Int_t chargeOfTrack);
+       
+  /*
+   * Return the x coordinate of the v0
+   */
+  Double_t GetX() const{return fCurrentXValue;}
+       
+  /*
+   * Return the y coordinate of the v0
+   */
+  Double_t GetY() const{return fCurrentYValue;}
+       
+  /*
+   * Return the Z coordinate of the v0
+   */
+  Double_t GetZ() const{return fCurrentZValue;}
+       
+  /*
+   * Return the radius of the v0
+   */
+  Double_t GetXYRadius() const{return sqrt((Double_t)(fCurrentXValue*fCurrentXValue + fCurrentYValue*fCurrentYValue));}
+       
+  /*
+   * Get the opening angle between the two tracks
+   */
+  Double_t GetOpeningAngle(){return fNegativeTrackLorentzVector->Angle(fPositiveTrackLorentzVector->Vect());}
+
+  /*
+   * Get the Cos Pointing angle between the two tracks
+   */
+  Double_t GetCosPointingAngle(){return fCurrentV0->GetV0CosineOfPointingAngle();}
+
+  /*
+   * Get the DCA between the two tracks
+   */
+  Double_t GetDcaDaughters(){return fCurrentV0->GetDcaV0Daughters();}
+
+  /*
+   * Get the Normalized DCA between the two tracks
+   */
+  Double_t GetNormDcaDistDaughters(){return fCurrentV0->GetDcaV0Daughters()/fCurrentV0->GetDistSigma();}
+
+  /*
+   * Get the Likelihood for a Conversion
+   */
+  Double_t GetLikelihoodAP(){return fCurrentV0->GetLikelihoodAP(0,0);}
+      
+  /*
+   * Gets the Energy of the negative track.
+   */
+  Double_t GetNegativeTrackEnergy() const{return fCurrentNegativeKFParticle->E();}
+       
+  /*
+   * Gets the Energy of the positive track.
+   */
+  Double_t GetPositiveTrackEnergy() const{return fCurrentPositiveKFParticle->E();}
+       
+  /*
+   * Gets the Energy of the mother candidate.
+   */
+  Double_t GetMotherCandidateEnergy() const{return fCurrentMotherKFCandidate->E();}
+       
+  /*
+   * Gets the Pt of the negative track.
+   */
+  Double_t GetNegativeTrackPt() const{return fNegativeTrackLorentzVector->Pt();}
+       
+  /*
+   * Gets the Pt of the positive track.
+   */
+  Double_t GetPositiveTrackPt() const{return fPositiveTrackLorentzVector->Pt();}
+       
+
+  /*
+   * Gets the Pt of the mother candidate.
+   */
+  Double_t GetMotherCandidatePt() const{return fMotherCandidateLorentzVector->Pt();}
+
+
+  /*
+   * Gets the P of the mother candidate.
+   */
+  Double_t GetMotherCandidateP() const{return fMotherCandidateLorentzVector->P();}
+       
+
+  /*
+   * Gets the Eta of the negative track.
+   */
+  Double_t GetNegativeTrackEta() const{return fNegativeTrackLorentzVector->Eta();}
+  /*
+   * Gets the Eta of the positive track.
+   */
+  Double_t GetPositiveTrackEta() const{return fPositiveTrackLorentzVector->Eta();}
+  /*
+   * Gets the Eta of the mother candidate.
+   */
+  Double_t GetMotherCandidateEta() const{return fMotherCandidateLorentzVector->Eta();}
+       
+  /*
+   * Gets the NDF of the mother candidate.
+   */
+  Double_t GetMotherCandidateNDF() const{return fCurrentMotherKFCandidate->GetNDF();}
+       
+  /*
+   * Gets the Chi2 of the mother candidate.
+   */
+  Double_t GetMotherCandidateChi2() const{return fCurrentMotherKFCandidate->GetChi2();}
+       
+  /*
+   * Gets the Mass of the mother candidate.
+   */
+  Double_t GetMotherCandidateMass() const{return fMotherCandidateKFMass;}
+       
+  /*
+   * Gets the Width of the mother candidate.
+   */
+  Double_t GetMotherCandidateWidth() const{return fMotherCandidateKFWidth;}
+       
+  /*
+   * Gets the Phi of the negative track.
+   */
+  Double_t GetNegativeTrackPhi() const;
+       
+  /*
+   * Gets the Phi of the positive track.
+   */
+  Double_t GetPositiveTrackPhi() const;
+       
+  /*
+   * Gets the Phi of the mother candidate.
+   */
+  Double_t GetMotherCandidatePhi() const;
+       
+  /*
+   * Gets the Rapidity of the mother candidate.
+   */
+  Double_t GetMotherCandidateRapidity() const;
+       
+
+  /*
+   * Gets the P of the negative track.
+   */
+  Double_t GetNegativeTrackP() const{return fNegativeTrackLorentzVector->P();}
+       
+  /*
+   * Gets the P of the positive track.
+   */
+  Double_t GetPositiveTrackP() const{return fPositiveTrackLorentzVector->P();}
+
+  /*
+   * Gets the dE/dx in the TPC of the negative track.
+   */
+  Double_t GetNegativeTrackTPCdEdx() const{return fCurrentNegativeESDTrack->GetTPCsignal();}
+       
+  /*
+   * Gets the dE/dx in the TPC of the positive track.
+   */
+  Double_t GetPositiveTrackTPCdEdx() const{return fCurrentPositiveESDTrack->GetTPCsignal();}
+       
+  /*
+   * Update data which need to be updated every event.
+   */
+  void UpdateEventByEventData();
+       
+  /*
+   * Gets the MaxRCut value.
+   */
+  Double_t GetMaxRCut() const{return fMaxR;}
+       
+  /*
+   * Gets the Eta cut value.
+   */
+  Double_t GetEtaCut() const{return fEtaCut;}
+       
+  /*
+   * Gets the Pt cut value.
+   */
+  Double_t GetPtCut() const{return fPtCut;}
+       
+       
+  /*
+   * Gets the MaxZCut value.
+   */
+  Double_t GetMaxZCut() const{return fMaxZ;}
+       
+       
+  /*
+   * Gets the line cut values.
+   */
+  Double_t GetLineCutZRSlope() const{return fLineCutZRSlope;}
+  Double_t GetLineCutZValue() const{return fLineCutZValue;}
+       
+  /*
+   * Gets the Chi2 cut value for the conversions.
+   */
+  Double_t GetChi2CutConversion() const{return fChi2CutConversion;}
+       
+  /*
+   * Gets the Chi2 cut value for the mesons.
+   */
+  Double_t GetChi2CutMeson() const{return fChi2CutMeson;}
+       
+  Double_t GetPositiveTrackLength() const{return fCurrentPositiveESDTrack->GetIntegratedLength();}
+  Double_t GetNegativeTrackLength() const{return fCurrentNegativeESDTrack->GetIntegratedLength();}
+       
+  Double_t GetPositiveNTPCClusters() const{return fCurrentPositiveESDTrack->GetTPCNcls();}
+  Double_t GetNegativeNTPCClusters() const{return fCurrentNegativeESDTrack->GetTPCNcls();}
+       
+  /*
+   * Sets the MaxRCut value.
+   */
+  void SetMaxRCut(Double_t maxR){fMaxR=maxR;}
+       
+  /*
+   * Sets the EtaCut value.
+   */
+  void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}
+       
+  /*
+   * Sets the PtCut value.
+   */
+  void SetPtCut(Double_t ptCut){fPtCut=ptCut;}
+       
+    
+  /*
+   * Sets the MaxZCut value.
+   */
+  void SetMaxZCut(Double_t maxZ){fMaxZ=maxZ;}
+       
+       
+  /*
+   * Sets the LineCut values.
+   */
+  void SetLineCutZRSlope(Double_t LineCutZRSlope){fLineCutZRSlope=LineCutZRSlope;}
+  void SetLineCutZValue(Double_t LineCutZValue){fLineCutZValue=LineCutZValue;}
+       
+  /*
+   * Sets the Chi2Cut value for conversions.
+   */
+  void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}
+       
+  /*
+   * Sets the Chi2Cut for the mesons.
+   */
+  void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}
+       
+  /*
+   * Sets the XVertexCut value.
+   */
+  void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;}
+       
+  /*
+   * Sets the YVertexCut value.
+   */
+  void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;}
+       
+  /*
+   * Sets the ZVertexCut value.
+   */
+  void SetZVertexCut(Double_t zVtx){fCurrentZValue=zVtx;}
+       
+  /*
+   * Sets the PIDProbabilityCut value for track particles.
+   */
+  void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;}
+       
+  /*
+   * Sets the PIDProbability cut value for the negative track.
+   */
+  void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}
+       
+  /*
+   * Sets the PIDProbability cut value for the positive track.
+   */
+  void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}
+
+  /*
+   * Sets the PIDnSigmaAboveElectron cut value for the tracks.
+   */
+  void SetPIDnSigmaAboveElectronLine(Double_t nSigmaAbove){fPIDnSigmaAboveElectronLine=nSigmaAbove;}
+       
+  /*
+   * Sets the PIDnSigmaBelowElectron cut value for the tracks.
+   */
+  void SetPIDnSigmaBelowElectronLine(Double_t nSigmaBelow){fPIDnSigmaBelowElectronLine=nSigmaBelow;}
+       
+  /*
+   * Sets the PIDnSigmaAbovePion cut value for the tracks.
+   */
+  void SetPIDnSigmaAbovePionLine(Double_t nSigmaAbovePion){fPIDnSigmaAbovePionLine=nSigmaAbovePion;}
+
+  /*
+   * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
+   */
+  void SetPIDMinPnSigmaAbovePionLine(Double_t MinPnSigmaAbovePion){fPIDMinPnSigmaAbovePionLine=MinPnSigmaAbovePion;}
+
+  /*
+   * Sets the SigmaMassCut value.
+   */
+  void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}
+       
+  /*
+   * Sets the flag to enable/disable the usage of MC information. 
+   */
+  void SetDoMCTruth(Bool_t doMC){fDoMC = doMC;}
+
+  /*
+   * Sets the flag to enable/disable the usage of MC information. 
+   */
+  Bool_t GetDoMCTruth(){return fDoMC;}
+       
+  /*
+   * Sets the flag to enable/disable the cut dedx N sigma 
+   */
+
+  void SetDodEdxSigmaCut( Bool_t dodEdxSigmaCut){fDodEdxSigmaCut=dodEdxSigmaCut;}
+
+
+  /*
+   * Updates the V0 information of the current V0.
+   */
+  Bool_t UpdateV0Information();
+       
+  /*
+   * Resets the V0 index.
+   */
+  void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}
+       
+  /*
+   * Sets the histograms.
+   */
+  void SetHistograms(AliGammaConversionHistograms * const histograms){fHistograms=histograms;}
+       
+  /*
+   * Check for primary vertex.
+   */
+  Bool_t CheckForPrimaryVertex();
+       
+  /*
+   * Gets a vector of good v0s.
+   */
+  TClonesArray* GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;}
+       
+  /*
+   * Gets the vector of previous events v0s (for bacground analysis)
+   */
+  AliGammaConversionKFVector* GetBGGoodV0s(Int_t event);
+  //  vector<AliKFParticle> GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;}
+
+  void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
+
+  Bool_t GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]);
+       
+  Bool_t GetConvPosXY(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b, Double_t convpos[2]);
+       
+  Double_t GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b);
+
+  void SetDoCF(Bool_t flag){fDoCF = flag;}
+
+  Bool_t CheckV0FinderStatus(Int_t index);
+
+  void SetOnFlyFlag(Bool_t flag){fUseOnFlyV0Finder = flag;}
+
+ Int_t GetNBGEvents(){return fBGEventHandler->GetNBGEvents();}
+
+ private:
+  AliStack * fMCStack;           // pointer to MonteCarlo particle stack 
+  AliMCEventHandler* fMCTruth;   // for CF    pointer to the MC object
+  AliMCEvent *fMCEvent;                        //  for CF      pointer to MC event
+  TChain * fChain;               // pointer to the TChain
+       
+  AliESDInputHandler* fESDHandler;      //! pointer to esd object
+  AliESDEvent *fESDEvent;               //! pointer to esd object
+       
+       
+  // for CF
+  AliCFManager *fCFManager; // pointer to the cf manager
+  //  AliCFContainer *container;
+       
+  // for dEdx cut based on nSigma to a particle line
+  AliTPCpidESD * fTPCpid; 
+       
+  AliGammaConversionHistograms *fHistograms; //! pointer to histogram handling class
+       
+  Int_t fCurrentV0IndexNumber;  // the current v0 index number
+  AliESDv0 * fCurrentV0;                //! pointer to the current v0
+  AliKFParticle * fCurrentNegativeKFParticle;  //! pointer to the negative KF particle
+  AliKFParticle * fCurrentPositiveKFParticle;  //! pointer to the positive KF particle
+  AliKFParticle * fCurrentMotherKFCandidate;   //! pointer to the positive KF particle
+       
+  AliESDtrack * fCurrentNegativeESDTrack;      //! pointer to the negative ESD track
+  AliESDtrack * fCurrentPositiveESDTrack;      //! pointer to the positive ESD track
+       
+  TLorentzVector * fNegativeTrackLorentzVector; //! pointer to the negative Track Lorentz Vector
+  TLorentzVector * fPositiveTrackLorentzVector; //! pointer to the positive Track Lorentz Vector
+  TLorentzVector * fMotherCandidateLorentzVector;   //! pointer to the mother candidate Track Lorentz Vector
+       
+  Double_t fCurrentXValue;   // current x value
+  Double_t fCurrentYValue;   // current y value
+  Double_t fCurrentZValue;   // current z value
+       
+  Int_t fPositiveTrackPID;   // positive track pid
+  Int_t fNegativeTrackPID;   // negative track pid
+       
+  TParticle *fNegativeMCParticle;      //!
+  TParticle *fPositiveMCParticle;      //!
+  TParticle *fMotherMCParticle;        //!
+       
+  Double_t fMotherCandidateKFMass;   // mass of mother candidate KF particle
+  Double_t fMotherCandidateKFWidth;  // width of mother candidate KF particle
+       
+  Bool_t fUseKFParticle;   // flag 
+  Bool_t fUseESDTrack;     // flag 
+  Bool_t fDoMC;            // flag 
+       
+  //cuts
+  Double_t fMaxR; //r cut
+  Double_t fEtaCut; //eta cut
+  Double_t fPtCut; // pt cut
+  Double_t fMaxZ; //z cut  
+  Double_t fLineCutZRSlope; //linecut
+  Double_t fLineCutZValue; //linecut
+  Double_t fChi2CutConversion; //chi2cut
+  Double_t fChi2CutMeson;  //chi2cut
+  Double_t fPIDProbabilityCutNegativeParticle; //pid cut
+  Double_t fPIDProbabilityCutPositiveParticle; //pid cut
+  Bool_t   fDodEdxSigmaCut; // flag to use the dEdxCut based on sigmas
+  Double_t fPIDnSigmaAboveElectronLine;
+  Double_t fPIDnSigmaBelowElectronLine;
+  Double_t fPIDnSigmaAbovePionLine;
+  Double_t fPIDMinPnSigmaAbovePionLine;
+  Double_t fXVertexCut; //vertex cut
+  Double_t fYVertexCut; //vertex cut
+  Double_t fZVertexCut; // vertexcut
+       
+  Double_t fNSigmaMass; //nsigma cut
+       
+  Bool_t fUseImprovedVertex; //flag
+
+  Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
+
+  Bool_t fDoCF; //flag
+
+  Bool_t fUseOnFlyV0Finder;
+
+  Bool_t fUpdateV0AlreadyCalled; //flag
+       
+  TClonesArray* fCurrentEventGoodV0s; //vector of good v0s
+  //  vector<AliKFParticle> fPreviousEventGoodV0s; // vector of good v0s from prevous events
+
+  AliGammaConversionBGHandler *fBGEventHandler;
+  Bool_t fBGEventInitialized;
+       
+  ClassDef(AliV0Reader,8)
+};
+#endif
+
+
+