Modifications needed to use PID framework based mass during tracking and
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliPID.h
1 #ifndef ALIPID_H
2 #define ALIPID_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 ///////////////////////////////////////////////////////////////////////////////
8 ///                                                                          //
9 /// particle id probability densities                                        //
10 ///                                                                          //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 /* $Id$ */
14
15
16 #include <TObject.h>
17 #include <TMath.h>
18
19 class AliPID : public TObject {
20  public:
21   enum {
22     kSPECIES = 5,     // Number of default particle species recognized by the PID
23     kSPECIESC = 9,    // Number of default particles + light nuclei recognized by the PID
24     kSPECIESCN = 14,  // Number of charged+neutral particle species recognized by the PHOS/EMCAL PID
25   };
26   enum EParticleType {
27     kElectron = 0, 
28     kMuon = 1, 
29     kPion = 2, 
30     kKaon = 3, 
31     kProton = 4, 
32
33     kDeuteron = 5,
34     kTriton = 6,
35     kHe3 = 7,
36     kAlpha = 8,
37     
38     kPhoton = 9,
39     kPi0 = 10, 
40     kNeutron = 11, 
41     kKaon0 = 12, 
42     kEleCon = 13,
43     
44     kUnknown = 14
45   };
46   
47   static Int_t         ParticleCharge(Int_t iType) {
48      if(!fgkParticleMass[0]) Init(); 
49      return fgkParticleCharge[iType];
50   }
51   static Float_t       ParticleMass(Int_t iType) {
52      if(!fgkParticleMass[0]) Init(); 
53      return fgkParticleMass[iType];
54   }
55   static Float_t       ParticleMassZ(Int_t iType) {
56      if(!fgkParticleMass[0]) Init(); 
57      return fgkParticleMassZ[iType];
58   }
59   static const char*   ParticleName(Int_t iType) 
60     {return fgkParticleName[iType];};
61   static const char*   ParticleShortName(Int_t iType) 
62     {return fgkParticleShortName[iType];};
63   static const char*   ParticleLatexName(Int_t iType) 
64     {return fgkParticleLatexName[iType];};
65   static Int_t         ParticleCode(Int_t iType) 
66     {return fgkParticleCode[iType];};
67
68   AliPID();
69   AliPID(const Double_t* probDensity, Bool_t charged = kTRUE);
70   AliPID(const Float_t* probDensity, Bool_t charged = kTRUE);
71   AliPID(const AliPID& pid);
72   AliPID& operator = (const AliPID& pid);
73
74   Double_t             GetProbability(EParticleType iType,
75                                       const Double_t* prior) const;
76   Double_t             GetProbability(EParticleType iType) const;
77   void                 GetProbabilities(Double_t* probabilities,
78                                         const Double_t* prior) const;
79   void                 GetProbabilities(Double_t* probabilities) const;
80   EParticleType        GetMostProbable(const Double_t* prior) const;
81   EParticleType        GetMostProbable() const;
82   
83   void                 SetProbabilities(const Double_t* probabilities,
84                                         Bool_t charged = kTRUE);
85
86   static void          SetPriors(const Double_t* prior,
87                                  Bool_t charged = kTRUE);
88   static void          SetPrior(EParticleType iType, Double_t prior);
89
90   AliPID&              operator *= (const AliPID& pid);
91
92  private:
93
94   static void          Init();
95
96   Bool_t               fCharged;                           // flag for charged/neutral
97   Double_t             fProbDensity[kSPECIESCN];           // probability densities
98   static Double_t      fgPrior[kSPECIESCN];                // a priori probabilities
99
100   static /*const*/ Float_t fgkParticleMass[kSPECIESCN+1];  // particle masses
101   static /*const*/ Float_t fgkParticleMassZ[kSPECIESCN+1]; // particle masses/charge
102   static /*const*/ Char_t  fgkParticleCharge[kSPECIESCN+1]; // particle charge (in e units!)
103   static const char*   fgkParticleName[kSPECIESCN+1];      // particle names
104   static const char*   fgkParticleShortName[kSPECIESCN+1]; // particle names
105   static const char*   fgkParticleLatexName[kSPECIESCN+1]; // particle names
106   static const Int_t   fgkParticleCode[kSPECIESCN+1];      // particle codes
107
108   ClassDef(AliPID, 4)                                      // particle id probability densities
109 };
110
111
112 AliPID operator * (const AliPID& pid1, const AliPID& pid2);
113
114
115 #endif