]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCPreprocessor.cxx
adding transparent access to AliDAQ, adding special HLTOUT kRawReader
[u/mrichter/AliRoot.git] / TPC / AliTPCPreprocessor.cxx
index 84dfa3d2174bfac1065db6d7bdcad5fbf45a2dac..cd0aa9f77093d5bb934605937c8640ab1f4aa87d 100644 (file)
@@ -59,7 +59,7 @@ ClassImp(AliTPCPreprocessor)
 //______________________________________________________________________________________________
 AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
   AliPreprocessor("TPC",shuttle),
-  fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fConfigOK(kTRUE), fROC(0)
+  fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0), fConfigOK(kTRUE), fROC(0)
 {
   // constructor
   fROC = AliTPCROC::Instance();
@@ -79,7 +79,7 @@ AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
 //______________________________________________________________________________________________
  AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor&  ) :
    AliPreprocessor("TPC",0),
-   fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fConfigOK(kTRUE), fROC(0)
+   fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0), fConfigOK(kTRUE), fROC(0)
  {
 
    Fatal("AliTPCPreprocessor", "copy constructor not implemented");
@@ -180,6 +180,25 @@ void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
         }
         fHighVoltageStat = new AliDCSSensorArray(startTimeLocal, endTimeLocal, confTree);
       }
+
+   // Goofie values
+     
+      TString goofieConf = fConfEnv->GetValue("Goofie","ON");
+      goofieConf.ToUpper();
+      if (goofieConf != "OFF" ) { 
+        confTree=0;
+        entry=0;
+        entry = GetFromOCDB("Config", "Goofie");
+        if (entry) confTree = (TTree*) entry->GetObject();
+        if ( confTree==0 ) {
+           Log("AliTPCPreprocsessor: Goofie Config OCDB entry missing.\n");
+           fConfigOK = kFALSE;
+           return;
+        }
+        fGoofie = new AliDCSSensorArray(startTimeLocal, endTimeLocal, confTree);
+      }
+
+
 }
 
 //______________________________________________________________________________________________
@@ -236,6 +255,18 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
    resultArray->Add(status);
  }
 
+  // Goofie values
+
+
+  TString goofieConf = fConfEnv->GetValue("Goofie","ON");
+  goofieConf.ToUpper();
+  if (goofieConf != "OFF" ) { 
+   UInt_t goofieResult = MapGoofie(dcsAliasMap);
+   result+=goofieResult;
+   status = new TParameter<int>("goofieResult",goofieResult);
+   resultArray->Add(status);
+ }
+
   // Other calibration information will be retrieved through FXS files
   //  examples:
   //    TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals");
@@ -330,7 +361,7 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
 
     numSources = 1;
     Int_t qaSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
-    TString source = fConfEnv->GetValue("QA","DAQ");
+    source = fConfEnv->GetValue("QA","DAQ");
     source.ToUpper();
     if ( source != "OFF" ) { 
      if ( source == "HLT") qaSource[0] = AliShuttleInterface::kHLT;
@@ -462,6 +493,41 @@ UInt_t AliTPCPreprocessor::MapHighVoltage(TMap* dcsAliasMap)
 
 }
 
+//______________________________________________________________________________________________
+UInt_t AliTPCPreprocessor::MapGoofie(TMap* dcsAliasMap)
+{
+
+   // extract DCS Goofie maps. Do not perform fits (low update rate)
+
+  UInt_t result=0;
+
+  TMap *map = fGoofie->ExtractDCS(dcsAliasMap);
+  if (map) {
+    fGoofie->ClearFit();
+    fGoofie->SetGraph(map);
+  } else {
+    Log("No Goofie recordings extracted. \n");
+    result=9;
+  }
+  delete map;
+
+  // Now store the final CDB file
+
+  if ( result == 0 ) {
+        AliCDBMetaData metaData;
+       metaData.SetBeamPeriod(0);
+       metaData.SetResponsible("Haavard Helstrup");
+       metaData.SetComment("Preprocessor AliTPC data base entries.");
+
+       Bool_t storeOK = Store("Calib", "Goofie", fGoofie, &metaData, 0, kFALSE);
+        if ( !storeOK )  result=1;
+
+   }
+
+   return result;
+
+}
+
 
 //______________________________________________________________________________________________
 
@@ -733,6 +799,11 @@ UInt_t AliTPCPreprocessor::ExtractCE(Int_t sourceFXS)
         AliTPCCalibCE *calCE;
        f->GetObject("tpcCalibCE",calCE);
 
+        if (!calCE) {
+         Log ("No valid calibCE object.");
+         result=2;
+         break;
+       }
         //  replace entries for the sectors available in the present file
 
         for (Int_t sector=0; sector<nSectors; sector++) {
@@ -798,28 +869,30 @@ UInt_t AliTPCPreprocessor::ExtractQA(Int_t sourceFXS)
         TFile *f = TFile::Open(fileName);
         if (!f) {
          Log ("Error opening QA file.");
-         result =2;
-       }
-       f->GetObject("tpcCalibQA",calQA);
-
-        f->Close();
-    }  
+         result =2;          
+       } else {
+         f->GetObject("tpcCalibQA",calQA);
+          if ( calQA ) {      
 //
 //  Store updated pedestal entry to OCDB
 //
-    AliCDBMetaData metaData;
-    metaData.SetBeamPeriod(0);
-    metaData.SetResponsible("Haavard Helstrup");
-    metaData.SetComment("Preprocessor AliTPC data base entries.");
-
-    Bool_t storeOK = Store("Calib", "QA", calQA, &metaData, 0, kTRUE);
-    if ( !storeOK ) ++result;
-    
+           AliCDBMetaData metaData;
+           metaData.SetBeamPeriod(0);
+           metaData.SetResponsible("Haavard Helstrup");
+           metaData.SetComment("Preprocessor AliTPC data base entries.");
+
+           Bool_t storeOK = Store("Calib", "QA", calQA, &metaData, 0, kTRUE);
+           if ( !storeOK ) ++result;
+         }
+        }
+    } else {
+    Log ("Error: no QA files on FXS!");
+    result = 2;
+    }
   } else {
-    Log ("Error: no entries!");
+    Log ("Error: no QA entries in FXS list!");
     result = 1;
   }
-
   return result;
 }