]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSPIDv1.h
Fixes for cmake
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPIDv1.h
index 481d7170b951d49e64eefe852d45f5605ea4d796..b61b717aca19c291ed2a92a04a0446727853901a 100644 (file)
@@ -5,6 +5,25 @@
 
 /* $Id$ */
 
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.60  2007/04/01 15:40:15  kharlov
+ * Correction for actual vertex position implemented
+ *
+ * Revision 1.59  2007/03/06 06:57:46  kharlov
+ * DP:calculation of distance to CPV done in TSM
+ *
+ * Revision 1.58  2006/04/12 11:32:03  alibrary
+ * Simplification of Makefile and some small corrections
+ *
+ * Revision 1.57  2006/01/23 17:51:48  hristov
+ * Using the recommended way of forward declarations for TVector and TMatrix (see v5-08-00 release notes). Additional clean-up
+ *
+ * Revision 1.56  2005/05/28 14:19:04  schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
 
 //_________________________________________________________________________
 // Implementation version v1 of the PHOS particle identifier 
 // Oh yeah                 
 //*-- Author: Yves Schutz (SUBATECH), Gustavo Conesa.
 
+// --- Standard library ---
+
 // --- ROOT system ---
-//class TFormula ;
-class TVector3 ;
-class TMatrixD ;
+class TCanvas ;
+class TFolder ;
+class TFormula;
 class TPrincipal ;
-
-// --- Standard library ---
+class TROOT ;
+class TTree ;
+class TVector3 ;
+#include <TMatrixDfwd.h>
 
 // --- AliRoot header files ---
+class AliPHOSClusterizerv1 ;
+class AliPHOSCpvRecPoint ;
 class AliPHOSEmcRecPoint ;
-class AliPHOSRecPoint ;
-
+class AliPHOSTrackSegment ;
+class AliPHOSTrackSegmentMakerv1 ;
 #include "AliPHOSPID.h"
+#include "AliPID.h"
 
 class  AliPHOSPIDv1 : public AliPHOSPID {
   
- public:
-  
-  AliPHOSPIDv1() ;          // ctor            
-  AliPHOSPIDv1(const char* headerFile, const char * tsBranch = "Default", const Bool_t toSplit=kFALSE) ;
-  AliPHOSPIDv1(AliPHOSPIDv1 & pid) ;          // cpy ctor            
-
-  virtual ~AliPHOSPIDv1() ; // dtor
+public:
   
-  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 ;}  
+  AliPHOSPIDv1() ;          // ctor   
+  AliPHOSPIDv1(AliPHOSGeometry *geom);
+  AliPHOSPIDv1(const AliPHOSPIDv1 & pid) ;          // cpy ctor            
   
-  virtual void Print(Option_t * option) const {}
-  void Print() ; 
-  
-  //Get files that contain the PCA
-  const TString GetPrincipalFile( )const {return fFileName ;}
-  const TString GetPrincipalFilePar( )const {return fFileNamePar ;}
-
-  //To turn on or off the Pi0 analysis
-  const Bool_t GetPi0Analysis()const {return fPi0Analysis;}
-  void         SetPi0Analysis(Bool_t turnonoff){ fPi0Analysis = turnonoff; }
-
-  // Set and Get all parameters necessary in the PID depending on the 
-  // custer energy and Purity-Efficiency point 
-  void SetCpvtoEmcDistanceCutParameters(Float_t clusterEn, Int_t effpur, TString Axis,Float_t cut)  ; 
-  void SetTimeGate(Int_t effpur, Float_t gate)  ; 
-  const Float_t GetCpvtoEmcDistanceCut(const Float_t e, const TString Axis ) const ;
-  const Double_t GetTimeGate(const Int_t effpur)  const;
-  void SetEllipseParameter   (TString Param, Int_t i, Double_t par)  ;
-  void SetEllipseParameterPi0(TString Param, Int_t i, Double_t par)  ;
-  const Double_t GetParameterToCalculateEllipse(const TString Param, const Int_t i) const  ;     
-  const Double_t GetEllipseParameter(const TString Param, Float_t E) const;
-  const Double_t GetParameterToCalculatePi0Ellipse(const TString Param, const Int_t i) const  ;     
-  const Double_t GetEllipseParameterPi0(const TString Param, Float_t E) const;
-  //Get and Set energy calibration parameters
-  
-  void  SetCalibrationParameter(Int_t Param,Double_t param) const ;
-  const Double_t GetCalibrationParameter(const Int_t i) const;
-  const Double_t GetCalibratedEnergy(const Float_t e)   const; //Calibrates energy.
-  
-  //  virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
-  //  virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;} 
-  virtual const char * Version() const { return "pid-v1" ; }  
-  
-  AliPHOSPIDv1 & operator = (const AliPHOSPIDv1 & pid) { return *this ;} 
- private:
-  
-  const TString BranchName() const ; 
-  virtual void Init() ;
-  virtual void InitParameters() ;
-  void     MakeRecParticles(void ) ;
-  // Relative Distance CPV-EMC
-  const Float_t  GetDistance(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv, Option_t * Axis)const ; 
-  const Int_t    GetCPVBit(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv,const Int_t EffPur, const Float_t e) const;
-  const Int_t    GetPrincipalBit   (const Double_t* P, const Int_t eff_pur, const Float_t E)const ; //Principal cut
-  const Int_t    GetPrincipalPi0Bit(const Double_t* P, const Int_t eff_pur, const Float_t E)const ; //Principal cut
-  TVector3 GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const ;
-  void     PrintRecParticles(Option_t * option) ;
-  virtual  void WriteRecParticles(Int_t event) ; 
-  void     SetParameters() ; //Fills the matrix of parameters
+  virtual ~AliPHOSPIDv1() ; // dtor
   
