- Reshuffling of the particle codes in AliPID. Now the light nuclei are between the
[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 Float_t       ParticleMass(Int_t iType) {
48      if(!fgkParticleMass[0]) Init(); 
49      return fgkParticleMass[iType];
50   }
51   static Float_t       ParticleMassZ(Int_t iType) {
52      if(!fgkParticleMass[0]) Init(); 
53      return fgkParticleMassZ[iType];
54   }
55   static Int_t         ParticleCharge(Int_t iType){
56     if(!fgkParticleMass[0]) Init();
57     if (iType<0||iType>=kSPECIESC) return 0;
58     return TMath::Nint(fgkParticleMass[iType]/fgkParticleMassZ[iType]);
59   }
60   static const char*   ParticleName(Int_t iType) 
61     {return fgkParticleName[iType];};
62   static const char*   ParticleShortName(Int_t iType) 
63     {return fgkParticleShortName[iType];};
64   static const char*   ParticleLatexName(Int_t iType) 
65     {return fgkParticleLatexName[iType];};
66   static Int_t         ParticleCode(Int_t iType) 
67     {return fgkParticleCode[iType];};
68
69   AliPID();
70   AliPID(const Double_t* probDensity, Bool_t charged = kTRUE);
71   AliPID(const Float_t* probDensity, Bool_t charged = kTRUE);
72   AliPID(const AliPID& pid);
73   AliPID& operator = (const AliPID& pid);
74
75   Double_t             GetProbability(EParticleType iType,
76                                       const Double_t* prior) const;
77   Double_t             GetProbability(EParticleType iType) const;
78   void                 GetProbabilities(Double_t* probabilities,
79                                         const Double_t* prior) const;
80   void                 GetProbabilities(Double_t* probabilities) const;
81   EParticleType        GetMostProbable(const Double_t* prior) const;
82   EParticleType        GetMostProbable() const;
83   
84   void                 SetProbabilities(const Double_t* probabilities,
85                                         Bool_t charged = kTRUE);
86
87   static void          SetPriors(const Double_t* prior,
88                                  Bool_t charged = kTRUE);
89   static void          SetPrior(EParticleType iType, Double_t prior);
90
91   AliPID&              operator *= (const AliPID& pid);
92
93  private:
94
95   static void          Init();
96
97   Bool_t               fCharged;                           // flag for charged/neutral
98   Double_t             fProbDensity[kSPECIESCN];           // probability densities
99   static Double_t      fgPrior[kSPECIESCN];                // a priori probabilities
100
101   static /*const*/ Float_t fgkParticleMass[kSPECIESCN+1];  // particle masses
102   static /*const*/ Float_t fgkParticleMassZ[kSPECIESCN+1]; // particle masses/charge
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, 3)                                      // particle id probability densities
109 };
110
111
112 AliPID operator * (const AliPID& pid1, const AliPID& pid2);
113
114
115 #endif