Add index i to GetCalDCSFEEObj()
authorcblume <Christoph.Blume@cern.ch>
Sat, 31 Jan 2015 16:25:37 +0000 (17:25 +0100)
committercblume <Christoph.Blume@cern.ch>
Sat, 31 Jan 2015 16:25:58 +0000 (17:25 +0100)
TRD/TRDbase/AliTRDcalibDB.cxx

index 33396e4..b0f64f5 100644 (file)
@@ -1101,11 +1101,21 @@ Int_t AliTRDcalibDB::GetOnlineGainTableID()
     TString tableName = "";
     for (Int_t i = 0; i < 540; i++) {
       const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(i);
-      tableName = calDCSFEEv2->GetGainTableName();
-      if (tableName.Length() > 0) {
-        break;
+      if (!calDCSFEEv2) {
+        continue;
+      }
+      const TString tableNameTmp = calDCSFEEv2->GetGainTableName();
+      if (tableNameTmp.Length() > 0) {
+        if ((tableName.Length() > 0) &&
+            (tableName != tableNameTmp)) {
+          AliFatal(Form("Inconsistent gain table names! %s - %s"
+                       ,tableName.Data(),tableNameTmp.Data()));
+          continue; // maybe return -1;
+        }
+        tableName = tableNameTmp; // this contains the first entry found
       }
     }
+
     if      (tableName.CompareTo("Krypton_2011-01")               == 0)
       fOnlineGainTableID = 1;
     else if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2011-01") == 0)