]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updated version (Jens)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jan 2011 08:28:04 +0000 (08:28 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jan 2011 08:28:04 +0000 (08:28 +0000)
STEER/AliTPCPIDResponse.cxx
STEER/AliTPCPIDResponse.h

index 0ea017258849ab78031b45595132ebccf3ed6e11..8dc4ee73683a908c1e20581f75638eb50e8cdfa7 100644 (file)
 //      Dariusz Miskowiec, GSI, D.Miskowiec@gsi.de
 //-----------------------------------------------------------------
 
-#include "AliTPCPIDResponse.h"
+#include <TGraph.h>
+#include <TObjArray.h>
+#include <TSpline.h>
+
 #include "AliExternalTrackParam.h"
 
+#include "AliTPCPIDResponse.h"
+
 ClassImp(AliTPCPIDResponse)
 
 //_________________________________________________________________________
 AliTPCPIDResponse::AliTPCPIDResponse():
-    fMIP(50.),
-    fRes0(0.07),
-    fResN2(0.),
-    fKp1(0.0283086),
-    fKp2(2.63394e+01),
-    fKp3(5.04114e-11),
-    fKp4(2.12543),
-    fKp5(4.88663)
+  fMIP(50.),
+  fRes0(0.07),
+  fResN2(0.),
+  fKp1(0.0283086),
+  fKp2(2.63394e+01),
+  fKp3(5.04114e-11),
+  fKp4(2.12543),
+  fKp5(4.88663),
+  fUseDatabase(kFALSE),
+  fResponseFunctions(AliPID::kUnknown+1)
 {
   //
   //  The default constructor
@@ -44,21 +51,24 @@ AliTPCPIDResponse::AliTPCPIDResponse():
 }
 
 //_________________________________________________________________________
-AliTPCPIDResponse::AliTPCPIDResponse(Double_t *param):
-    fMIP(param[0]),
-    fRes0(param[1]),
-    fResN2(param[2]),
-    fKp1(0.0283086),
-    fKp2(2.63394e+01),
-    fKp3(5.04114e-11),
-    fKp4(2.12543),
-    fKp5(4.88663)
+AliTPCPIDResponse::AliTPCPIDResponse(const Double_t *param):
+  fMIP(param[0]),
+  fRes0(param[1]),
+  fResN2(param[2]),
+  fKp1(0.0283086),
+  fKp2(2.63394e+01),
+  fKp3(5.04114e-11),
+  fKp4(2.12543),
+  fKp5(4.88663),
+  fUseDatabase(kFALSE),
+  fResponseFunctions(AliPID::kUnknown+1)
 {
   //
   //  The main constructor
   //
 }
 
+//_________________________________________________________________________
 Double_t AliTPCPIDResponse::Bethe(Double_t betaGamma) const {
   //
   // This is the Bethe-Bloch function normalised to 1 at the minimum
@@ -71,7 +81,8 @@ Double_t AliTPCPIDResponse::Bethe(Double_t betaGamma) const {
   //           1. for simulation
   //           2. for reconstructed PID
   //
-  //  const Float_t kmeanCorrection =0.1;
+  
+//   const Float_t kmeanCorrection =0.1;
   Double_t bb=
     AliExternalTrackParam::BetheBlochAleph(betaGamma,fKp1,fKp2,fKp3,fKp4,fKp5);
   return bb*fMIP;
@@ -103,7 +114,7 @@ void AliTPCPIDResponse::SetSigma(Float_t res0, Float_t resN2) {
 
 //_________________________________________________________________________
 Double_t AliTPCPIDResponse::GetExpectedSignal(const Float_t mom,
-                                         AliPID::EParticleType n) const {
+                                             AliPID::EParticleType n) const {
   //
   // Calculates the expected PID signal as the function of 
   // the information stored in the track, for the specified particle type 
@@ -114,8 +125,13 @@ Double_t AliTPCPIDResponse::GetExpectedSignal(const Float_t mom,
   // assigned clusters and/or the track dip angle, for example.  
   //
   
-  Double_t mass=AliPID::ParticleMass(n); 
-  return Bethe(mom/mass);
+  Double_t mass=AliPID::ParticleMass(n);
+  if (!fUseDatabase||fResponseFunctions.GetEntriesFast()>AliPID::kUnknown) return Bethe(mom/mass);
+  //
+  TSpline3 * responseFunction = (TSpline3 *) fResponseFunctions.UncheckedAt(n);
+  if (!responseFunction) return Bethe(mom/mass);
+  return fMIP*responseFunction->Eval(mom/mass);
+
 }
 
 //_________________________________________________________________________
index 0e53d073f1d5ae12588c61b5ae009ebb7b504551..d9de059973724d758197ce503711904c6cac948f 100644 (file)
 //      Dariusz Miskowiec, GSI, D.Miskowiec@gsi.de
 //-------------------------------------------------------
 #include <Rtypes.h>
+#include <TObjArray.h>
 
 #include "AliPID.h"
 
 class AliTPCPIDResponse {
 public:
   AliTPCPIDResponse();
-  AliTPCPIDResponse(Double_t *param);
+  AliTPCPIDResponse(const Double_t *param);
   virtual ~AliTPCPIDResponse() {}
   void SetSigma(Float_t res0, Float_t resN2);
   void SetBetheBlochParameters(Double_t kp1,
@@ -29,8 +30,11 @@ public:
                                );
   void SetMip(Float_t mip) { fMIP = mip; } // Set overall normalisation; mean dE/dx for MIP
   Double_t Bethe(Double_t bg) const;
-
-
+  void SetUseDatabase(Bool_t useDatabase) { fUseDatabase = useDatabase;}
+  
+  void SetResponseFunction(AliPID::EParticleType type, TObject * const o) { fResponseFunctions.AddAt(o,(Int_t)type); }
+  const TObject * const GetResponseFunction(AliPID::EParticleType type) { return fResponseFunctions.At((Int_t)type); }
+  
   Double_t GetExpectedSignal(const Float_t mom,
                      AliPID::EParticleType n=AliPID::kKaon) const;
   Double_t GetExpectedSigma(const Float_t mom, const Int_t nPoints,
@@ -56,7 +60,10 @@ private:
   Double_t fKp4;   // Bethe-Bloch
   Double_t fKp5;   // formula
 
-  ClassDef(AliTPCPIDResponse,2)   // TPC PID class
+  Bool_t fUseDatabase; // flag if fine-tuned database-response or simple ALEPH BB should be used
+  TObjArray fResponseFunctions; //! ObjArray of response functions individually for each particle
+
+  ClassDef(AliTPCPIDResponse,3)   // TPC PID class
 };
 
 #endif