]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCPreprocessor.cxx
Removing obsolete mapping macro
[u/mrichter/AliRoot.git] / TPC / AliTPCPreprocessor.cxx
index 6b0b270d7af9d470015b52a3cb731b5c89b981fb..179d9f8a488a0953c2823ff2f508c3f6be2c48d3 100644 (file)
 const Int_t kValCutTemp = 100;               // discard temperatures > 100 degrees
 const Int_t kDiffCutTemp = 5;               // discard temperature differences > 5 degrees
 const TString kPedestalRunType = "PEDESTAL";  // pedestal run identifier
-const TString kPulserRunType = "CALIBRATION_PULSER";   // pulser run identifier
+const TString kPulserRunType = "PULSER";     // pulser run identifier
 const TString kPhysicsRunType = "PHYSICS";   // physics run identifier
-const TString kStandAloneRunType = "STANDALONE"; // standalone run identifier
-const TString kStandAlonePulserRunType = "STANDALONE_PULSER"; // standalone run identifier
-const TString kCosmicRunType = "COSMIC"; // cosmic run identifier
-const TString kLaserRunType = "LASER";   // laser run identifier
+const TString kCosmicRunType = "COSMIC";     // cosmic run identifier
+const TString kLaserRunType = "LASER";       // laser run identifier
 const TString kDaqRunType = "DAQ"; // DAQ run identifier
 const TString kAmandaTemp = "TPC_PT_%d_TEMPERATURE"; // Amanda string for temperature entries
 //const Double_t kFitFraction = 0.7;                 // Fraction of DCS sensor fits required              
@@ -59,7 +57,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();
@@ -69,8 +67,6 @@ AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
   AddRunType(kPedestalRunType);
   AddRunType(kPulserRunType);
   AddRunType(kPhysicsRunType);
-  AddRunType(kStandAloneRunType);
-  AddRunType(kStandAlonePulserRunType);
   AddRunType(kCosmicRunType);
   AddRunType(kLaserRunType);
   AddRunType(kDaqRunType);
@@ -79,7 +75,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 +176,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 +251,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");
@@ -298,11 +325,22 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
     }
   }
 
+  // Altro configuration
+
+
+  TString altroConf = fConfEnv->GetValue("AltroConf","ON");
+  goofieConf.ToUpper();
+  if (altroConf != "OFF" ) { 
+   UInt_t altroResult = ExtractAltro(AliShuttleInterface::kDCS);
+   result+=altroResult;
+   status = new TParameter<int>("altroResult",altroResult);
+   resultArray->Add(status);
+ }
 
 
   // Central Electrode processing
 
