]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSPIDv1.h
Bug correction
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPIDv1.h
1 #ifndef ALIPHOSPIDV1_H
2 #define ALIPHOSPIDV1_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8
9 //_________________________________________________________________________
10 // Implementation version v1 of the PHOS particle identifier 
11 // Identification is based on information from CPV and EMC
12 // Oh yeah                 
13 //*-- Author: Yves Schutz (SUBATECH), Gustavo Conesa.
14
15 // --- ROOT system ---
16 class TVector3 ;
17 class TMatrix ;
18 class TPrincipal ;
19
20 // --- Standard library ---
21
22 // --- AliRoot header files ---
23 class AliPHOSEmcRecPoint ;
24 class AliPHOSCpvRecPoint ;
25
26 #include "AliPHOSPID.h"
27 #include "AliESDtrack.h"
28 class  AliPHOSPIDv1 : public AliPHOSPID {
29   
30 public:
31   
32   AliPHOSPIDv1() ;          // ctor   
33   AliPHOSPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
34   AliPHOSPIDv1(const AliPHOSPIDv1 & pid) ;          // cpy ctor            
35   
36   virtual ~AliPHOSPIDv1() ; // dtor
37   
38   virtual void Exec(Option_t *option);  // Does the job
39
40   //Get file name that contain the PCA
41   const TString GetFileNamePrincipal(TString particle) const;
42
43   //Get file name that contain PID parameters
44   const TString GetFileNameParameters()      const {return fFileNameParameters ;}
45
46   // Get number of rec.particles in this run
47   virtual Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}  
48
49
50   // Get PID parameters as they are defined in fParameters
51   Float_t GetParameterCalibration    (Int_t i)               const;
52   Float_t GetParameterCpv2Emc        (Int_t i, TString axis) const;
53   Float_t GetParameterTimeGate       (Int_t i)               const;
54   Float_t GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const  ;     
55   Float_t GetParameterPhotonBoundary (Int_t i)               const;
56   Float_t GetParameterPi0Boundary    (Int_t i)               const;
57
58   // Get energy-dependent PID parameters
59   Float_t GetCalibratedEnergy    (Float_t e)                 const;
60   Float_t GetCpv2EmcDistanceCut  (TString axis, Float_t e)   const ;
61   Float_t GetEllipseParameter    (TString particle, TString param, Float_t e) const;
62
63   // Set PID parameters to change appropriate element of fParameters
64   void SetParameterCalibration   (Int_t i, Float_t param);
65   void SetParameterCpv2Emc       (Int_t i, TString axis, Float_t cut)  ; 
66   void SetParameterTimeGate      (Int_t i, Float_t gate)  ; 
67   void SetParameterToCalculateEllipse(TString particle, TString param, Int_t i, Float_t value) ;
68   void SetParameterPhotonBoundary(Int_t i, Float_t param);
69   void SetParameterPi0Boundary   (Int_t i, Float_t param);
70
71   //Switch to "on flyght" mode, without writing to TreeR and file  
72   void SetWriting(const Bool_t toWrite = kFALSE){fWrite = toWrite;} 
73   void Print() const ; 
74
75   virtual const char * Version() const { return "pid-v1" ; }  
76
77   AliPHOSPIDv1 & operator = (const AliPHOSPIDv1 & /*pid*/) { return *this ;} 
78   
79 private:
80   
81   const TString BranchName() const ; 
82   virtual void  Init() ;
83   virtual void  InitParameters() ;
84   void          MakeRecParticles(void ) ;
85   void          MakePID(void) ;
86
87   //Functions to calculate the PID probability 
88   //  Double_t ChargedHadronDistProb(Double_t  x, Double_t y, Double_t * parg, Double_t * parl) ;
89   Double_t GausF   (Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b/(x*x)+c/x
90   Double_t GausPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
91   Double_t LandauF(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence  a+b/(x*x)+c/x
92  Double_t LandauPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
93  // Relative Distance CPV-EMC
94   Float_t GetDistance     (AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv, Option_t * axis)const ; 
95   Int_t   GetCPVBit       (AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv, Int_t EffPur, Float_t e) const;
96   Int_t   GetPrincipalBit (TString particle, const Double_t* P, Int_t EffPur, Float_t e)const ; //Principal cut
97   Int_t   GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const;
98   Int_t   GetHardPi0Bit   (AliPHOSEmcRecPoint * emc) const;
99   TVector3      GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv)const ;
100   void          PrintRecParticles(Option_t * option) ;
101   virtual void  WriteRecParticles() ; 
102   void          SetParameters() ; //Fills the matrix of parameters
103   void          Unload(); 
104
105   //Do bayesian PID
106   void SetBayesianPID(Bool_t set){ fBayesian = set ;}
107   //PID population
108   void SetInitPID(const Double_t * pid) ;
109   void GetInitPID(Double_t * pid) const ;
110
111 private:
112   Bool_t      fBayesian ;                 //  Do PID bayesian
113   Bool_t      fDefaultInit;              //! kTRUE if the task was created by defaut ctor (only parameters are initialized)
114   Bool_t      fWrite ;                   //! To write result to file 
115   Int_t       fNEvent ;                  //! current event number
116   TString     fFileNamePrincipalPhoton ; //  File name of the photon principals
117   TString     fFileNamePrincipalPi0 ;    //  File name of the pi0 principals
118   TString     fFileNameParameters ;      //  File name with PID parameters
119   TPrincipal *fPrincipalPhoton ;         //! TPrincipal from photon pca file 
120   TPrincipal *fPrincipalPi0 ;            //! TPrincipal from pi0 pca file 
121   Double_t   *fX ;                       //! Shower shape for the principal data 
122   Double_t   *fPPhoton ;                 //! Principal photon eigenvalues
123   Double_t   *fPPi0 ;                    //! Principal pi0 eigenvalues
124   Int_t       fRecParticlesInRun ;       //! Total number of recparticles in one run
125   TMatrix    *fParameters;               //! Matrix of identification Parameters
126
127   //Initial pid population
128   Double_t fInitPID[AliESDtrack::kSPECIESN] ;
129   // pid probability function parameters
130   // ToF
131   Double_t fTphoton[3] ;                // gaussian tof response for photon
132   TFormula * fTFphoton ;                // the formula   
133 /*   Double_t fTelectron[3] ;              // gaussian tof response for electrons */
134 /*   TFormula * fTFelectron ;              // the formula */
135 /*   Double_t fTmuon[3] ;                  // gaussian tof response for muon */
136 /*   TFormula * fTFmuon ;                  // the formula */
137   Double_t fTpiong[3] ;                 // gaussian tof response for pions
138   TFormula * fTFpiong ;                 // the formula
139 /*   Double_t fTpionl[3] ;                 // gaussian tof response for pions */
140 /*   TFormula * fTFpionl ;                 // the formula    */
141   Double_t fTkaong[3] ;                 // landau tof response for kaons
142   TFormula * fTFkaong ;                 // the formula
143   Double_t fTkaonl[3] ;                 // landau tof response for kaons
144   TFormula * fTFkaonl ;                 // the formula
145   Double_t fThhadrong[3] ;              // gaus   tof response for heavy hadrons
146   TFormula * fTFhhadrong ;              // the formula
147   Double_t fThhadronl[3] ;              // landau   tof response for heavy hadrons
148   TFormula * fTFhhadronl ;              // the formula
149  /*  Double_t fTpion[9] ;                     // gaussian tof response for pions */
150 /*   Double_t fTkaon[9] ;                     // landau tof response for kaons */
151 /*   Double_t fThhadron[9] ;                  // landau tof response for nucleons */
152
153   //Shower dispersion
154   Double_t fDmuon[3] ;                   // gaussian ss response for muon 
155   TFormula * fDFmuon ;                   // the formula 
156   Double_t fDphoton[9] ;                 // gaussian ss response for EM
157   Double_t fDpi0[9] ;                    // gaussian ss response for pi0
158   Double_t fDhadron[9] ;                 // gaussian ss response for hadrons
159
160                    // gaussian ss response for muons
161   //CPV-EMCAL distance
162   Double_t fCPVelectron[9] ;   // gaussian emc-cpv distance response for electron
163   Double_t fCPVcharged[9]  ;   // landau emc-cpv distance response for charged part (no elect) */
164 /*   Double_t fCPVchargedg[9] ;         // gaussian emc-cpv distance response for charged part (no elect) */
165 /*   Double_t fCPVchargedl[9] ;         // landau emc-cpv distance response for charged part (no elect) */
166
167   ClassDef( AliPHOSPIDv1,10)  // Particle identifier implementation version 1
168
169 };
170
171 #endif // AliPHOSPIDV1_H