]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/GammaConv/AliV0Reader.h
update to run TPC+ITS analysis
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliV0Reader.h
index c937e14dd2a5229eb662b1b631fda27c822d0e80..6fd36252dfeafddb7ccf1fc1292813713377f0d2 100644 (file)
@@ -20,6 +20,7 @@
 #include <vector>
 #include "AliCFManager.h"
 #include "AliGammaConversionBGHandler.h"
+#include "AliESDpid.h"
 
 class TClonesArray; 
 class TFormula;
@@ -39,8 +40,8 @@ class TChain;
 class TChain;
 class AliCFManager;   // for CF
 class AliCFContainer;  // for CF
-class AliTPCpidESD; // for dEdx cut based on nSigma to particle lines 
-
+//class AliESDpid; // for dEdx cut based on nSigma to particle lines 
+class AliESDtrackCuts; 
 
 class AliV0Reader : public TObject {
        
@@ -51,23 +52,26 @@ class AliV0Reader : public TObject {
   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
+    kStepGetOnFly = 2,
+    kStepLikeSign = 3,
+    kStepTPCRefit = 4,
+    kStepKinks = 5,
+    kStepdEdx_electronselection = 6,
+    kStepdEdx_pionrejection = 7,
+    kStepNContributors = 8,
+    kStepTPCPID = 9,
+    kStepR = 10,
+    kStepLine = 11,
+    kStepZ = 12,
+    kStepMinClsTPC = 13,
+    kStepSinglePt= 14,  
+    kStepNDF = 15,
+    kStepChi2 = 16,
+    kStepEta = 17,
+    kStepPt = 18,
+    kStepTrueGamma = 19
   };
        
-       
-       
   AliV0Reader();                                        //constructor
   AliV0Reader(const AliV0Reader & g);                   //copy constructor
   AliV0Reader & operator = (const AliV0Reader & g);     //assignment operator
@@ -77,7 +81,12 @@ class AliV0Reader : public TObject {
    *Initialize the reader
    */
   void Initialize();
-       
+  void SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) ;
+
+
+  virtual void SetInputEvent(AliVEvent* const input)  {fESDEvent  = dynamic_cast<AliESDEvent*>(input);}
+  virtual void SetMC(AliMCEvent* const mc)            {fMCEvent = mc;}
+
        
   // for CF
   void SetCFManager(AliCFManager * const io){fCFManager = io;};
@@ -99,7 +108,8 @@ class AliV0Reader : public TObject {
   /*
    *Returns the number of contributors to the vertex
    */
-  Int_t GetNumberOfContributorsVtx() const{return fESDEvent->GetPrimaryVertex()->GetNContributors();}
+  //  Int_t GetNumberOfContributorsVtx() const{return fESDEvent->GetPrimaryVertex()->GetNContributors();}
+  Int_t GetNumberOfContributorsVtx();
   
   /*
    * Check if there are any more good v0s left in the v0 stack
@@ -122,12 +132,14 @@ class AliV0Reader : public TObject {
   /*
    * Returns the negative ESD track which belongs to fCurrentV0
    */
-  AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());}
+  //  AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());}
+  AliESDtrack* GetNegativeESDTrack(){return fCurrentNegativeESDTrack;}
        
   /*
    * Returns the positive ESD track which belongs to fCurrentV0
    */
-  AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());}
+  //  AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());}
+  AliESDtrack* GetPositiveESDTrack(){return fCurrentPositiveESDTrack;}
        
   /*
    * Returns the negative KF particle which belongs to fCurrentV0
@@ -153,6 +165,11 @@ class AliV0Reader : public TObject {
    * Checks if the PID of the two particles are within our cuts.
    */
   void GetPIDProbability(Double_t &negPIDProb, Double_t &posPIDProb);
+
+  /*
+   * Checks if the PID of the two particles are within our cuts.
+   */
+  void GetPIDProbabilityMuonPion(Double_t &negPIDProb, Double_t &posPIDProb);
        
   /*
    *Get the negative MC TParticle from the stack 
@@ -189,7 +206,7 @@ class AliV0Reader : public TObject {
   /*
    * Setup  AliMCEventHandler
    */                  
