]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG3/hfe/AliHFEtools.cxx
Update of the HFE package
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEtools.cxx
index 1d5e5c289ea6c5ecc927b76e39798baf8dcbf5a5..91af78ad4fdf2704cac97f306e1225786259bc87 100644 (file)
 #include "TAxis.h"
 
 #include "AliAODMCParticle.h"
+#include "AliESDpid.h"
 #include "AliLog.h"
+#include "AliTOFPIDResponse.h"
 
 #include "AliHFEtools.h"
 
 ClassImp(AliHFEtools)
 
+AliESDpid *AliHFEtools::fgDefaultPID = NULL;
+Int_t AliHFEtools::fgLogLevel = 1;
+
 //__________________________________________
 AliHFEtools::AliHFEtools():
   TObject()
@@ -148,3 +153,50 @@ Float_t AliHFEtools::GetRapidity(AliAODMCParticle *part){
   return rapidity;
 }
 
+//__________________________________________
+AliESDpid* AliHFEtools::GetDefaultPID(Bool_t isMC){
+  //
+  // Get the default PID as singleton instance
+  //
+  if(!fgDefaultPID){
+    fgDefaultPID = new AliESDpid;
+    Double_t tres = isMC ? 80. : 130.;
+    fgDefaultPID->GetTOFResponse().SetTimeResolution(tres);
+
+    // TPC Bethe Bloch parameters
+    Double_t alephParameters[5];
+    if(isMC){
+      // simulation
+      alephParameters[0] = 2.15898e+00/50.;
+      alephParameters[1] = 1.75295e+01;
+      alephParameters[2] = 3.40030e-09;
+      alephParameters[3] = 1.96178e+00;
+      alephParameters[4] = 3.91720e+00;
+    } else {
+      alephParameters[0] = 0.0283086/0.97;
+      //alephParameters[0] = 0.0283086;
+      alephParameters[1] = 2.63394e+01;
+      alephParameters[2] = 5.04114e-11;
+      alephParameters[3] = 2.12543e+00;
+      alephParameters[4] = 4.88663e+00;
+    }
+    fgDefaultPID->GetTPCResponse().SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2], alephParameters[3],alephParameters[4]);
+
+  }
+  if(fgLogLevel){
+    printf("Error - You are using the default PID: You should use the PID coming from the tender");
+    printf("Error - Arrrrrrrrr...");
+    printf("Error - Please rethink your program logic. Using default PID is really dangerous");
+    printf("Error - TOF PID is adapted to Monte Carlo");
+  }
+  return fgDefaultPID;
+}
+
+//__________________________________________
+void AliHFEtools::DestroyDefaultPID(){
+  //
+  // Destroy default PID object if existing
+  //
+  if(fgDefaultPID) delete fgDefaultPID;
+  fgDefaultPID = NULL;
+}