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