]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliSplineFit.cxx
Adding NSD analysis as well as new features and removing warnings
[u/mrichter/AliRoot.git] / STEER / AliSplineFit.cxx
index 69be48e5adf1e3acb48a90beef32f94c37401de1..d464d67370f09631faec88795dd750bef5cee7ea 100644 (file)
@@ -171,6 +171,7 @@ Double_t   AliSplineFit::Eval(Double_t x, Int_t deriv) const{
   //
   Double_t dx   = x-fX[index];
   Double_t dxc  = fX[index+1]-fX[index];
+  if (dxc<=0)    return fY0[index];
   Double_t y0   = fY0[index];
   Double_t y1   = fY1[index];
   Double_t y01  = fY0[index+1];
@@ -630,7 +631,9 @@ void AliSplineFit::SplineFit(Int_t nder){
   TGraph * graph = fGraph;
   if (nder>1) nder=2;
   Int_t nknots  = fN;
+  if (nknots < 2 ) return;
   Int_t npoints = graph->GetN(); 
+  if (npoints < fMinPoints ) return;
   //
   //
   // spline fit
@@ -889,7 +892,7 @@ void AliSplineFit::MakeKnots0(TGraph * graph, Double_t maxdelta, Int_t minpoints
 
 
 
-void AliSplineFit::MakeSmooth(TGraph * graph, Float_t ratio, char * type){
+void AliSplineFit::MakeSmooth(TGraph * graph, Float_t ratio, Option_t * type){
   //
   // Interface to GraphSmooth
   //
@@ -1021,7 +1024,7 @@ void AliSplineFit::Cleanup(){
  // deletes extra information to reduce amount of information stored on the data
  // base
     
-     delete fGraph;  fGraph=0;
+ //    delete fGraph;  fGraph=0;   // Don't delete fGraph -- input parameter 
      delete fParams; fParams=0;
      delete fCovars; fCovars=0;
      delete [] fIndex; fIndex=0;
@@ -1034,13 +1037,13 @@ void AliSplineFit::CopyGraph() {
   // enter graph points directly to fit parameters 
   // (to bee used when too few points are available)
   //
-  fN = fGraph->GetN();
+  fN = fGraph->GetN();   
   fX = new Double_t[fN];
   fY0 = new Double_t[fN];
   fY1 = new Double_t[fN];
   for (Int_t i=0; i<fN; i++ ) {
     fX[i]  = fGraph->GetX()[i];
-    fY0[i] = fGraph->GetY()[i];
+    fY0[i] = fGraph->GetY()[i];     
     fY1[i] = 0;
   }
 }