-  AliMCEventHandler* GetMCTruth() const{return fMCTruth;}      // for CF
+  //  AliMCEventHandler* GetMCTruth() const{return fMCTruth;}  // for CF
        
        
   /*
@@ -394,21 +411,77 @@ class AliV0Reader : public TObject {
    * Gets the dE/dx in the TPC of the positive track.
    */
   Double_t GetPositiveTrackTPCdEdx() const{return fCurrentPositiveESDTrack->GetTPCsignal();}
+
+  /*
+   * Gets the Number of the TPC clusters of the negative track.
+   */
+  Int_t GetNegativeTracknTPCClusters() const{return fCurrentNegativeESDTrack->GetNcls(1);}
+
+  /*
+   * Gets the Number of the TPC clusters of the positive track.
+   */
+  Int_t GetPositiveTracknTPCClusters() const{return fCurrentPositiveESDTrack->GetNcls(1);}
+       
+
+  /*
+   * Gets the Number of the TPC findable clusters of the negative track.
+   */
+  Int_t GetNegativeTracknTPCFClusters() const{return fCurrentNegativeESDTrack->GetTPCNclsF();}
+
+  /*
+   * Gets the Number of the TPC findable clusters of the positive track.
+   */
+  Int_t GetPositiveTracknTPCFClusters() const{return fCurrentPositiveESDTrack->GetTPCNclsF();}
+
+  /*
+   * Gets the Number of the ITS clusters of the negative track.
+   */
+  Int_t GetNegativeTracknITSClusters() const{return fCurrentNegativeESDTrack->GetNcls(0);}
+
+  /*
+   * Gets the Number of the ITS clusters of the positive track.
+   */
+  Int_t GetPositiveTracknITSClusters() const{return fCurrentPositiveESDTrack->GetNcls(0);}
+
+  /*
+   * Gets the chi2 of the TPC  negative track.
+   */
+  Double_t GetNegativeTrackTPCchi2() const{return fCurrentNegativeESDTrack->GetTPCchi2();}
+
+  /*
+   * Gets the chi2 of the TPC  the positive track.
+   */
+  Double_t GetPositiveTrackTPCchi2() const{return fCurrentPositiveESDTrack->GetTPCchi2();}
        
   /*
    * Update data which need to be updated every event.
    */
   void UpdateEventByEventData();
+
+  /*
+   * Gets the MaxRCut value.
+   */
+  Double_t GetMaxVertexZ() const{return fMaxVertexZ;}
        
   /*
    * Gets the MaxRCut value.
    */
   Double_t GetMaxRCut() const{return fMaxR;}
+
+   /*
+    * Gets the MinRCut value.
+    */
+   Double_t GetMinRCut() const{return fMinR;}
        
   /*
    * Gets the Eta cut value.
    */
   Double_t GetEtaCut() const{return fEtaCut;}
+
+  /*
+   * Gets the Rapidity Meson cut value.
+   */
+  Double_t GetRapidityMesonCut() const{return fRapidityMesonCut;}
        
   /*
    * Gets the Pt cut value.
@@ -422,6 +495,18 @@ class AliV0Reader : public TObject {
   Double_t GetMaxZCut() const{return fMaxZ;}
        
        
+  /*
+   * Gets the MinClsTPC value.
+   */
+  Double_t GetMinClsTPCCut() const{return fMinClsTPC;}
+       
+  /*
+   * Gets the MinClsTPC value.
+   */
+  Double_t GetMinClsTPCCutToF() const{return fMinClsTPCToF;}
+       
+
+
   /*
    * Gets the line cut values.
    */
