]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSPIDv1.h
Additional protection (Yu.Belikov)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPIDv1.h
index 704b630b5f09a9d9c4e38764f0d67875d2e26889..7a29aea56b8b7661dcdbb1ee37428db2730c922d 100644 (file)
 //*-- Author: Yves Schutz (SUBATECH), Gustavo Conesa.
 
 // --- ROOT system ---
-//class TFormula ;
 class TVector3 ;
-class TMatrixD ;
+class TMatrix ;
 class TPrincipal ;
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 class AliPHOSEmcRecPoint ;
-class AliPHOSRecPoint ;
+class AliPHOSCpvRecPoint ;
 
 #include "AliPHOSPID.h"
-
+#include "AliESDtrack.h"
 class  AliPHOSPIDv1 : public AliPHOSPID {
-
+  
 public:
-
-  AliPHOSPIDv1() ;          // ctor            
-  AliPHOSPIDv1(const char* headerFile, const char * tsBranch = "Default", const char * from = 0) ;
-   
+  
+  AliPHOSPIDv1() ;          // ctor   
+  AliPHOSPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
+  AliPHOSPIDv1(const AliPHOSPIDv1 & pid) ;          // cpy ctor            
+  
   virtual ~AliPHOSPIDv1() ; // dtor
+  
+  virtual void Exec(Option_t *option);  // Does the job
+
+  //Get file name that contain the PCA
+  const TString GetFileNamePrincipal(TString particle) const;
+
+  //Get file name that contain PID parameters
+  const TString GetFileNameParameters()      const {return fFileNameParameters ;}
+
+  // Get number of rec.particles in this run
+  virtual Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}  
+
+
+  // Get PID parameters as they are defined in fParameters
+  Float_t GetParameterCalibration    (Int_t i)               const;
+  Float_t GetParameterCpv2Emc        (Int_t i, TString axis) const;
+  Float_t GetParameterTimeGate       (Int_t i)               const;
+  Float_t GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const  ;     
+  Float_t GetParameterPhotonBoundary (Int_t i)               const;
+  Float_t GetParameterPi0Boundary    (Int_t i)               const;
+
+  // Get energy-dependent PID parameters
+  Float_t GetCalibratedEnergy    (Float_t e)                 const;
+  Float_t GetCpv2EmcDistanceCut  (TString axis, Float_t e)   const ;
+  Float_t GetEllipseParameter    (TString particle, TString param, Float_t e) const;
+
+  // Set PID parameters to change appropriate element of fParameters
+  void SetParameterCalibration   (Int_t i, Float_t param);
+  void SetParameterCpv2Emc       (Int_t i, TString axis, Float_t cut)  ; 
+  void SetParameterTimeGate      (Int_t i, Float_t gate)  ; 
+  void SetParameterToCalculateEllipse(TString particle, TString param, Int_t i, Float_t value) ;
+  void SetParameterPhotonBoundary(Int_t i, Float_t param);
+  void SetParameterPi0Boundary   (Int_t i, Float_t param);
+
+  //Switch to "on flyght" mode, without writing to TreeR and file  
+  void SetWriting(const Bool_t toWrite = kFALSE){fWrite = toWrite;} 
+  void Print() const ; 
 
