ROOT logo
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
*                                                                        *
* Author: The ALICE Off-line Project.                                    *
* Contributors are mentioned in the code where appropriate.              *
*                                                                        *
* Permission to use, copy, modify and distribute this software and its   *
* documentation strictly for non-commercial purposes is hereby granted   *
* without fee, provided that the above copyright notice appears in all   *
* copies and that both the copyright notice and this permission notice   *
* appear in the supporting documentation. The authors make no claims     *
* about the suitability of this software for any purpose. It is          *
* provided "as is" without express or implied warranty.                  *
**************************************************************************/
//
// Class for TPC PID
// Does electron selection based on dE/dx
// For more information please check the implementation file
//
#ifndef ALIHFEPIDTPC_H
#define ALIHFEPIDTPC_H

#ifndef ALIHFEPIDBASE_H
#include "AliHFEpidBase.h"
#endif

#ifndef ALIPID_H
#include "AliPID.h"
#endif

class TList;
class TF1;
class TH2D;
class AliAODTrack;
class AliAODMCParticle;
class AliESDtrack;
class AliMCParticle;
class AliVParticle;
class AliHFEcollection;
class AliHFEpidQAmanager;

class AliHFEpidTPC : public AliHFEpidBase{
  public:
    AliHFEpidTPC();
    AliHFEpidTPC(const Char_t *name);
    AliHFEpidTPC(const AliHFEpidTPC &ref);
    AliHFEpidTPC &operator=(const AliHFEpidTPC &ref);
    virtual ~AliHFEpidTPC();
    
