Bug correction
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPIDv1.h
CommitLineData
26d4b141 1#ifndef ALIPHOSPIDV1_H
2#define ALIPHOSPIDV1_H
6ad0bfa0 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
b2a60966 8
9//_________________________________________________________________________
10// Implementation version v1 of the PHOS particle identifier
148b2bba 11// Identification is based on information from CPV and EMC
2f04ed65 12// Oh yeah
148b2bba 13//*-- Author: Yves Schutz (SUBATECH), Gustavo Conesa.
6ad0bfa0 14
15// --- ROOT system ---
7acf6008 16class TVector3 ;
e3817e5f 17class TMatrix ;
148b2bba 18class TPrincipal ;
6ad0bfa0 19
20// --- Standard library ---
21
22// --- AliRoot header files ---
7acf6008 23class AliPHOSEmcRecPoint ;
8d4608b5 24class AliPHOSCpvRecPoint ;
6ad0bfa0 25
26d4b141 26#include "AliPHOSPID.h"
35adb638 27#include "AliESDtrack.h"
26d4b141 28class AliPHOSPIDv1 : public AliPHOSPID {
50739f15 29
e3817e5f 30public:
50739f15 31
88cb7938 32 AliPHOSPIDv1() ; // ctor
e191bb57 33 AliPHOSPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
88cb7938 34 AliPHOSPIDv1(const AliPHOSPIDv1 & pid) ; // cpy ctor
e3817e5f 35
7acf6008 36 virtual ~AliPHOSPIDv1() ; // dtor
50739f15 37
eabde521 38 virtual void Exec(Option_t *option); // Does the job
e3817e5f 39
40 //Get file name that contain the PCA
41 const TString GetFileNamePrincipal(TString particle) const;
42
43 //Get file name that contain PID parameters
44 const TString GetFileNameParameters() const {return fFileNameParameters ;}
45
46 // Get number of rec.particles in this run
fc7e2f43 47 virtual Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}
e3817e5f 48
35adb638 49
e3817e5f 50 // Get PID parameters as they are defined in fParameters
fc7e2f43 51 Float_t GetParameterCalibration (Int_t i) const;
52 Float_t GetParameterCpv2Emc (Int_t i, TString axis) const;
53 Float_t GetParameterTimeGate (Int_t i) const;
54 Float_t GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const ;
55 Float_t GetParameterPhotonBoundary (Int_t i) const;
56 Float_t GetParameterPi0Boundary (Int_t i) const;
e3817e5f 57
58 // Get energy-dependent PID parameters
fc7e2f43 59 Float_t GetCalibratedEnergy (Float_t e) const;
60 Float_t GetCpv2EmcDistanceCut (TString axis, Float_t e) const ;
61 Float_t GetEllipseParameter (TString particle, TString param, Float_t e) const;
e3817e5f 62
63 // Set PID parameters to change appropriate element of fParameters
64 void SetParameterCalibration (Int_t i, Float_t param);
65 void SetParameterCpv2Emc (Int_t i, TString axis, Float_t cut) ;
66 void SetParameterTimeGate (Int_t i, Float_t gate) ;
67 void SetParameterToCalculateEllipse(TString particle, TString param, Int_t i, Float_t value) ;
68 void SetParameterPhotonBoundary(Int_t i, Float_t param);
69 void SetParameterPi0Boundary (Int_t i, Float_t param);
70
adcca1e6 71 //Switch to "on flyght" mode, without writing to TreeR and file
72 void SetWriting(const Bool_t toWrite = kFALSE){fWrite = toWrite;}
88cb7938 73 void Print() const ;
e3817e5f 74
8e8eae84 75 virtual const char * Version() const { return "pid-v1" ; }
e3817e5f 76
8c140292 77 AliPHOSPIDv1 & operator = (const AliPHOSPIDv1 & /*pid*/) { return *this ;}
e3817e5f 78
79private:
50739f15 80
c6987a88 81 const TString BranchName() const ;
e3817e5f 82 virtual void Init() ;
83 virtual void InitParameters() ;
84 void MakeRecParticles(void ) ;
35adb638 85 void MakePID(void) ;
86
87 //Functions to calculate the PID probability
88 // Double_t ChargedHadronDistProb(Double_t x, Double_t y, Double_t * parg, Double_t * parl) ;
89 Double_t GausF (Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b/(x*x)+c/x
90 Double_t GausPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
91 Double_t LandauF(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b/(x*x)+c/x
92 Double_t LandauPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
2cc71c1e 93 // Relative Distance CPV-EMC
8d4608b5 94 Float_t GetDistance (AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv, Option_t * axis)const ;
95 Int_t GetCPVBit (AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv, Int_t EffPur, Float_t e) const;
fc7e2f43 96 Int_t GetPrincipalBit (TString particle, const Double_t* P, Int_t EffPur, Float_t e)const ; //Principal cut
97 Int_t GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const;
98 Int_t GetHardPi0Bit (AliPHOSEmcRecPoint * emc) const;
8d4608b5 99 TVector3 GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv)const ;
e3817e5f 100 void PrintRecParticles(Option_t * option) ;
90cceaf6 101 virtual void WriteRecParticles() ;
e3817e5f 102 void SetParameters() ; //Fills the matrix of parameters
adcca1e6 103 void Unload();
e3817e5f 104
35adb638 105 //Do bayesian PID
106 void SetBayesianPID(Bool_t set){ fBayesian = set ;}
107 //PID population
108 void SetInitPID(const Double_t * pid) ;
109 void GetInitPID(Double_t * pid) const ;
e3817e5f 110
35adb638 111private:
112 Bool_t fBayesian ; // Do PID bayesian
e3817e5f 113 Bool_t fDefaultInit; //! kTRUE if the task was created by defaut ctor (only parameters are initialized)
adcca1e6 114 Bool_t fWrite ; //! To write result to file
e3817e5f 115 Int_t fNEvent ; //! current event number
116 TString fFileNamePrincipalPhoton ; // File name of the photon principals
117 TString fFileNamePrincipalPi0 ; // File name of the pi0 principals
118 TString fFileNameParameters ; // File name with PID parameters
119 TPrincipal *fPrincipalPhoton ; //! TPrincipal from photon pca file
120 TPrincipal *fPrincipalPi0 ; //! TPrincipal from pi0 pca file
121 Double_t *fX ; //! Shower shape for the principal data
122 Double_t *fPPhoton ; //! Principal photon eigenvalues
123 Double_t *fPPi0 ; //! Principal pi0 eigenvalues
124 Int_t fRecParticlesInRun ; //! Total number of recparticles in one run
125 TMatrix *fParameters; //! Matrix of identification Parameters
cc1fe362 126
35adb638 127 //Initial pid population
128 Double_t fInitPID[AliESDtrack::kSPECIESN] ;
129 // pid probability function parameters
130 // ToF
131 Double_t fTphoton[3] ; // gaussian tof response for photon
132 TFormula * fTFphoton ; // the formula
133/* Double_t fTelectron[3] ; // gaussian tof response for electrons */
134/* TFormula * fTFelectron ; // the formula */
135/* Double_t fTmuon[3] ; // gaussian tof response for muon */
136/* TFormula * fTFmuon ; // the formula */
137 Double_t fTpiong[3] ; // gaussian tof response for pions
138 TFormula * fTFpiong ; // the formula
139/* Double_t fTpionl[3] ; // gaussian tof response for pions */
140/* TFormula * fTFpionl ; // the formula */
141 Double_t fTkaong[3] ; // landau tof response for kaons
142 TFormula * fTFkaong ; // the formula
143 Double_t fTkaonl[3] ; // landau tof response for kaons
144 TFormula * fTFkaonl ; // the formula
145 Double_t fThhadrong[3] ; // gaus tof response for heavy hadrons
146 TFormula * fTFhhadrong ; // the formula
147 Double_t fThhadronl[3] ; // landau tof response for heavy hadrons
148 TFormula * fTFhhadronl ; // the formula
149 /* Double_t fTpion[9] ; // gaussian tof response for pions */
150/* Double_t fTkaon[9] ; // landau tof response for kaons */
151/* Double_t fThhadron[9] ; // landau tof response for nucleons */
152
153 //Shower dispersion
154 Double_t fDmuon[3] ; // gaussian ss response for muon
155 TFormula * fDFmuon ; // the formula
156 Double_t fDphoton[9] ; // gaussian ss response for EM
157 Double_t fDpi0[9] ; // gaussian ss response for pi0
158 Double_t fDhadron[9] ; // gaussian ss response for hadrons
159
160 // gaussian ss response for muons
161 //CPV-EMCAL distance
162 Double_t fCPVelectron[9] ; // gaussian emc-cpv distance response for electron
163 Double_t fCPVcharged[9] ; // landau emc-cpv distance response for charged part (no elect) */
164/* Double_t fCPVchargedg[9] ; // gaussian emc-cpv distance response for charged part (no elect) */
165/* Double_t fCPVchargedl[9] ; // landau emc-cpv distance response for charged part (no elect) */
cc1fe362 166
167 ClassDef( AliPHOSPIDv1,10) // Particle identifier implementation version 1
6ad0bfa0 168
169};
170
26d4b141 171#endif // AliPHOSPIDV1_H