-  if( runType == kPhysicsRunType || runType == kStandAloneRunType || 
+  if( runType == kPhysicsRunType || 
       runType == kDaqRunType ) {    
 
 //   if (true) {                 // do CE processing for all run types
@@ -330,7 +368,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 +500,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 +806,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++) {
@@ -801,17 +879,18 @@ UInt_t AliTPCPreprocessor::ExtractQA(Int_t sourceFXS)
          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!");
@@ -824,3 +903,146 @@ UInt_t AliTPCPreprocessor::ExtractQA(Int_t sourceFXS)
   return result;
 }
 
+//______________________________________________________________________________________________
+
+
+UInt_t AliTPCPreprocessor::ExtractAltro(Int_t sourceFXS)
+{
+ //
+ //  Read pulser calibration file from file exchage server
+ //  Keep original entry from OCDB in case no new pulser calibration is available
+ //
+ TObjArray    *altroObjects=0;
+ AliTPCCalPad *acqStart=0;
+ AliTPCCalPad *zsThr=0;
+ AliTPCCalPad *acqStop=0;
+ AliTPCCalPad *FPED=0;
+ AliTPCCalPad *masked=0;
+
+ AliCDBEntry* entry = GetFromOCDB("Calib", "Altro");
+ if (entry) altroObjects = (TObjArray*)entry->GetObject();
+ if ( altroObjects==NULL ) {
+     Log("AliTPCPreprocsessor: No previous TPC altro calibration entry available.\n");
+     altroObjects = new TObjArray;    
+ }
+
+ acqStart = (AliTPCCalPad*)altroObjects->FindObject("AcqStart");
+ if ( !acqStart ) {
+    acqStart = new AliTPCCalPad("AcqStart","AcqStart");
+    altroObjects->Add(acqStart);
+ }
+ zsThr = (AliTPCCalPad*)altroObjects->FindObject("ZsThr");
+ if ( !zsThr )  { 
+    zsThr = new AliTPCCalPad("ZsThr","ZsThr");
+    altroObjects->Add(zsThr);
+ }
+ FPED = (AliTPCCalPad*)altroObjects->FindObject("FPED");
+ if ( !FPED )  { 
+    FPED = new AliTPCCalPad("FPED","FPED");
+    altroObjects->Add(FPED);
+ }
+ acqStop = (AliTPCCalPad*)altroObjects->FindObject("AcqStop");
+ if ( !acqStop ) {
+    acqStop = new AliTPCCalPad("AcqStop","AcqStop");
+    altroObjects->Add(acqStop);
+ }
+ masked = (AliTPCCalPad*)altroObjects->FindObject("Masked");
+ if ( !masked )  { 
+    masked = new AliTPCCalPad("Masked","Masked");
+    altroObjects->Add(masked);
+ }
+
+
+
+ UInt_t result=0;
+ TString idFXS[2]={"AltroConfigA","AltroConfigC"};
+
+ Int_t nSectors = fROC->GetNSectors();
+ Bool_t changed=false;
+ for ( Int_t id=0; id<2; id++) {
+   TList* list = GetFileSources(sourceFXS,idFXS[id].Data());
+   if (list && list->GetEntries()>0) {
+      if (altroObjects == 0 ) altroObjects = new TObjArray;
+
+//  loop through all files from LDCs
+
+    UInt_t index = 0;
+    while (list->At(index)!=NULL) {
+     TObjString* fileNameEntry = (TObjString*) list->At(index);
+     if (fileNameEntry!=NULL) {
+        TString fileName = GetFile(sourceFXS, idFXS[id].Data(),
+                                        fileNameEntry->GetString().Data());
+        TFile *f = TFile::Open(fileName);
+        if (!f) {
+          char message[40];
+         sprintf(message,"Error opening Altro configuration file, id = %d",id);
+         Log (message);
+         result =2;
+         break;
+       }
+        TObjArray *altroFXS;
+       f->GetObject("AltroConfig",altroFXS);
+        if ( !altroFXS ) {
+         Log ("No Altro configuration object in file.");
+         result = 2;
+         break;
+       }
+
+        //  replace entries for the sectors available in the present file
+        AliTPCCalPad *acqStartFXS=(AliTPCCalPad*)altroFXS->FindObject("AcqStart");
+        AliTPCCalPad *zsThrFXS=(AliTPCCalPad*)altroFXS->FindObject("ZsThr");
+        AliTPCCalPad *acqStopFXS=(AliTPCCalPad*)altroFXS->FindObject("AcqStop");
+        AliTPCCalPad *FPEDFXS=(AliTPCCalPad*)altroFXS->FindObject("FPED");
+        AliTPCCalPad *maskedFXS=(AliTPCCalPad*)altroFXS->FindObject("Masked");
+
+        changed=true;
+        for (Int_t sector=0; sector<nSectors; sector++) {
+            
+           if (acqStartFXS) {
+             AliTPCCalROC *rocAcqStart=acqStartFXS->GetCalROC(sector);
+              if ( rocAcqStart )  acqStart->SetCalROC(rocAcqStart,sector);
+          }
+          if (zsThrFXS ) {
+              AliTPCCalROC *rocZsThr=zsThrFXS->GetCalROC(sector);
+              if ( rocZsThr )  zsThr->SetCalROC(rocZsThr,sector);
+          }
+          if (acqStopFXS) {
+              AliTPCCalROC *rocAcqStop=acqStopFXS->GetCalROC(sector);
+              if ( rocAcqStop )  acqStop->SetCalROC(rocAcqStop,sector);
+          }
+          if (FPEDFXS ) {
+              AliTPCCalROC *rocFPED=FPEDFXS->GetCalROC(sector);
+              if ( rocFPED )  FPED->SetCalROC(rocFPED,sector);
+          }
+          if (maskedFXS) {
+              AliTPCCalROC *rocMasked=maskedFXS->GetCalROC(sector);
+              if ( rocMasked )  masked->SetCalROC(rocMasked,sector);
+          }
+        }
+       delete altroFXS;
+       f->Close();
+      }
+     ++index;
+     }  // while(list)
+    } else {
+      Log ("Error: no entries in input file list!");
+      result = 1;
+    }
+
+   }   // for - id
+//
+//  Store updated pedestal entry to OCDB
+//
+    if (changed) {
+     AliCDBMetaData metaData;
+     metaData.SetBeamPeriod(0);
+     metaData.SetResponsible("Haavard Helstrup");
+     metaData.SetComment("Preprocessor AliTPC data base entries.");
+
+     Bool_t storeOK = Store("Calib", "AltroConfig", altroObjects, &metaData, 0, kTRUE);
+     if ( !storeOK ) ++result;
+    }  
+
+  return result;
+}