    virtual Bool_t InitializePID(Int_t /*run*/);
    virtual Int_t IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) const;

    void AddTPCdEdxLineCrossing(Int_t species, Double_t sigma);
    Bool_t HasAsymmetricSigmaCut() const { return TestBit(kAsymmetricSigmaCut);}
    Bool_t HasParticleRejection() const { return TestBit(kRejection); }
    void SetTPCnSigma(Short_t nSigma) { fNsigmaTPC = nSigma; };
    void SetUseOnlyOROC(Bool_t useOnlyOROC) { fUseOnlyOROC = useOnlyOROC; };
    inline void SetAsymmetricTPCsigmaCut(Float_t pmin, Float_t pmax, Float_t sigmaMin, Float_t sigmaMax);
    inline void SetRejectParticle(Int_t species, Float_t pmin, Float_t sigmaMin, Float_t pmax, Float_t sigmaMax);

    void SetUpperSigmaCutDefault(const TF1 * const model) { fkUpperSigmaCut[0] = model; fHasCutModel = kTRUE; }
    void SetUpperSigmaCutCentrality(const TF1 * const model, Int_t centralityBin) { if(centralityBin < 11) fkUpperSigmaCut[centralityBin+1] = model; fHasCutModel = kTRUE; }
    void SetLowerSigmaCutDefault(const TF1 * const model) { fkLowerSigmaCut[0] = model; fHasCutModel = kTRUE; }
    void SetLowerSigmaCutCentrality(const TF1 * const model, Int_t centralityBin) { if(centralityBin < 11) fkLowerSigmaCut[centralityBin+1] = model; fHasCutModel = kTRUE; }
    void SetEtaCorrection(const TF1 *const param) { fkEtaCorrection = param; }
    void SetCentralityCorrection(const TF1 *const param){ fkCentralityCorrection = param; }
    void SetEtaCorrections(const TF1 *const mean, const TF1 *const wdth) { fkEtaMeanCorrection = mean; fkEtaWidthCorrection = wdth; }
    void SetCentralityCorrections(const TF1 *const mean, const TF1 *const wdth) { fkCentralityMeanCorrection = mean; fkCentralityWidthCorrection = wdth; }
    void SetJpsiCorrections(const TH2D *const mean, const TH2D *const wdth) { fkCentralityEtaCorrectionMeanJpsi = mean; fkCentralityEtaCorrectionWidthJpsi = wdth; }
    void UsedEdx() { fUsedEdx = kTRUE; }
    void UseNSigma() { fUsedEdx = kFALSE; }
    Bool_t HasEtaCorrection() const { return fkEtaCorrection != NULL; }
    Bool_t HasCentralityCorrection() const { return fkCentralityCorrection != NULL; } 
    Bool_t IsUsingdEdx() const { return fUsedEdx; }

    Double_t GetP(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anaType) const;
    void ApplyEtaCorrection(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const;
    void ApplyCentralityCorrection(AliVTrack *track, Double_t centralityEstimator, AliHFEpidObject::AnalysisType_t anatype) const;
    Double_t GetCorrectedTPCnSigma(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const;
    Double_t GetCorrectedTPCnSigmaJpsi(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const;
    void UseOROC(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const;

  protected:
    void Copy(TObject &o) const;
    Int_t Reject(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anaType) const;

    Bool_t CutSigmaModel(const AliHFEpidObject *anaType) const;

  private:
    enum{
      kAsymmetricSigmaCut = BIT(20),
      kRejection = BIT(21)
    };
    Double_t fLineCrossingSigma[AliPID::kSPECIES];          // with of the exclusion point
    UChar_t fLineCrossingsEnabled;                          // Bitmap showing which line crossing is set
    const TF1 *fkUpperSigmaCut[12];                         // Upper Sigma Cut
    const TF1 *fkLowerSigmaCut[12];                         // Lower Sigma Cut
    const TF1 *fkEtaCorrection;                             // Correction for the eta dependence
    const TF1 *fkCentralityCorrection;                      // Correction for the centrality dependence
    const TF1 *fkEtaMeanCorrection;                         // Correct eta dependence of the mean of the TPC n sigma
    const TF1 *fkEtaWidthCorrection;                        // Correct eta dependence of the width of the TPC n sigma
    const TF1 *fkCentralityMeanCorrection;                  // Correct centrality dependence of the mean of the TPC n sigma
    const TF1 *fkCentralityWidthCorrection;                 // Correct centrality dependence of the width of the TPC n sigma
    const TH2D *fkCentralityEtaCorrectionMeanJpsi;          // Correction from J/psi group for the mean
    const TH2D *fkCentralityEtaCorrectionWidthJpsi;         // Correction from J/psi group for the width
    Bool_t fHasCutModel;                                    // Has cut model functions
    Bool_t fUseOnlyOROC;                                    // Use only OROC
    Float_t fPAsigCut[2];                                   // Momentum region where to perform asymmetric sigma cut
    Float_t fNAsigmaTPC[2];                                 // Asymmetric TPC Sigma band        
    Short_t fNsigmaTPC;                                     // TPC sigma band
    Float_t fRejection[4*AliPID::kSPECIES];                 // All informations for Particle Rejection, order pmin, sigmin, pmax, sigmax
    UChar_t fRejectionEnabled;                              // Bitmap for enabled particle rejection
    Bool_t  fUsedEdx;                                       // Apply cut on dE/dx instead of number of sigmas

  ClassDef(AliHFEpidTPC, 3)   // TPC Electron ID class
};

inline void AliHFEpidTPC::SetAsymmetricTPCsigmaCut(Float_t pmin, Float_t pmax, Float_t sigmaMin, Float_t sigmaMax) { 
  fPAsigCut[0] = pmin; 
  fPAsigCut[1] = pmax; 
  fNAsigmaTPC[0] = sigmaMin; 
  fNAsigmaTPC[1] = sigmaMax; 
  SetBit(kAsymmetricSigmaCut, kTRUE);
}

inline void AliHFEpidTPC::SetRejectParticle(Int_t species, Float_t pmin, Float_t sigmaMin, Float_t pmax, Float_t sigmaMax){
  if(species < 0 || species >= AliPID::kSPECIES) return;
  fRejection[4*species]   = pmin;
  fRejection[4*species+1] = sigmaMin;
  fRejection[4*species+2] = pmax;
  fRejection[4*species+3] = sigmaMax;
  SETBIT(fRejectionEnabled, species);
  SetBit(kRejection, kTRUE);
}
 
#endif
 AliHFEpidTPC.h:1
 AliHFEpidTPC.h:2
 AliHFEpidTPC.h:3
 AliHFEpidTPC.h:4
 AliHFEpidTPC.h:5
 AliHFEpidTPC.h:6
 AliHFEpidTPC.h:7
 AliHFEpidTPC.h:8
 AliHFEpidTPC.h:9
 AliHFEpidTPC.h:10
 AliHFEpidTPC.h:11
 AliHFEpidTPC.h:12
 AliHFEpidTPC.h:13
 AliHFEpidTPC.h:14
 AliHFEpidTPC.h:15
 AliHFEpidTPC.h:16
 AliHFEpidTPC.h:17
 AliHFEpidTPC.h:18
 AliHFEpidTPC.h:19
 AliHFEpidTPC.h:20
 AliHFEpidTPC.h:21
 AliHFEpidTPC.h:22
 AliHFEpidTPC.h:23
 AliHFEpidTPC.h:24
 AliHFEpidTPC.h:25
 AliHFEpidTPC.h:26
 AliHFEpidTPC.h:27
 AliHFEpidTPC.h:28
 AliHFEpidTPC.h:29
 AliHFEpidTPC.h:30
 AliHFEpidTPC.h:31
 AliHFEpidTPC.h:32
 AliHFEpidTPC.h:33
 AliHFEpidTPC.h:34
 AliHFEpidTPC.h:35
 AliHFEpidTPC.h:36
 AliHFEpidTPC.h:37
 AliHFEpidTPC.h:38
 AliHFEpidTPC.h:39
 AliHFEpidTPC.h:40
 AliHFEpidTPC.h:41
 AliHFEpidTPC.h:42
 AliHFEpidTPC.h:43
 AliHFEpidTPC.h:44
 AliHFEpidTPC.h:45
 AliHFEpidTPC.h:46
 AliHFEpidTPC.h:47
 AliHFEpidTPC.h:48
 AliHFEpidTPC.h:49
 AliHFEpidTPC.h:50
 AliHFEpidTPC.h:51
 AliHFEpidTPC.h:52
 AliHFEpidTPC.h:53
 AliHFEpidTPC.h:54
 AliHFEpidTPC.h:55
 AliHFEpidTPC.h:56
 AliHFEpidTPC.h:57
 AliHFEpidTPC.h:58
 AliHFEpidTPC.h:59
 AliHFEpidTPC.h:60
 AliHFEpidTPC.h:61
 AliHFEpidTPC.h:62
 AliHFEpidTPC.h:63
 AliHFEpidTPC.h:64
 AliHFEpidTPC.h:65
 AliHFEpidTPC.h:66
 AliHFEpidTPC.h:67
 AliHFEpidTPC.h:68
 AliHFEpidTPC.h:69
 AliHFEpidTPC.h:70
 AliHFEpidTPC.h:71
 AliHFEpidTPC.h:72
 AliHFEpidTPC.h:73
 AliHFEpidTPC.h:74
 AliHFEpidTPC.h:75
 AliHFEpidTPC.h:76
 AliHFEpidTPC.h:77
 AliHFEpidTPC.h:78
 AliHFEpidTPC.h:79
 AliHFEpidTPC.h:80
 AliHFEpidTPC.h:81
 AliHFEpidTPC.h:82
 AliHFEpidTPC.h:83
 AliHFEpidTPC.h:84
 AliHFEpidTPC.h:85
 AliHFEpidTPC.h:86
 AliHFEpidTPC.h:87
 AliHFEpidTPC.h:88
 AliHFEpidTPC.h:89
 AliHFEpidTPC.h:90
 AliHFEpidTPC.h:91
 AliHFEpidTPC.h:92
 AliHFEpidTPC.h:93
 AliHFEpidTPC.h:94
 AliHFEpidTPC.h:95
 AliHFEpidTPC.h:96
 AliHFEpidTPC.h:97
 AliHFEpidTPC.h:98
 AliHFEpidTPC.h:99
 AliHFEpidTPC.h:100
 AliHFEpidTPC.h:101
 AliHFEpidTPC.h:102
 AliHFEpidTPC.h:103
 AliHFEpidTPC.h:104
 AliHFEpidTPC.h:105
 AliHFEpidTPC.h:106
 AliHFEpidTPC.h:107
 AliHFEpidTPC.h:108
 AliHFEpidTPC.h:109
 AliHFEpidTPC.h:110
 AliHFEpidTPC.h:111
 AliHFEpidTPC.h:112
 AliHFEpidTPC.h:113
 AliHFEpidTPC.h:114
 AliHFEpidTPC.h:115
 AliHFEpidTPC.h:116
 AliHFEpidTPC.h:117
 AliHFEpidTPC.h:118
 AliHFEpidTPC.h:119
 AliHFEpidTPC.h:120
 AliHFEpidTPC.h:121
 AliHFEpidTPC.h:122
 AliHFEpidTPC.h:123
 AliHFEpidTPC.h:124
 AliHFEpidTPC.h:125
 AliHFEpidTPC.h:126
 AliHFEpidTPC.h:127
 AliHFEpidTPC.h:128
 AliHFEpidTPC.h:129
 AliHFEpidTPC.h:130
 AliHFEpidTPC.h:131
 AliHFEpidTPC.h:132
 AliHFEpidTPC.h:133
 AliHFEpidTPC.h:134
 AliHFEpidTPC.h:135
 AliHFEpidTPC.h:136