+  virtual void TrackSegments2RecParticles(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 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;
+
+  Double_t GetThresholdChargedNeutral () const {return  fChargedNeutralThreshold;}
+  Float_t GetTOFEnergyThreshold () const {return  fTOFEnThreshold;}
+  Float_t GetDispersionEnergyThreshold () const {return  fDispEnThreshold;}
+  Int_t   GetDispersionMultiplicityThreshold () const {return  fDispMultThreshold;}
+
+  //Do bayesian PID
+  void SetBayesianPID(Bool_t set){ fBayesian = set ;}
+
+  // 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);
+
+  void SetThresholdChargedNeutral (Double_t th) {fChargedNeutralThreshold = th;}
+  void SetTOFEnergyThreshold (Float_t th)  {fTOFEnThreshold = th;}
+  void SetDispersionEnergyThreshold (Float_t th) {fDispEnThreshold = th;}
+  void SetDispersionMultiplicityThreshold (Int_t th)  {fDispMultThreshold = th;}
+
+  //Switch to "on flyght" mode, without writing to TreeR and file  
+  void SetWriting(Bool_t toWrite = kFALSE){fWrite = toWrite;} 
+  void Print(const Option_t * = "") const ; 
+
+  void GetVertex(void) ; //Extracts vertex in current event
 
- private:
+  virtual const char * Version() const { return "pid-v1" ; }  
 
-  Bool_t                 fDefaultInit;        //! Says if the task was created by defaut ctor (only parameters are initialized)
-  TString    fFileName ;     // File that contains the Principal file for analysis
-  TString    fFileNamePi0 ;  // File that contains the Pi0 Principal file for analysis
-  TString    fFileNamePar ;  // File that contains the parameters for analysis
+  AliPHOSPIDv1 & operator = (const AliPHOSPIDv1 & /*pid*/) { return *this ;} 
+  
+private:
   
-  //  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
-
-
-  Bool_t                     fPi0Analysis;        //! Pi0 analysis on or off  
-  TPrincipal *               fPrincipal ;         //! TPrincipal from pca file 
-  TPrincipal *               fPrincipalPi0 ;      //! TPrincipal from Pi0 pca file 
-  Double_t *                 fX ;                 //! Principal data 
-  Double_t *                 fP ;                 //! Principal eigenvalues
-  Double_t *                 fPPi0 ;                 //! Principal Pi0 eigenvalues
-
-  Int_t                      fRecParticlesInRun ; //! Total number of recparticles in one run
-  TMatrixD *                 fParameters;         //! Matrix of identification Parameters
-
-  ClassDef( AliPHOSPIDv1,7)  // Particle identifier implementation version 1
+  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
+  Int_t   GetCPVBit       (AliPHOSTrackSegment * ts, 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) ;
+  void          SetParameters() ; //Fills the matrix of parameters
+
+  //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 
+  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
+  TMatrixF    *fParameters;               //! Matrix of identification Parameters
+
+  TVector3   fVtx ;                      //! Vertex position in current event
+
+  //Initial pid population
+  Double_t fInitPID[AliPID::kSPECIESN] ; // Initial population to do bayesian PID
+  // pid probability function parameters
+  // ToF
+  Double_t fTphoton[3] ;       // gaussian tof response for photon
+  TFormula * fTFphoton ;       // the formula   
+  Double_t fTpiong[3] ;        // gaussian tof response for pions
+  TFormula * fTFpiong ;        // 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
+
+  //Shower dispersion
+  Double_t fDmuon[3]    ;     // gaussian ss response for muon 
+  TFormula * fDFmuon    ;     // the formula 
+  Double_t fDphoton[10] ;     // gaussian ss response for EM
+  Double_t fDpi0[10]    ;     // gaussian ss response for pi0
+  Double_t fDhadron[10] ;     // gaussian ss response for hadrons
+
+  Double_t fXelectron[10] ;   // gaussian emc-cpv distance response for electron
+  Double_t fXcharged[10]  ;   // landau emc-cpv distance response for charged part (no elect) */
+  Double_t fZelectron[10] ;   // gaussian emc-cpv distance response for electron
+  Double_t fZcharged[10]  ;   // landau emc-cpv distance response for charged part (no elect) */
+
+
+  Double_t fERecWeightPar[4] ;  // gaussian tof response for photon
+  TFormula * fERecWeight ;      // the formula   
+  Double_t fChargedNeutralThreshold ; //Threshold to differentiate between charged and neutral
+  Float_t  fTOFEnThreshold;           //Maximum energy to use TOF
+  Float_t  fDispEnThreshold;          //Minimum energy to use shower shape
+  Int_t    fDispMultThreshold ;       //Minimum multiplicity to use shower shape
+
+  ClassDef( AliPHOSPIDv1,13)  // Particle identifier implementation version 1
 
 };