]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliSplineFit.cxx
Uninitialized variables in CTOR
[u/mrichter/AliRoot.git] / STEER / AliSplineFit.cxx
index b0d02c68935e7fe4fdff74457e9c0d64bedc07b7..9ee597b784ea7bf34aadd459ecaea615d945bf38 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];
@@ -307,7 +308,7 @@ TH1F * AliSplineFit::MakeDiffHisto(TGraph * graph0) const {
   //
 
   Int_t npoints=graph0->GetN();
-  Float_t min=1e+39,max=-1e+39;
+  Float_t min=1e38,max=-1e38;
   for (Int_t ip=0; ip<npoints; ip++){
     Double_t x = graph0->GetX()[ip];
     Double_t y = Eval(x,0)-graph0->GetY()[ip];
@@ -632,6 +633,7 @@ void AliSplineFit::SplineFit(Int_t nder){
   Int_t nknots  = fN;
   if (nknots < 2 ) return;
   Int_t npoints = graph->GetN(); 
+  if (npoints < fMinPoints ) return;
   //
   //
   // spline fit
@@ -857,7 +859,9 @@ void AliSplineFit::MakeKnots0(TGraph * graph, Double_t maxdelta, Int_t minpoints
   //
 
   Int_t npoints  = graph->GetN();
-  Double_t *xknots = new Double_t[npoints];
+  Double_t *xknots = new Double_t[npoints]; 
+  for (Int_t ip=0;ip<npoints;ip++) xknots[ip]=0;
+  //
   Int_t nknots =0;
   Int_t ipoints =0;
   //
@@ -890,7 +894,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
   //
@@ -969,9 +973,9 @@ void AliSplineFit::Test(Int_t npoints, Int_t ntracks, Float_t snoise){
     Double_t sigmaS = hS->GetRMS();
     char fname[100];
     if (fit.fN<20){
-      sprintf(fname,"pol%d",fit.fN);
+      snprintf(fname,100,"pol%d",fit.fN);
     }else{
-      sprintf(fname,"pol%d",19);
+      snprintf(fname,100,"pol%d",19);
     }
     TF1 fpol("fpol",fname);
     graph1->Fit(&fpol);
@@ -1022,7 +1026,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;
@@ -1035,13 +1039,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;
   }
 }