]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Correcting the treatment of the current signs and magnet polarities.
authorbelikov <belikov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Jun 2008 14:02:58 +0000 (14:02 +0000)
committerbelikov <belikov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Jun 2008 14:02:58 +0000 (14:02 +0000)
STEER/AliReconstruction.cxx
STEER/AliReconstruction.h

index bb0bbf1d95ed294fe8b56f534d475192b7ed2f8d..8bbab2b40198069c44872fe1b03d203d1b713c87 100644 (file)
@@ -649,7 +649,7 @@ void AliReconstruction::SetOption(const char* detector, const char* option)
 }
 
 //_____________________________________________________________________________
-Bool_t AliReconstruction::ForceFieldMap(Float_t l3Current, Float_t diCurrent, Float_t factor, Char_t *path) {
+Bool_t AliReconstruction::SetFieldMap(Float_t l3Current, Float_t diCurrent, Float_t factor, const char *path) {
   //------------------------------------------------
   // The magnetic field map, defined externally...
   // L3 current 30000 A  -> 0.5 T
@@ -667,7 +667,7 @@ Bool_t AliReconstruction::ForceFieldMap(Float_t l3Current, Float_t diCurrent, Fl
   Int_t map=0;
   Bool_t dipoleON=kFALSE;
 
-  TString s=(l3Current < 0) ? "L3: -" : "L3: +";
+  TString s=(factor < 0) ? "L3: -" : "L3: +";
 
   if (TMath::Abs(l3Current-l3NominalCurrent1)/l3NominalCurrent1 < tolerance) {
     map=AliMagWrapCheb::k5kG;
@@ -731,18 +731,20 @@ Bool_t AliReconstruction::InitGRP() {
   } else {
     // Construct the field map out of the information retrieved from GRP.
 
+    Bool_t ok = kTRUE;
+
     // L3
     TObjString *l3Current=
        dynamic_cast<TObjString*>(fGRPData->GetValue("fL3Current"));
     if (!l3Current) {
       AliError("GRP/GRP/Data entry:  missing value for the L3 current !");
-      return kFALSE;
+      ok = kFALSE;
     }
     TObjString *l3Polarity=
        dynamic_cast<TObjString*>(fGRPData->GetValue("fL3Polarity"));
     if (!l3Polarity) {
       AliError("GRP/GRP/Data entry:  missing value for the L3 polarity !");
-      return kFALSE;
+      ok = kFALSE;
     }
 
     // Dipole
@@ -750,23 +752,32 @@ Bool_t AliReconstruction::InitGRP() {
        dynamic_cast<TObjString*>(fGRPData->GetValue("fDipoleCurrent"));
     if (!diCurrent) {
       AliError("GRP/GRP/Data entry:  missing value for the dipole current !");
-      return kFALSE;
+      ok = kFALSE;
     }
     TObjString *diPolarity=
        dynamic_cast<TObjString*>(fGRPData->GetValue("fDipolePolarity"));
     if (!diPolarity) {
       AliError("GRP/GRP/Data entry:  missing value for the dipole polarity !");
-      return kFALSE;
+      ok = kFALSE;
     }
 
-    Float_t l3Cur=atof(l3Current->GetName());
-    Float_t diCur=atof(diCurrent->GetName());
+    if (ok) { 
+       Float_t l3Cur=TMath::Abs(atof(l3Current->GetName()));
+       Float_t diCur=TMath::Abs(atof(diCurrent->GetName()));
+       Float_t l3Pol=atof(l3Polarity->GetName());
+       Float_t factor=1.;
+       if (l3Pol != 0.) factor=-1.;
+    
 
-    if (!ForceFieldMap(l3Cur, diCur)) {
-       AliFatal("Failed to creat a B field map ! Crashing...");
+      if (!SetFieldMap(l3Cur, diCur, factor)) {
+         AliFatal("Failed to creat a B field map ! Exiting...");
+      }
+      AliInfo("Running with the B field constructed out of GRP !");
+    }
+    else {
+      AliFatal("B field is neither set nor constructed from GRP ! Exitig...");
     }
 
-    AliInfo("Running with the B field constructed out of GRP !");
   }
 
 
index 66fc9eea7b6d45bbed6ec4b3ec5cfd8118201961..39172e4a1737d25bae3bb365b5cf4d1ee0637ddc 100644 (file)
@@ -76,9 +76,9 @@ public:
   //*** Magnetic field setters
   void SetUniformFieldTracking(Bool_t flag=kTRUE){fUniformField=flag;} 
   Bool_t 
-  ForceFieldMap(Float_t l3Current=30000., Float_t diCurrent=6000., 
-               Float_t factor=1., 
-                Char_t *path="$(ALICE_ROOT)/data/maps/mfchebKGI_meas.root");
+  SetFieldMap(Float_t l3Current=30000., Float_t diCurrent=6000., 
+             Float_t factor=1., 
+              const char *path="$(ALICE_ROOT)/data/maps/mfchebKGI_meas.root");
 
   //*** Global reconstruction flag setters
   void SetRunVertexFinder(Bool_t flag=kTRUE) {fRunVertexFinder=flag;};