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