@@ -438,34 +523,73 @@ class AliV0Reader : public TObject {
    */
   Double_t GetChi2CutMeson() const{return fChi2CutMeson;}
        
+  /*
+   * Gets the alpha cut value for the mesons.
+   */
+  Double_t GetAlphaCutMeson() const{return fAlphaCutMeson;}
+
+  /*
+   * Gets the Minimum alpha cut value for the mesons.
+   */
+  Double_t GetAlphaMinCutMeson() const{return fAlphaMinCutMeson;}
+
   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 MaxVertexZ value.
+   */
+  void SetMaxVertexZ(Double_t maxVertexZ){fMaxVertexZ=maxVertexZ;}
+
   /*
    * Sets the MaxRCut value.
    */
   void SetMaxRCut(Double_t maxR){fMaxR=maxR;}
-       
+  /*   
+   * Sets the MinRCut value.
+   */
+  void SetMinRCut(Double_t minR){fMinR=minR;}
+
   /*
    * Sets the EtaCut value.
    */
   void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}
+
+  /*
+   * Sets the Rapidity Meson Cut value.
+   */
+  void SetRapidityMesonCut(Double_t RapidityMesonCut){fRapidityMesonCut=RapidityMesonCut;}
        
   /*
    * Sets the PtCut value.
    */
   void SetPtCut(Double_t ptCut){fPtCut=ptCut;}
        
+  /*
+   * Sets the PtCut value.
+   */
+  void SetSinglePtCut(Double_t singleptCut){fSinglePtCut=singleptCut;}
+       
     
   /*
    * Sets the MaxZCut value.
    */
   void SetMaxZCut(Double_t maxZ){fMaxZ=maxZ;}
        
+  /*
+   * Sets the MinClsTPC value.
+   */
+  void SetMinClsTPCCut(Double_t minClsTPC){fMinClsTPC=minClsTPC;}
+
+  /*
+   * Sets the MinClsTPC value.
+   */
+  void SetMinClsTPCCutToF(Double_t minClsTPCToF){fMinClsTPCToF=minClsTPCToF;}
        
+
   /*
    * Sets the LineCut values.
    */
@@ -482,6 +606,18 @@ class AliV0Reader : public TObject {
    */
   void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}
        
+  /*
+   * Sets the AlphaCut for the mesons.
+   */
+  void SetAlphaCutMeson(Double_t alpha){fAlphaCutMeson=alpha;}
+       
+
+  /*
+   * Sets the AlphaCut for the mesons.
+   */
+  void SetAlphaMinCutMeson(Double_t alpha){fAlphaMinCutMeson=alpha;}
+
+
   /*
    * Sets the XVertexCut value.
    */
