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