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