@@ -532,6 +668,11 @@ class AliV0Reader : public TObject {
    */
   void SetPIDMinPnSigmaAbovePionLine(Double_t MinPnSigmaAbovePion){fPIDMinPnSigmaAbovePionLine=MinPnSigmaAbovePion;}
 
+ /*
+   * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
+   */
+  void SetPIDMaxPnSigmaAbovePionLine(Double_t MaxPnSigmaAbovePion){fPIDMaxPnSigmaAbovePionLine=MaxPnSigmaAbovePion;}
+
   /*
    * Sets the SigmaMassCut value.
    */
@@ -545,7 +686,7 @@ class AliV0Reader : public TObject {
   /*
    * Sets the flag to enable/disable the usage of MC information. 
    */
-  Bool_t GetDoMCTruth(){return fDoMC;}
+  Bool_t GetDoMCTruth() const {return fDoMC;}
        
   /*
    * Sets the flag to enable/disable the cut dedx N sigma 
@@ -553,6 +694,57 @@ class AliV0Reader : public TObject {
 
   void SetDodEdxSigmaCut( Bool_t dodEdxSigmaCut){fDodEdxSigmaCut=dodEdxSigmaCut;}
 
+  /*
+   * Sets the flag to enable/disable the cut dedx N sigma for Kaon Rejection at low p 
+   */
+  void SetDoKaonRejectionLowP( Bool_t doKaonRejectionLowP){fDoKaonRejectionLowP=doKaonRejectionLowP;}
+  /*
+   * Sets the flag to enable/disable the cut dedx N sigma for Proton Rejection at low p 
+   */
+  void SetDoProtonRejectionLowP( Bool_t doProtonRejectionLowP){fDoProtonRejectionLowP=doProtonRejectionLowP;}
+
+  /*
+   * Sets the flag to enable/disable the cut dedx N sigma for Pion Rejection at low p 
+   */
+  void SetDoPionRejectionLowP( Bool_t doPionRejectionLowP){fDoPionRejectionLowP=doPionRejectionLowP;}
+
+  /*
+   * Sets the PIDMinPnSigmaAroundKaon cut value for the tracks.
+   */
+  void SetPIDnSigmaAtLowPAroundKaonLine(Double_t nSigmaAtLowPAroundKaon){fPIDnSigmaAtLowPAroundKaonLine =nSigmaAtLowPAroundKaon;}
+
+  /*
+   * Sets the PIDMinPnSigmaAroundProton cut value for the tracks.
+   */
+  void SetPIDnSigmaAtLowPAroundProtonLine(Double_t nSigmaAtLowPAroundProton){fPIDnSigmaAtLowPAroundProtonLine =nSigmaAtLowPAroundProton;}
+
+  /*
+   * Sets the PIDMinPnSigmaAroundPion cut value for the tracks.
+   */
+  void SetPIDnSigmaAtLowPAroundPionLine(Double_t nSigmaAtLowPAroundPion){fPIDnSigmaAtLowPAroundPionLine =nSigmaAtLowPAroundPion;}
+
+  /*
+   * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
+   */
+  void SetPIDMinPKaonRejectionLowP(Double_t PIDMinPKaonRejectionLowP ){fPIDMinPKaonRejectionLowP=PIDMinPKaonRejectionLowP;}
+
+  /*
+   * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
+   */
+  void SetPIDMinPProtonRejectionLowP(Double_t PIDMinPProtonRejectionLowP ){fPIDMinPProtonRejectionLowP=PIDMinPProtonRejectionLowP;}
+  /*
+   * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
+   */
+  void SetPIDMinPPionRejectionLowP(Double_t PIDMinPPionRejectionLowP ){fPIDMinPPionRejectionLowP=PIDMinPPionRejectionLowP;}
+
+  /*
+   *Set if we want to use Gamma Selection based on Qt from Armenteros
+   */
+  void SetDoQtGammaSelection(Bool_t doQtGammaSelection){fDoQtGammaSelection=doQtGammaSelection;}
+  /*
+   * Sets the MaxQtCut value.
+   */
+  void SetQtMax(Double_t qtMax){fQtMax=qtMax;}
 
   /*
    * Updates the V0 information of the current V0.
@@ -563,7 +755,13 @@ class AliV0Reader : public TObject {
    * Resets the V0 index.
    */
   void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}
-       
+  
+
+  /*
+   * Returns number of good v0s in the event
+   */
+  Int_t GetNGoodV0s() const {return fNumberOfGoodV0s;}
+
   /*
    * Sets the histograms.
    */
@@ -574,6 +772,11 @@ class AliV0Reader : public TObject {
    */
   Bool_t CheckForPrimaryVertex();
        
+  /*
+   * Check for primary vertex Z.
+   */
+  Bool_t CheckForPrimaryVertexZ();
+
   /*
    * Gets a vector of good v0s.
    */
@@ -587,27 +790,62 @@ class AliV0Reader : public TObject {
 
   void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
 
+  void SetUseConstructGamma(Bool_t flag){fUseConstructGamma=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);
 
+  Bool_t GetArmenterosQtAlfa(AliKFParticle * posKFparticle,AliKFParticle * negKFparticle,AliKFParticle * gamKFparticle,Double_t armenterosQtAlfa[2]);
+
   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();}
+
+  void SetCalculateBackground(Bool_t flag){fCalculateBackground=flag;}
+
+  AliGammaConversionBGHandler* GetBGHandler() const {return fBGEventHandler;}
+
+  Double_t GetVertexZ(){return fESDEvent->GetPrimaryVertex()->GetZ();}
+
+  Int_t GetMultiplicity(){return CountESDTracks();}
+
+  void SetESDtrackCuts(AliESDtrackCuts * const trackCuts){fEsdTrackCuts = trackCuts;}
+
+  void SetNEventsForBG(Int_t nev){nEventsForBGCalculation = nev;}
+
+  Int_t CountESDTracks();
+
+  Int_t GetCurrentV0IndexNumber() const {return fCurrentV0IndexNumber;}
+
+  Bool_t CheckIfPi0IsMother(Int_t label);
+  Bool_t CheckIfEtaIsMother(Int_t label);
+
+  static void InitESDpid(Int_t type=0);
+  static void SetESDpid(AliESDpid * const pid) {fgESDpid=pid;}
+  static AliESDpid* GetESDpid() {return fgESDpid;}
+
+  void SetUseChargedTracksMultiplicityForBG(Bool_t flag){fUseChargedTrackMultiplicityForBG = flag;}
+  
+  Int_t GetPindex(Int_t i) {return fV0Pindex.at(i);}
+  Int_t GetNindex(Int_t i) {return fV0Nindex.at(i);}
+
+  void ResetNGoodV0s(){fNumberOfGoodV0s=0;}
 
- Int_t GetNBGEvents(){return fBGEventHandler->GetNBGEvents();}
 
  private:
   AliStack * fMCStack;           // pointer to MonteCarlo particle stack 
-  AliMCEventHandler* fMCTruth;   // for CF    pointer to the MC object
+  //  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
+  //  AliESDInputHandler* fESDHandler;      //! pointer to esd object
   AliESDEvent *fESDEvent;               //! pointer to esd object
        
        
@@ -616,9 +854,9 @@ class AliV0Reader : public TObject {
   //  AliCFContainer *container;
        
   // for dEdx cut based on nSigma to a particle line
-  AliTPCpidESD * fTPCpid; 
+  //AliESDpid * fESDpid; // esd pid
        
-  AliGammaConversionHistograms *fHistograms; //! pointer to histogram handling class
+  AliGammaConversionHistograms *fHistograms; // pointer to histogram handling class
        
   Int_t fCurrentV0IndexNumber;  // the current v0 index number
   AliESDv0 * fCurrentV0;                //! pointer to the current v0
@@ -650,23 +888,44 @@ class AliV0Reader : public TObject {
   Bool_t fUseKFParticle;   // flag 
   Bool_t fUseESDTrack;     // flag 
   Bool_t fDoMC;            // flag 
-       
+
+  //Event Cuts
+  Double_t fMaxVertexZ;
   //cuts
   Double_t fMaxR; //r cut
+  Double_t fMinR; //r cut
   Double_t fEtaCut; //eta cut
+  Double_t fRapidityMesonCut; //rapidity for meson cut
   Double_t fPtCut; // pt cut
-  Double_t fMaxZ; //z cut  
+  Double_t fSinglePtCut; // pt cut for electron/positron
+  Double_t fMaxZ; //z cut
+  Double_t fMinClsTPC;
+  Double_t fMinClsTPCToF;
   Double_t fLineCutZRSlope; //linecut
   Double_t fLineCutZValue; //linecut
   Double_t fChi2CutConversion; //chi2cut
   Double_t fChi2CutMeson;  //chi2cut
+  Double_t fAlphaCutMeson;  //alphacut
+  Double_t fAlphaMinCutMeson;  //alphacut
   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 fPIDnSigmaAboveElectronLine; // sigma cut
+  Double_t fPIDnSigmaBelowElectronLine; // sigma cut
+  Double_t fPIDnSigmaAbovePionLine;     // sigma cut
+  Double_t fPIDMinPnSigmaAbovePionLine; // sigma cut
+  Double_t fPIDMaxPnSigmaAbovePionLine; // sigma cut
+  Double_t fDoKaonRejectionLowP;   // Kaon rejection at low p
+  Double_t fDoProtonRejectionLowP; // Proton rejection at low p
+  Double_t fDoPionRejectionLowP;   // Pion rejection at low p
+  Double_t fPIDnSigmaAtLowPAroundKaonLine; // sigma cut
+  Double_t fPIDnSigmaAtLowPAroundProtonLine; // sigma cut
+  Double_t fPIDnSigmaAtLowPAroundPionLine; // sigma cut
+  Double_t fPIDMinPKaonRejectionLowP; // Momentum limit to apply kaon rejection
+  Double_t fPIDMinPProtonRejectionLowP; // Momentum limit to apply proton rejection
+  Double_t fPIDMinPPionRejectionLowP; // Momentum limit to apply proton rejection
+  Bool_t   fDoQtGammaSelection; // Select gammas using qtMax
+  Double_t fQtMax; // Maximum Qt from Armenteros to select Gammas
   Double_t fXVertexCut; //vertex cut
   Double_t fYVertexCut; //vertex cut
   Double_t fZVertexCut; // vertexcut
@@ -677,21 +936,76 @@ class AliV0Reader : public TObject {
 
   Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
 
+  Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
+
   Bool_t fDoCF; //flag
 
-  Bool_t fUseOnFlyV0Finder;
+  Bool_t fUseOnFlyV0Finder; //flag
 
   Bool_t fUpdateV0AlreadyCalled; //flag
        
   TClonesArray* fCurrentEventGoodV0s; //vector of good v0s
+  vector<Int_t> fV0Pindex;
+  vector<Int_t> fV0Nindex;  
   //  vector<AliKFParticle> fPreviousEventGoodV0s; // vector of good v0s from prevous events
 
-  AliGammaConversionBGHandler *fBGEventHandler;
-  Bool_t fBGEventInitialized;
+  Bool_t fCalculateBackground; //flag
+  AliGammaConversionBGHandler *fBGEventHandler; // background handler
+  Bool_t fBGEventInitialized; //flag
        
-  ClassDef(AliV0Reader,8)
+  AliESDtrackCuts *fEsdTrackCuts; // track cuts
+  Int_t fNumberOfESDTracks; //track counter
+
+  static AliESDpid* fgESDpid;                 // ESD pid object
+
+  Int_t nEventsForBGCalculation;
+  
+  Bool_t fUseChargedTrackMultiplicityForBG;
+  Int_t fNumberOfGoodV0s;
+
+  ClassDef(AliV0Reader,16)
 };
+
+inline void AliV0Reader::InitESDpid(Int_t type)
+{
+  //
+  // initialize PID parameters
+  // type=0 is simulation
+  // type=1 is data
+
+  if (!fgESDpid) fgESDpid=new AliESDpid;
+  Double_t alephParameters[5];
+  // simulation
+  alephParameters[0] = 2.15898e+00/50.;
+  alephParameters[1] = 1.75295e+01;
+  alephParameters[2] = 3.40030e-09;
+  alephParameters[3] = 1.96178e+00;
+  alephParameters[4] = 3.91720e+00;
+  fgESDpid->GetTOFResponse().SetTimeResolution(80.);
+
+  // data
+  if (type==1){
+    alephParameters[0] = 0.0283086/0.97;
+    alephParameters[1] = 2.63394e+01;
+    alephParameters[2] = 5.04114e-11;
+    alephParameters[3] = 2.12543e+00;
+    alephParameters[4] = 4.88663e+00;
+    fgESDpid->GetTOFResponse().SetTimeResolution(130.);
+    fgESDpid->GetTPCResponse().SetMip(50.);
+  }
+
+  fgESDpid->GetTPCResponse().SetBetheBlochParameters(
+    alephParameters[0],alephParameters[1],alephParameters[2],
+    alephParameters[3],alephParameters[4]);
+
+  fgESDpid->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
+
+}
+
 #endif
 
 
 
+
+