-  virtual void Exec(Option_t * option) ;
-  virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;}      
-  virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); }
-  virtual const Int_t GetRecParticlesInRun() const  {return fRecParticlesInRun ;}  
-  virtual void Print(Option_t * option) const {}
-  void Print() ; 
-  // Get CpvtoEmcDistanceCut and TimeGate parameters depending on the custer energy and 
-  // Purity-Efficiency point (possible options "HIGH EFFICIENCY" "MEDIUM EFFICIENCY" "LOW  
-  // EFFICIENCY" and 3 more options changing EFFICIENCY by PURITY)
-  Double_t GetCpvtoEmcDistanceCut(const Float_t Cluster_En, const TString Eff_Pur)  ;
-  Double_t GetTimeGate(const Float_t Cluster_En, const TString Eff_Pur)  ;
-
-  //Get files that contain the PCA
-  const TString GetPrincipalFile5( )const {return fFileName5 ;}
-  const TString GetPrincipalFilePar5( )const {return fFileNamePar5 ;}
-  const TString GetPrincipalFile100( )const {return fFileName100 ;}
-  const TString GetPrincipalFilePar100( )const {return fFileNamePar100 ;}
-
-  // Set all parameters necessary in the PID depending on the custer energy and 
-  // Purity-Efficiency point (possible options "HIGH EFFICIENCY" "MEDIUM EFFICIENCY" "LOW  
-  // EFFICIENCY" and 3 more options changing EFFICIENCY by PURITY)
-  void SetCpvtoEmcDistanceCut(Float_t Cluster_En, TString Eff_Pur, Float_t cut)  ; 
-  void SetTimeGate(Float_t Cluster_En, TString Eff_Pur, Float_t gate)  ; 
-  void SetEllipseXCenter(Float_t Cluster_En, TString Eff_Pur, Float_t x)  ;    
-  void SetEllipseYCenter(Float_t Cluster_En, TString Eff_Pur, Float_t y)  ;   
-  void SetEllipseAParameter(Float_t Cluster_En, TString Eff_Pur, Float_t a)  ;  
-  void SetEllipseBParameter(Float_t Cluster_En, TString Eff_Pur, Float_t b)  ; 
-  void SetEllipseAngle(Float_t Cluster_En, TString Eff_Pur, Float_t angle)  ;    
-  void SetEllipseParameters(Float_t Cluster_En, TString Eff_Pur, Float_t x, Float_t y,Float_t a, Float_t b,Float_t angle) ;  
-  //Get and Set energy calibration parameters
-  Float_t GetACalParameter() {return fACalParameter ;}
-  Float_t GetBCalParameter() {return fBCalParameter ;}
-  Float_t GetCCalParameter() {return fCCalParameter ;}
-  void SetACalParameter(Float_t a) { fACalParameter = a ;}
-  void SetBCalParameter(Float_t b) { fBCalParameter = b ;}
-  void SetCCalParameter(Float_t c) { fCCalParameter = c ;}
-
-
-  Float_t GetEnergyAnalysisCut() {return  fEnergyAnalysisCut ;}
-  void SetEnergyAnalysisCut(Float_t e) {  fEnergyAnalysisCut = e ;}
-
-  virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
-  virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;} 
   virtual const char * Version() const { return "pid-v1" ; }  
-  
- private:
 
-  const TString BranchName() const ; 
-  virtual void Init() ;
-  virtual void InitParameters() ;
-  void     MakeRecParticles(void ) ;
-  // Relative Distance CPV-EMC
-  Float_t  GetDistance(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv, Option_t * Axis)const ; 
-  Int_t    GetPrincipalSign(Double_t* P, Int_t ell, Int_t eff_pur)const ; //Principal cut
-  TVector3 GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const ;
-  void     PrintRecParticles(Option_t * option) ;
-  // Gives in wich cluster energy range is the event
-  void     GetClusterOption(const Float_t Cluster_En,const Bool_t range) ;
-  // Gives the Efficiency-Purity point.
-  Int_t    GetEffPurOption(const TString Eff_Pur)const ;
-  virtual  void WriteRecParticles(Int_t event) ; 
-  void     SetParameters() ; //Fills the matrix of parameters
-  //Selects principal and parameters file in function of energy range.
-  void     GetAnalysisParameters(Float_t ClusterEn) ;
-  Double_t CalibratedEnergy(Float_t e)  ; //Calibrates energy.
-
- private:
-
-  Bool_t                 fDefaultInit;        //! Says if the task was created by defaut ctor (only parameters are initialized)
-  TString    fFileName5 ;     // File that contains the Principal file for analysis from 0.5 to 5 GeV
-  TString    fFileName100 ;   // File that contains the Principal file for analysis from 0.5 to 100 GeV
-  TString    fFileNamePar5 ;  // File that contains the parameters for analysis from 0.5 to 5 GeV
-  TString    fFileNamePar100 ;// File that contains the parameters for analysis from 0.5 to 100 GeV
+  AliPHOSPIDv1 & operator = (const AliPHOSPIDv1 & /*pid*/) { return *this ;} 
   
