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