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