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