+Int_t AliTRDcalibDB::GetOnlineGainTableID()
+{
+ //
+ // Get the gain table ID from the DCS
+ //
+
+ if (fOnlineGainTableID > 0) {
+ return fOnlineGainTableID;
+ }
+
+ const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
+ if (!dcsArr){
+ return -1;
+ }
+
+ Int_t esor = 0; // Take SOR
+ Int_t calver = 0; // Check CalDCS version
+ if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
+ if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
+
+ if (calver == 1) {
+
+ // No data for old DCS object available, anyway
+ return -1;
+
+ }
+ else if (calver == 2) {
+
+ // DCSv2 object
+ const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
+ if(!calDCSv2){
+ return -1;
+ }
+
+ TString tableName = "";
+ for (Int_t i = 0; i < 540; i++) {
+ const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(0);
+ tableName = calDCSFEEv2->GetGainTableName();
+ if (tableName.Length() > 0) {
+ break;
+ }
+ }
+ if (tableName.CompareTo("Krypton_2011-01") == 0) {
+ fOnlineGainTableID = 1;
+ return fOnlineGainTableID;
+ }
+ if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2011-01") == 0) {
+ fOnlineGainTableID = 2;
+ return fOnlineGainTableID;
+ }
+ if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2011-01") == 0) {
+ fOnlineGainTableID = 3;
+ return fOnlineGainTableID;
+ }
+ if (tableName.CompareTo("Krypton_2011-02") == 0) {
+ fOnlineGainTableID = 4;
+ return fOnlineGainTableID;
+ }
+
+ }
+ else {
+
+ AliError("NO DCS/DCSv2 OCDB entry found!");
+ return -1;
+
+ }
+
+ return -1;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDcalibDB::GetGlobalConfiguration(TString &config)
+{