]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSPIDv1.h
Bug fix
[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 /* History of cvs commits:
9  *
10  * $Log$
11  * Revision 1.59  2007/03/06 06:57:46  kharlov
12  * DP:calculation of distance to CPV done in TSM
13  *
14  * Revision 1.58  2006/04/12 11:32:03  alibrary
15  * Simplification of Makefile and some small corrections
16  *
17  * Revision 1.57  2006/01/23 17:51:48  hristov
18  * Using the recommended way of forward declarations for TVector and TMatrix (see v5-08-00 release notes). Additional clean-up
19  *
20  * Revision 1.56  2005/05/28 14:19:04  schutz
21  * Compilation warnings fixed by T.P.
22  *
23  */
24
25 //_________________________________________________________________________
26 // Implementation version v1 of the PHOS particle identifier 
27 // Identification is based on information from CPV and EMC
28 // Oh yeah                 
29 //*-- Author: Yves Schutz (SUBATECH), Gustavo Conesa.
30
31 // --- Standard library ---
32
33 // --- ROOT system ---
34 class TCanvas ;
35 class TFolder ;
36 class TFormula;
37 class TPrincipal ;
38 class TROOT ;
39 class TTree ;
40 class TVector3 ;
41 #include <TMatrixDfwd.h>
42
43 // --- AliRoot header files ---
44 class AliPHOSClusterizerv1 ;
45 class AliPHOSCpvRecPoint ;
46 class AliPHOSEmcRecPoint ;
47 class AliPHOSTrackSegment ;
48 class AliPHOSTrackSegmentMakerv1 ;
49 #include "AliPHOSPID.h"
50 #include "AliPID.h"
51
52 class  AliPHOSPIDv1 : public AliPHOSPID {
53   
54 public:
55   
56   AliPHOSPIDv1() ;          // ctor   
57   AliPHOSPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
58   AliPHOSPIDv1(const AliPHOSPIDv1 & pid) ;          // cpy ctor            
59   
60   virtual ~AliPHOSPIDv1() ; // dtor
61   
62   virtual void Exec(Option_t *option);  // Does the job
63
64   //Get file name that contain the PCA
65   const TString GetFileNamePrincipal(TString particle) const;
66
67   //Get file name that contain PID parameters
68   const TString GetFileNameParameters()      const {return fFileNameParameters ;}
69
70   // Get number of rec.particles in this run
71   virtual Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}  
72
73
74   // Get PID parameters as they are defined in fParameters
75   Float_t GetParameterCalibration    (Int_t i)               const;
76   Float_t GetParameterCpv2Emc        (Int_t i, TString axis) const;
77   Float_t GetParameterTimeGate       (Int_t i)               const;
78   Float_t GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const  ;     
79   Float_t GetParameterPhotonBoundary (Int_t i)               const;
80   Float_t GetParameterPi0Boundary    (Int_t i)               const;
81
82   // Get energy-dependent PID parameters
83   Float_t GetCalibratedEnergy    (Float_t e)                 const;
84   Float_t GetCpv2EmcDistanceCut  (TString axis, Float_t e)   const ;
85   Float_t GetEllipseParameter    (TString particle, TString param, Float_t e) const;
86
87   Double_t GetThresholdChargedNeutral () const {return  fChargedNeutralThreshold;}
88   Float_t GetTOFEnergyThreshold () const {return  fTOFEnThreshold;}
89   Float_t GetDispersionEnergyThreshold () const {return  fDispEnThreshold;}
90   Int_t   GetDispersionMultiplicityThreshold () const {return  fDispMultThreshold;}
91
92   //Do bayesian PID
93   void SetBayesianPID(Bool_t set){ fBayesian = set ;}
94
95   // Set PID parameters to change appropriate element of fParameters
96   void SetParameterCalibration   (Int_t i, Float_t param);
97   void SetParameterCpv2Emc       (Int_t i, TString axis, Float_t cut)  ; 
98   void SetParameterTimeGate      (Int_t i, Float_t gate)  ; 
99   void SetParameterToCalculateEllipse(TString particle, TString param, Int_t i, Float_t value) ;
100   void SetParameterPhotonBoundary(Int_t i, Float_t param);
101   void SetParameterPi0Boundary   (Int_t i, Float_t param);
102
103   void SetThresholdChargedNeutral (Double_t th) {fChargedNeutralThreshold = th;}
104   void SetTOFEnergyThreshold (Float_t th)  {fTOFEnThreshold = th;}
105   void SetDispersionEnergyThreshold (Float_t th) {fDispEnThreshold = th;}
106   void SetDispersionMultiplicityThreshold (Int_t th)  {fDispMultThreshold = th;}
107
108   //Switch to "on flyght" mode, without writing to TreeR and file  
109   void SetWriting(Bool_t toWrite = kFALSE){fWrite = toWrite;} 
110   void Print(const Option_t * = "") const ; 
111
112   void GetVertex(void) ; //Extracts vertex in current event
113
114   virtual const char * Version() const { return "pid-v1" ; }  
115
116   AliPHOSPIDv1 & operator = (const AliPHOSPIDv1 & /*pid*/) { return *this ;} 
117   
118 private:
119   
120   const TString BranchName() const ; 
121   virtual void  Init() ;
122   virtual void  InitParameters() ;
123   void          MakeRecParticles(void ) ;
124   void          MakePID(void) ;
125
126   //Functions to calculate the PID probability 
127   //  Double_t ChargedHadronDistProb(Double_t  x, Double_t y, Double_t * parg, Double_t * parl) ;
128   Double_t GausF   (Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b/(x*x)+c/x
129   Double_t GausPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
130   Double_t LandauF(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence  a+b/(x*x)+c/x
131   Double_t LandauPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
132  // Relative Distance CPV-EMC
133   Int_t   GetCPVBit       (AliPHOSTrackSegment * ts, Int_t EffPur, Float_t e) const;
134   Int_t   GetPrincipalBit (TString particle, const Double_t* P, Int_t EffPur, Float_t e)const ; //Principal cut
135   Int_t   GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const;
136   Int_t   GetHardPi0Bit   (AliPHOSEmcRecPoint * emc) const;
137   TVector3      GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv)const ;
138   void          PrintRecParticles(Option_t * option) ;
139   virtual void  WriteRecParticles() ; 
140   void          SetParameters() ; //Fills the matrix of parameters
141   void          Unload(); 
142
143   //PID population
144   void SetInitPID(const Double_t * pid) ;
145   void GetInitPID(Double_t * pid) const ;
146
147 private:
148   Bool_t      fBayesian ;                 //  Do PID bayesian
149   Bool_t      fDefaultInit;              //! kTRUE if the task was created by defaut ctor (only parameters are initialized)
150   Bool_t      fWrite ;                   //! To write result to file 
151   Int_t       fNEvent ;                  //! current event number
152   TString     fFileNamePrincipalPhoton ; //  File name of the photon principals
153   TString     fFileNamePrincipalPi0 ;    //  File name of the pi0 principals
154   TString     fFileNameParameters ;      //  File name with PID parameters
155   TPrincipal *fPrincipalPhoton ;         //! TPrincipal from photon pca file 
156   TPrincipal *fPrincipalPi0 ;            //! TPrincipal from pi0 pca file 
157   Double_t   *fX ;                       //! Shower shape for the principal data 
158   Double_t   *fPPhoton ;                 //! Principal photon eigenvalues
159   Double_t   *fPPi0 ;                    //! Principal pi0 eigenvalues
160   Int_t       fRecParticlesInRun ;       //! Total number of recparticles in one run
161   TMatrixF    *fParameters;               //! Matrix of identification Parameters
162
163   TVector3   fVtx ;                      //! Vertex position in current event
164
165   //Initial pid population
166   Double_t fInitPID[AliPID::kSPECIESN] ; // Initial population to do bayesian PID
167   // pid probability function parameters
168   // ToF
169   Double_t fTphoton[3] ;       // gaussian tof response for photon
170   TFormula * fTFphoton ;       // the formula   
171   Double_t fTpiong[3] ;        // gaussian tof response for pions
172   TFormula * fTFpiong ;        // the formula
173   Double_t fTkaong[3] ;        // landau tof response for kaons
174   TFormula * fTFkaong ;        // the formula
175   Double_t fTkaonl[3] ;        // landau tof response for kaons
176   TFormula * fTFkaonl ;        // the formula
177   Double_t fThhadrong[3] ;     // gaus   tof response for heavy hadrons
178   TFormula * fTFhhadrong ;     // the formula
179   Double_t fThhadronl[3] ;     // landau   tof response for heavy hadrons
180   TFormula * fTFhhadronl ;     // the formula
181
182   //Shower dispersion
183   Double_t fDmuon[3]    ;     // gaussian ss response for muon 
184   TFormula * fDFmuon    ;     // the formula 
185   Double_t fDphoton[10] ;     // gaussian ss response for EM
186   Double_t fDpi0[10]    ;     // gaussian ss response for pi0
187   Double_t fDhadron[10] ;     // gaussian ss response for hadrons
188
189   Double_t fXelectron[10] ;   // gaussian emc-cpv distance response for electron
190   Double_t fXcharged[10]  ;   // landau emc-cpv distance response for charged part (no elect) */
191   Double_t fZelectron[10] ;   // gaussian emc-cpv distance response for electron
192   Double_t fZcharged[10]  ;   // landau emc-cpv distance response for charged part (no elect) */
193
194
195   Double_t fERecWeightPar[4] ;  // gaussian tof response for photon
196   TFormula * fERecWeight ;      // the formula   
197   Double_t fChargedNeutralThreshold ; //Threshold to differentiate between charged and neutral
198   Float_t  fTOFEnThreshold;           //Maximum energy to use TOF
199   Float_t  fDispEnThreshold;          //Minimum energy to use shower shape
200   Int_t    fDispMultThreshold ;       //Minimum multiplicity to use shower shape
201
202   ClassDef( AliPHOSPIDv1,12)  // Particle identifier implementation version 1
203
204 };
205
206 #endif // AliPHOSPIDV1_H