-  TString    fFrom ;              // name of Recpoints and TrackSegments 
-  TString    fHeaderFileName ;    // file name with event header
-  TString    fTrackSegmentsTitle; // branch name with track segments
-  TString    fRecPointsTitle ;    // branch name with rec points
-  TString    fRecParticlesTitle ; // branch name with rec particles
-  Int_t                      fNEvent ;            //! current event number
-  AliPHOSClusterizer *       fClusterizer ;       //! clusterizer
-  AliPHOSTrackSegmentMaker * fTSMaker ;           //! track segment maker
-
-  TPrincipal *               fPrincipal5 ;        //! TPrincipal from fFileName5  
-  TPrincipal *               fPrincipal100 ;      //! TPrincipal from fFileName100 
-  TPrincipal *               fPrincipal ;         //! TPrincipal copy 
-  Double_t *                 fX ;                 //! Principal data 
-  Double_t *                 fP ;                 //! Principal eigenvalues
-  Int_t                      fRecParticlesInRun ; //! Total number of recparticles in one run
-  TMatrixD *                 fParameters5 ;       //! Matrix of identification Parameters 0.5 to 5 GeV
-  TMatrixD *                 fParameters100 ;     //! Matrix of identification Parameters 5-100 GeV
-  TMatrixD *                 fParameters;         //! Matrix copy of identification Parameters
-  Float_t                    fEnergyAnalysisCut;   // Energy to change from one PCA to the other.
-  Int_t                      fCluster;            // Cluster energy range to choose parameters
-  Int_t                      fClusterrcpv;        // Cluster energy range to choos rcpv parameters
-  Int_t                      fMatrixExtraRow;     // Different size of the parameters file. Depends on range
-
-  Float_t   fACalParameter ;// A parameter energy calibration Encal=A+B*En+C*En^2
-  Float_t   fBCalParameter ;// B parameter energy calibration Encal=A+B*En+C*En^2
-  Float_t   fCCalParameter ;// B parameter energy calibration Encal=A+B*En+C*En^2
-
-  ClassDef( AliPHOSPIDv1,5)  // Particle identifier implementation version 1
+private:
+  
+  const TString BranchName() const ; 
+  virtual void  Init() ;
+  virtual void  InitParameters() ;
+  void          MakeRecParticles(void ) ;
+  void          MakePID(void) ;
+
+  //Functions to calculate the PID probability 
+  //  Double_t ChargedHadronDistProb(Double_t  x, Double_t y, Double_t * parg, Double_t * parl) ;
+  Double_t GausF   (Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b/(x*x)+c/x
+  Double_t GausPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
+  Double_t LandauF(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence  a+b/(x*x)+c/x
+ Double_t LandauPol2(Double_t x, Double_t y, Double_t *par) ; //gaussian probability, parameter dependence a+b*x+c*x*x
+ // Relative Distance CPV-EMC
+  Float_t GetDistance     (AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv, Option_t * axis)const ; 
+  Int_t   GetCPVBit       (AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv, Int_t EffPur, Float_t e) const;
+  Int_t   GetPrincipalBit (TString particle, const Double_t* P, Int_t EffPur, Float_t e)const ; //Principal cut
+  Int_t   GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const;
+  Int_t   GetHardPi0Bit   (AliPHOSEmcRecPoint * emc) const;
+  TVector3      GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv)const ;
+  void          PrintRecParticles(Option_t * option) ;
+  virtual void  WriteRecParticles() ; 
+  void          SetParameters() ; //Fills the matrix of parameters
+  void          Unload(); 
+
+  //Do bayesian PID
+  void SetBayesianPID(Bool_t set){ fBayesian = set ;}
+  //PID population
+  void SetInitPID(const Double_t * pid) ;
+  void GetInitPID(Double_t * pid) const ;
+
+private:
+  Bool_t      fBayesian ;                 //  Do PID bayesian
+  Bool_t      fDefaultInit;              //! kTRUE if the task was created by defaut ctor (only parameters are initialized)
+  Bool_t      fWrite ;                   //! To write result to file 
+  Int_t       fNEvent ;                  //! current event number
+  TString     fFileNamePrincipalPhoton ; //  File name of the photon principals
+  TString     fFileNamePrincipalPi0 ;    //  File name of the pi0 principals
+  TString     fFileNameParameters ;      //  File name with PID parameters
+  TPrincipal *fPrincipalPhoton ;         //! TPrincipal from photon pca file 
+  TPrincipal *fPrincipalPi0 ;            //! TPrincipal from pi0 pca file 
+  Double_t   *fX ;                       //! Shower shape for the principal data 
+  Double_t   *fPPhoton ;                 //! Principal photon eigenvalues
+  Double_t   *fPPi0 ;                    //! Principal pi0 eigenvalues
+  Int_t       fRecParticlesInRun ;       //! Total number of recparticles in one run
+  TMatrix    *fParameters;               //! Matrix of identification Parameters
+
+  //Initial pid population
+  Double_t fInitPID[AliESDtrack::kSPECIESN] ;
+  // pid probability function parameters
+  // ToF
+  Double_t fTphoton[3] ;                // gaussian tof response for photon
+  TFormula * fTFphoton ;                // the formula   
+/*   Double_t fTelectron[3] ;              // gaussian tof response for electrons */
+/*   TFormula * fTFelectron ;              // the formula */
+/*   Double_t fTmuon[3] ;                  // gaussian tof response for muon */
+/*   TFormula * fTFmuon ;                  // the formula */
+  Double_t fTpiong[3] ;                 // gaussian tof response for pions
+  TFormula * fTFpiong ;                 // the formula
+/*   Double_t fTpionl[3] ;                 // gaussian tof response for pions */
+/*   TFormula * fTFpionl ;                 // the formula    */
+  Double_t fTkaong[3] ;                 // landau tof response for kaons
+  TFormula * fTFkaong ;                 // the formula
+  Double_t fTkaonl[3] ;                 // landau tof response for kaons
+  TFormula * fTFkaonl ;                 // the formula
+  Double_t fThhadrong[3] ;              // gaus   tof response for heavy hadrons
+  TFormula * fTFhhadrong ;              // the formula
+  Double_t fThhadronl[3] ;              // landau   tof response for heavy hadrons
+  TFormula * fTFhhadronl ;              // the formula
+ /*  Double_t fTpion[9] ;                     // gaussian tof response for pions */
+/*   Double_t fTkaon[9] ;                     // landau tof response for kaons */
+/*   Double_t fThhadron[9] ;                  // landau tof response for nucleons */
+
+  //Shower dispersion
+  Double_t fDmuon[3] ;                   // gaussian ss response for muon 
+  TFormula * fDFmuon ;                   // the formula 
+  Double_t fDphoton[9] ;                 // gaussian ss response for EM
+  Double_t fDpi0[9] ;                    // gaussian ss response for pi0
+  Double_t fDhadron[9] ;                 // gaussian ss response for hadrons
+
+                   // gaussian ss response for muons
+  //CPV-EMCAL distance
+  Double_t fCPVelectron[9] ;   // gaussian emc-cpv distance response for electron
+  Double_t fCPVcharged[9]  ;   // landau emc-cpv distance response for charged part (no elect) */
+/*   Double_t fCPVchargedg[9] ;         // gaussian emc-cpv distance response for charged part (no elect) */
+/*   Double_t fCPVchargedl[9] ;         // landau emc-cpv distance response for charged part (no elect) */
+
+  ClassDef( AliPHOSPIDv1,10)  // Particle identifier implementation version 1
 
 };