use Eval const outside of the boundaries
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 13 Nov 2010 23:59:29 +0000 (23:59 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 13 Nov 2010 23:59:29 +0000 (23:59 +0000)
(Alexander)

TPC/AliTPCcalibDButil.cxx
TPC/AliTPCcalibDButil.h
TPC/AliTPCseed.cxx

index fbf75a1..1e22f57 100644 (file)
@@ -2378,6 +2378,23 @@ Double_t AliTPCcalibDButil::EvalGraphConst(TGraph * const graph, Double_t xref){
   return graph->Eval(xref);
 }
 
+Double_t AliTPCcalibDButil::EvalGraphConst(AliSplineFit *graph, Double_t xref){
+  //
+  // Use constant interpolation outside of range also for spline fits
+  //
+  if (!graph) {
+    printf("AliTPCcalibDButil::EvalGraphConst: 0 pointer\n");
+    return 0;
+  }
+  if (graph->GetKnots()<1){
+    printf("AliTPCcalibDButil::EvalGraphConst: Empty graph");
+    return 0;
+  }
+  if (xref<graph->GetX()[0]) return graph->GetY0()[0];
+  if (xref>graph->GetX()[graph->GetKnots()-1]) return graph->GetY0()[graph->GetKnots()-1]; 
+  return graph->Eval( xref);
+}
+
 Float_t AliTPCcalibDButil::FilterSensor(AliDCSSensor * sensor, Double_t ymin, Double_t ymax, Double_t maxdy,  Double_t sigmaCut){
   //
   // Filter DCS sensor information
index 6c8ceb3..2968c0a 100644 (file)
@@ -144,6 +144,8 @@ public:
   static void SmoothGraph(TGraph *graph, Double_t delta);
   static Int_t     GetNearest(TGraph *graph, Double_t xref, Double_t &dx, Double_t &y);
   static Double_t EvalGraphConst(TGraph * const graph, Double_t xref);
+  static Double_t EvalGraphConst(AliSplineFit *graph, Double_t xref);
+
   //
   // Filter sensors
   //
index d7c95a0..cbb0c20 100644 (file)
@@ -33,7 +33,7 @@
 #include "AliTPCTransform.h"
 #include "AliSplineFit.h"
 #include "AliCDBManager.h"
-
+#include "AliTPCcalibDButil.h"
 
 
 ClassImp(AliTPCseed)
@@ -1089,9 +1089,9 @@ Float_t  AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i
       AliSplineFit * fitMIP = (AliSplineFit *) timeGainSplines->At(0);
       AliSplineFit * fitFPcosmic = (AliSplineFit *) timeGainSplines->At(1);
       if (fitMIP) {
-       corrTimeGain = fitMIP->Eval(time);
+       corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitMIP, time);/*fitMIP->Eval(time);*/
       } else {
-       if (fitFPcosmic) corrTimeGain = fitFPcosmic->Eval(time); // This value describes the ratio FP-to-MIP, hardwired for the moment
+       if (fitFPcosmic) corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitFPcosmic, time);/*fitFPcosmic->Eval(time);*/ 
       }
     }
   }