]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliMagF.cxx
Using At instead of UncheckedAt (Marian)
[u/mrichter/AliRoot.git] / STEER / AliMagF.cxx
index 8d9c252cdb9db2ea7934d7bcb43cdc3695a44a09..70eea8dfa43f772e32c6543b89099a1be5a1c9c6 100644 (file)
@@ -127,7 +127,7 @@ AliMagF::AliMagF(const char *name, const char* title, Double_t factorSol, Double
   //
   if (fBeamEnergy<=0 && fBeamType!=kNoBeamField) {
     if      (fBeamType == kBeamTypepp) fBeamEnergy = 7000.; // max proton energy
-    else if (fBeamType == kBeamTypeAA) fBeamEnergy = 2750;  // max PbPb energy
+    else if (fBeamType == kBeamTypeAA) fBeamEnergy = 2760;  // max PbPb energy
     AliInfo("Maximim possible beam energy for requested beam is assumed");
   } 
   const char* parname = 0;
@@ -183,21 +183,18 @@ AliMagF::~AliMagF()
 Bool_t AliMagF::LoadParameterization()
 {
   if (fMeasuredMap) {
-    AliError(Form("Field data %s are already loaded from %s\n",GetParamName(),GetDataFileName()));
-    return kTRUE;
+    AliFatal(Form("Field data %s are already loaded from %s\n",GetParamName(),GetDataFileName()));
   }
   //
   char* fname = gSystem->ExpandPathName(GetDataFileName());
   TFile* file = TFile::Open(fname);
   if (!file) {
-    AliError(Form("Failed to open magnetic field data file %s\n",fname)); 
-    return kFALSE;
+    AliFatal(Form("Failed to open magnetic field data file %s\n",fname)); 
   }
   //
   fMeasuredMap = dynamic_cast<AliMagWrapCheb*>(file->Get(GetParamName()));
   if (!fMeasuredMap) {
-    AliError(Form("Did not find field %s in %s\n",GetParamName(),fname)); 
-    return kFALSE;
+    AliFatal(Form("Did not find field %s in %s\n",GetParamName(),fname)); 
   }
   file->Close();
   delete file;
@@ -477,7 +474,7 @@ AliMagF* AliMagF::CreateFieldMap(Float_t l3Cur, Float_t diCur, Int_t convention,
   const Float_t tolerance=0.03; // relative current tolerance
   const Float_t zero=77.;       // "zero" current (A)
   //
-  BMap_t map;
+  BMap_t map = k5kG;
   double sclL3,sclDip;
   //
   Float_t l3Pol = l3Cur > 0 ? 1:-1;
@@ -489,8 +486,7 @@ AliMagF* AliMagF::CreateFieldMap(Float_t l3Cur, Float_t diCur, Int_t convention,
   if (TMath::Abs((sclDip=diCur/diNominalCurrent)-1.) > tolerance && !uniform) {
     if (diCur <= zero) sclDip = 0.; // some small current.. -> Dipole OFF
     else {
-      AliErrorGeneral("AliMagF",Form("Wrong dipole current (%f A)!",diCur));
-      return 0;
+      AliFatalGeneral("AliMagF",Form("Wrong dipole current (%f A)!",diCur));
     }
   }
   //
@@ -505,16 +501,14 @@ AliMagF* AliMagF::CreateFieldMap(Float_t l3Cur, Float_t diCur, Int_t convention,
     else if (TMath::Abs((sclL3=l3Cur/l3NominalCurrent2)-1.) < tolerance) map  = k2kG;
     else if (l3Cur <= zero && diCur<=zero)   { sclL3=0; sclDip=0; map  = k5kGUniform;}
     else {
-      AliErrorGeneral("AliMagF",Form("Wrong L3 current (%f A)!",l3Cur));
-      return 0;
+      AliFatalGeneral("AliMagF",Form("Wrong L3 current (%f A)!",l3Cur));
     }
   }
   //
   if (sclDip!=0 && map!=k5kGUniform) {
     if ( (l3Cur<=zero) || ((convention==kConvLHC && l3Pol!=diPol) || (convention==kConvDCS2008 && l3Pol==diPol)) ) { 
-      AliErrorGeneral("AliMagF",Form("Wrong combination for L3/Dipole polarities (%c/%c) for convention %d",
+      AliFatalGeneral("AliMagF",Form("Wrong combination for L3/Dipole polarities (%c/%c) for convention %d",
                                     l3Pol>0?'+':'-',diPol>0?'+':'-',GetPolarityConvention()));
-      return 0;
     }
   }
   //
@@ -530,7 +524,7 @@ AliMagF* AliMagF::CreateFieldMap(Float_t l3Cur, Float_t diCur, Int_t convention,
   else if (btypestr.Contains(protonBeam)) btype = kBeamTypepp;
   else AliInfoGeneral("AliMagF",Form("Assume no LHC magnet field for the beam type %s, ",beamtype));
   char ttl[80];
-  sprintf(ttl,"L3: %+5d Dip: %+4d kA; %s | Polarities in %s convention",(int)TMath::Sign(l3Cur,float(sclL3)),
+  snprintf(ttl,79,"L3: %+5d Dip: %+4d kA; %s | Polarities in %s convention",(int)TMath::Sign(l3Cur,float(sclL3)),
          (int)TMath::Sign(diCur,float(sclDip)),uniform ? " Constant":"",
          convention==kConvLHC ? "LHC":"DCS2008");
   // LHC and DCS08 conventions have opposite dipole polarities