]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Replaced Error(...); exit(1) by AliFatal in the AliCheb... classes
authorshahoian <ruben.shahoyan@cern.ch>
Mon, 1 Dec 2014 22:03:05 +0000 (23:03 +0100)
committershahoian <ruben.shahoyan@cern.ch>
Mon, 1 Dec 2014 22:03:31 +0000 (23:03 +0100)
STEER/STEERBase/AliCheb3D.cxx
STEER/STEERBase/AliCheb3DCalc.cxx
STEER/STEERBase/AliMagWrapCheb.cxx

index 5d26824dba5bffc235859f4058dc42ebbb02946c..3f3848bed47ef8adb900f7536204a8ba21bd3dcc 100644 (file)
@@ -139,7 +139,7 @@ AliCheb3D::AliCheb3D(const char* funName, int DimOut, const Float_t  *bmin, cons
   // npoints : array of 3 elements with the number of points to compute in each of 3 dimension
   // prec    : max allowed absolute difference between the user function and computed parameterization on the requested grid
   // precD   : optional array with precisions per output dimension (if >fgkMinPrec will override common prec)
-  if (DimOut<1) {Error("AliCheb3D","Requested output dimension is %d\nStop\n",fDimOut); exit(1);}
+  if (DimOut<1) AliFatalF("Requested output dimension is %d",fDimOut);
   for (int i=3;i--;) {
     fBMin[i] = fBMax[i] = fBScale[i] = fBOffset[i] = 0;
     fNPoints[i] = 0;
@@ -177,8 +177,7 @@ AliCheb3D::AliCheb3D(void (*ptr)(float*,float*), int DimOut, Float_t  *bmin,Floa
   // prec    : max allowed absolute difference between the user function and computed parameterization on the requested grid
   // precD   : optional array with precisions per output dimension (if >fgkMinPrec will override common prec)
   //
-  if (DimOut<1) {Error("AliCheb3D","Requested output dimension is %d\nStop\n",fDimOut); exit(1);}
-  if (DimOut<1) {Error("AliCheb3D","Requested output dimension is %d\nStop\n",fDimOut); exit(1);}
+  if (DimOut<1) AliFatalF("Requested output dimension is %d",fDimOut);
   for (int i=3;i--;) {
     fBMin[i] = fBMax[i] = fBScale[i] = fBOffset[i] = 0;
     fNPoints[i] = 0;
@@ -218,8 +217,7 @@ AliCheb3D::AliCheb3D(void (*ptr)(float*,float*), int DimOut, Float_t  *bmin,Floa
   // prec    : max allowed absolute difference between the user function and computed parameterization on the requested grid
   // precD   : optional array with precisions per output dimension (if >fgkMinPrec will override common prec)
   //
-  if (DimOut<1) {Error("AliCheb3D","Requested output dimension is %d\nStop\n",fDimOut); exit(1);}
-  if (DimOut<1) {Error("AliCheb3D","Requested output dimension is %d\nStop\n",fDimOut); exit(1);}
+  if (DimOut<1) AliFatalF("Requested output dimension is %d",fDimOut);
   for (int i=3;i--;) {
     fBMin[i] = fBMax[i] = fBScale[i] = fBOffset[i] = 0;
     fNPoints[i] = 0;
@@ -262,8 +260,8 @@ AliCheb3D::AliCheb3D(void (*ptr)(float*,float*), int DimOut, Float_t  *bmin,Floa
   // prec    : max allowed absolute difference between the user function and computed parameterization on the requested grid
   // precD   : optional array with precisions per output dimension (if >fgkMinPrec will override common prec)
   //
-  if (DimOut!=3) {Error("AliCheb3D","This constructor works only for 3D fits, %dD fit was requested\n",fDimOut); exit(1);}
-  if (DimOut<1) {Error("AliCheb3D","Requested output dimension is %d\nStop\n",fDimOut); exit(1);}
+  if (DimOut!=3) AliFatalF("This constructor works only for 3D fits, %dD fit was requested",fDimOut);
+  if (DimOut<1)  AliFatalF("Requested output dimension is %d",fDimOut);
   for (int i=3;i--;) {
     fBMin[i] = fBMax[i] = fBScale[i] = fBOffset[i] = 0;
     fNPoints[i] = 0;
@@ -352,7 +350,7 @@ void AliCheb3D::PrepareBoundaries(const Float_t  *bmin, const Float_t  *bmax)
     fBMax[i]   = bmax[i];
     fBScale[i] = bmax[i]-bmin[i];
     if (fBScale[i]<=0) { 
-      AliFatal(Form("Boundaries for %d-th dimension are not increasing: %+.4e %+.4e\nStop\n",i,fBMin[i],fBMax[i]));
+      AliFatalF("Boundaries for %d-th dimension are not increasing: %+.4e %+.4e\nStop\n",i,fBMin[i],fBMax[i]);
     }
     fBOffset[i] = bmin[i] + fBScale[i]/2.0;
     fBScale[i] = 2./fBScale[i];
@@ -383,7 +381,7 @@ void AliCheb3D::SetUsrFunction(const char* name)
   if (fUsrMacro) delete fUsrMacro;
   TString tmpst = fUsrFunName;
   tmpst += "+"; // prepare filename to compile
-  if (gROOT->LoadMacro(tmpst.Data())) {Error("SetUsrFunction","Failed to load user function from %s\nStop\n",name); exit(1);}
+  if (gROOT->LoadMacro(tmpst.Data())) AliFatalF("Failed to load user function from %s",name);
   fUsrMacro = new TMethodCall();        
   tmpst = tmpst.Data() + tmpst.Last('/')+1; //Strip away any path preceding the macro file name
   int dot = tmpst.Last('.');
@@ -464,10 +462,7 @@ void AliCheb3D::DefineGrid(Int_t* npoints)
   fMaxCoefs = 1;
   for (int id=3;id--;) { 
     fNPoints[id] = npoints[id];
-    if (fNPoints[id]<kMinPoints) {
-      Error("DefineGrid","at %d-th dimension %d point is requested, at least %d is needed\nStop\n",id,fNPoints[id],kMinPoints);
-      exit(1);
-    }
+    if (fNPoints[id]<kMinPoints) AliFatalF("at %d-th dimension %d point is requested, at least %d is needed",id,fNPoints[id],kMinPoints);
     ntot += fNPoints[id];
     fMaxCoefs *= fNPoints[id];
   }
@@ -746,22 +741,22 @@ void AliCheb3D::LoadData(FILE* stream)
 {
   // load coefficients data from stream
   //
-  if (!stream) {AliFatal("No stream provided.\nStop");}
+  if (!stream) AliFatal("No stream provided");
   TString buffs;
   Clear();
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("START")) {AliFatal(Form("Expected: \"START <fit_name>\", found \"%s\"\nStop\n",buffs.Data()));}
+  if (!buffs.BeginsWith("START")) AliFatalF("Expected: \"START <fit_name>\", found \"%s\"",buffs.Data());
   SetName(buffs.Data()+buffs.First(' ')+1);
   //
   AliCheb3DCalc::ReadLine(buffs,stream); // N output dimensions
   fDimOut = buffs.Atoi(); 
-  if (fDimOut<1) {AliFatal(Form("Expected: '<number_of_output_dimensions>', found \"%s\"\nStop\n",buffs.Data()));}
+  if (fDimOut<1) AliFatalF("Expected: '<number_of_output_dimensions>', found \"%s\"",buffs.Data());
   //
   SetDimOut(fDimOut);
   //
   AliCheb3DCalc::ReadLine(buffs,stream); // Interpolation abs. precision
   fPrec = buffs.Atof();
-  if (fPrec<=0) {AliFatal(Form("Expected: '<abs.precision>', found \"%s\"\nStop\n",buffs.Data()));}
+  if (fPrec<=0) AliFatalF("Expected: '<abs.precision>', found \"%s\"",buffs.Data());
   //
   for (int i=0;i<3;i++) { // Lower boundaries of interpolation region
     AliCheb3DCalc::ReadLine(buffs,stream);
@@ -779,7 +774,7 @@ void AliCheb3D::LoadData(FILE* stream)
   // check end_of_data record
   AliCheb3DCalc::ReadLine(buffs,stream);
   if (!buffs.BeginsWith("END") || !buffs.Contains(GetName())) {
-    AliFatal(Form("Expected \"END %s\", found \"%s\".\nStop\n",GetName(),buffs.Data()));
+    AliFatalF("Expected \"END %s\", found \"%s\"",GetName(),buffs.Data());
   }
   //
 }
index 097418ef4e57986a4dc4ce8b5991fc03ee5b80f6..62a112d450a5699a19ec555640ed4cb8f08818e7 100644 (file)
@@ -16,6 +16,7 @@
 #include <cstdlib>
 #include <TSystem.h>
 #include "AliCheb3DCalc.h"
+#include "AliLog.h"
 
 ClassImp(AliCheb3DCalc)
 
@@ -258,16 +259,16 @@ void AliCheb3DCalc::SaveData(FILE* stream) const
 void AliCheb3DCalc::LoadData(FILE* stream)
 {
   // Load coefs. from the stream 
-  if (!stream) {Error("LoadData","No stream provided.\nStop"); exit(1);}
+  if (!stream) AliFatal("No stream provided");
   TString buffs;
   Clear();
   ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("START")) {Error("LoadData","Expected: \"START <fit_name>\", found \"%s\"\nStop\n",buffs.Data());exit(1);}
+  if (!buffs.BeginsWith("START")) AliFatalF("Expected: \"START <fit_name>\", found \"%s\"",buffs.Data());
   if (buffs.First(' ')>0) SetName(buffs.Data()+buffs.First(' ')+1);
   //
   ReadLine(buffs,stream); // NRows
   fNRows = buffs.Atoi(); 
-  if (fNRows<0 && !buffs.IsDigit()) {Error("LoadData","Expected: '<number_of_rows>', found \"%s\"\nStop\n",buffs.Data());exit(1);}
+  if (fNRows<0 && !buffs.IsDigit()) AliFatalF("Expected: '<number_of_rows>', found \"%s\"",buffs.Data());
   //
   fNCols = 0;
   fNElemBound2D = 0;
@@ -292,8 +293,6 @@ void AliCheb3DCalc::LoadData(FILE* stream)
     fNCoefs += fCoefBound2D0[i];
   }
   //
-  //  if (fNCoefs<=0) {Error("LoadData","Negtive (%d) number of Chebychef coeffs. is obtained.\nStop\n",fNCoefs);exit(1);}
-  //
   InitCoefs(fNCoefs);
   for (int i=0;i<fNCoefs;i++) {
     ReadLine(buffs,stream);
@@ -306,10 +305,7 @@ void AliCheb3DCalc::LoadData(FILE* stream)
   //
   // check end_of_data record
   ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("END") || !buffs.Contains(GetName())) {
-    Error("LoadData","Expected \"END %s\", found \"%s\".\nStop\n",GetName(),buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("END") || !buffs.Contains(GetName())) AliFatalF("Expected \"END %s\", found \"%s\"",GetName(),buffs.Data());
   //
 }
 
@@ -322,7 +318,7 @@ void AliCheb3DCalc::ReadLine(TString& str,FILE* stream)
     if (str.IsNull()||str.BeginsWith("#")) continue;
     return;
   }
-  fprintf(stderr,"AliCheb3D::ReadLine: Failed to read from stream.\nStop");exit(1); // normally, should not reach here
+  AliFatalGeneral("ReadLine","Failed to read from stream"); // normally, should not reach here
 }
 
 //_______________________________________________
index 09180ca22590a9d30c83c1992d9cdff0a59c64e7..f19075ff5566d8e7c4e820d590ffde73b9f8107b 100644 (file)
@@ -688,18 +688,12 @@ void AliMagWrapCheb::LoadData(const char* inpfile)
   //
   TString buffs;
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("START")) {
-    Error("LoadData","Expected: \"START <name>\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("START")) AliFatalF("Expected: \"START <name>\", found \"%s\"",buffs.Data());
   if (buffs.First(' ')>0) SetName(buffs.Data()+buffs.First(' ')+1);
   //
   // Solenoid part    -----------------------------------------------------------
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("START SOLENOID")) {
-    Error("LoadData","Expected: \"START SOLENOID\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("START SOLENOID")) AliFatalF("Expected: \"START SOLENOID\", found \"%s\"",buffs.Data());
   AliCheb3DCalc::ReadLine(buffs,stream); // nparam
   int nparSol = buffs.Atoi(); 
   //
@@ -710,17 +704,12 @@ void AliMagWrapCheb::LoadData(const char* inpfile)
   }
   //
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("END SOLENOID")) {
-    Error("LoadData","Expected \"END SOLENOID\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("END SOLENOID")) AliFatalF("Expected \"END SOLENOID\", found \"%s\"",buffs.Data());
   //
   // TPCInt part     -----------------------------------------------------------
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("START TPCINT")) {
-    Error("LoadData","Expected: \"START TPCINT\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("START TPCINT")) AliFatalF("Expected: \"START TPCINT\", found \"%s\"",buffs.Data());
+  //
   AliCheb3DCalc::ReadLine(buffs,stream); // nparam
   int nparTPCInt = buffs.Atoi(); 
   //
@@ -731,17 +720,11 @@ void AliMagWrapCheb::LoadData(const char* inpfile)
   }
   //
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("END TPCINT")) {
-    Error("LoadData","Expected \"END TPCINT\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("END TPCINT")) AliFatalF("Expected \"END TPCINT\", found \"%s\"",buffs.Data());
   //
   // TPCRatInt part     -----------------------------------------------------------
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("START TPCRatINT")) {
-    Error("LoadData","Expected: \"START TPCRatINT\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("START TPCRatINT")) AliFatalF("Expected: \"START TPCRatINT\", found \"%s\"",buffs.Data());
   AliCheb3DCalc::ReadLine(buffs,stream); // nparam
   int nparTPCRatInt = buffs.Atoi(); 
   //
@@ -752,17 +735,12 @@ void AliMagWrapCheb::LoadData(const char* inpfile)
   }
   //
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("END TPCRatINT")) {
-    Error("LoadData","Expected \"END TPCRatINT\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("END TPCRatINT")) AliFatalF("Expected \"END TPCRatINT\", found \"%s\"",buffs.Data());
   //
   // Dipole part    -----------------------------------------------------------
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("START DIPOLE")) {
-    Error("LoadData","Expected: \"START DIPOLE\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("START DIPOLE")) AliFatalF("Expected: \"START DIPOLE\", found \"%s\"",buffs.Data());
+  //
   AliCheb3DCalc::ReadLine(buffs,stream); // nparam
   int nparDip = buffs.Atoi();  
   //
@@ -773,16 +751,10 @@ void AliMagWrapCheb::LoadData(const char* inpfile)
   }
   //
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("END DIPOLE")) {
-    Error("LoadData","Expected \"END DIPOLE\", found \"%s\"\nStop\n",buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("END DIPOLE")) AliFatalF("Expected \"END DIPOLE\", found \"%s\"",buffs.Data());
   //
   AliCheb3DCalc::ReadLine(buffs,stream);
-  if (!buffs.BeginsWith("END ") && !buffs.Contains(GetName())) {
-    Error("LoadData","Expected: \"END %s\", found \"%s\"\nStop\n",GetName(),buffs.Data());
-    exit(1);
-  }
+  if (!buffs.BeginsWith("END ") && !buffs.Contains(GetName())) AliFatalF("Expected: \"END %s\", found \"%s\"",GetName(),buffs.Data());
   //
   // ---------------------------------------------------------------------------
   fclose(stream);