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