]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCPreprocessor.cxx
Don't fit High Voltage values (use last recorded point from source map)
[u/mrichter/AliRoot.git] / TPC / AliTPCPreprocessor.cxx
index 13d1730c7210e5b173cd1dc36a2cfad6953e303d..76e82b92b64f466086bd9dde5389f1fcfd979577 100644 (file)
@@ -47,6 +47,9 @@ 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 TString kAmandaDDL = "DDL%d";   // Amanda string for list of active DDLs
+const Int_t  kNumDDL = 216;           // number of TPC DDLs
+const Int_t  kFirstDDL = 768;         // identifier of first DDL
 //const Double_t kFitFraction = 0.7;                 // Fraction of DCS sensor fits required              
 const Double_t kFitFraction = -1.0;          // Don't require minimum number of fits in commissioning run 
 const Int_t   kNumPressureSensors = 3;    // number of pressure sensors
@@ -166,7 +169,10 @@ void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
            fConfigOK = kFALSE;
            return;
         }
-        fHighVoltage = new AliDCSSensorArray(startTime, endTime, confTree);
+        time_t timeStart = (time_t)(((TString)GetRunParameter("DAQ_time_start")).Atoi());
+       time_t timeEnd = (time_t)(((TString)GetRunParameter("DAQ_time_end")).Atoi());
+        fHighVoltage = new AliDCSSensorArray (UInt_t(timeStart), 
+                                           UInt_t(timeEnd), confTree);
       }
 
    // High voltage status values
@@ -254,7 +260,7 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
     tempConf.ToUpper();
     if (tempConf != "OFF" ) {
       UInt_t tempResult = MapTemperature(dcsAliasMap);
-      result=tempResult;
+      if ( tempConf != "TRY") result+=tempResult;
       status = new TParameter<int>("tempResult",tempResult);
       resultArray->Add(status);
     }
@@ -266,7 +272,7 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
     hvConf.ToUpper();
     if (hvConf != "OFF" ) { 
      UInt_t hvResult = MapHighVoltage(dcsAliasMap);
-     result+=hvResult;
+     if (hvConf != "TRY") result+=hvResult;
      status = new TParameter<int>("hvResult",hvResult);
      resultArray->Add(status);
     }
@@ -278,7 +284,7 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
     goofieConf.ToUpper();
     if (goofieConf != "OFF" ) { 
      UInt_t goofieResult = MapGoofie(dcsAliasMap);
-     result+=goofieResult;
+     if (goofieConf != "TRY") result+=goofieResult;
      status = new TParameter<int>("goofieResult",goofieResult);
      resultArray->Add(status);
     }
@@ -348,12 +354,13 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
         pulserSource[1] = AliShuttleInterface::kDAQ;
      }
      if (source == "DAQHLT" ) numSources=2;
+     if (source == "TRY" ) numSources=2;
      UInt_t pulserResult=0;
      for (Int_t i=0; i<numSources; i++ ) {     
        pulserResult = ExtractPulser(pulserSource[i]);
        if ( pulserResult == 0 ) break;
      }
-     result += pulserResult;
+     if (source != "TRY") result += pulserResult;
      status = new TParameter<int>("pulserResult",pulserResult);
      resultArray->Add(status);
     }
@@ -376,12 +383,13 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
         rawSource[1] = AliShuttleInterface::kDAQ;
      }
      if (source == "DAQHLT" ) numSources=2;
+     if (source == "TRY" ) numSources=2;
      UInt_t rawResult=0;
      for (Int_t i=0; i<numSources; i++ ) {     
        rawResult = ExtractRaw(rawSource[i]);
        if ( rawResult == 0 ) break;
      }
-     result += rawResult;
+     if (source != "TRY" )result += rawResult;
      status = new TParameter<int>("rawResult",rawResult);
      resultArray->Add(status);
     }
@@ -394,8 +402,8 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
   TString altroConf = fConfEnv->GetValue("AltroConf","ON");
   altroConf.ToUpper();
   if (altroConf != "OFF" ) { 
-   UInt_t altroResult = ExtractAltro(AliShuttleInterface::kDCS);
-   result+=altroResult;
+   UInt_t altroResult = ExtractAltro(AliShuttleInterface::kDCS,dcsAliasMap);
+   if (altroConf != "TRY" ) result+=altroResult;
    status = new TParameter<int>("altroResult",altroResult);
    resultArray->Add(status);
  }
@@ -419,6 +427,7 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
        ceSource[1] = AliShuttleInterface::kDAQ;
      }
      if (source == "DAQHLT" ) numSources=2;
+     if (source == "TRY" ) numSources=2;
      UInt_t ceResult=0;
      for (Int_t i=0; i<numSources; i++ ) {     
        ceResult = ExtractCE(ceSource[i]);
@@ -428,7 +437,7 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
    // only flag error if CE result is missing from LASER runs
    //    -- for PHYSICS run do CE processing if data available
    
-     if ( runType == kLaserRunType ) result += ceResult;
+     if ( runType == kLaserRunType && source != "TRY" ) result += ceResult;
      status = new TParameter<int>("ceResult",ceResult);
      resultArray->Add(status);
 
@@ -445,6 +454,7 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
        qaSource[1] = AliShuttleInterface::kDAQ;
      }
      if (source == "DAQHLT" ) numSources=2;
+     if (source == "TRY" ) numSources=2;
      UInt_t qaResult=0;
      for (Int_t i=0; i<numSources; i++ ) {     
        qaResult = ExtractQA(qaSource[i]);
@@ -458,20 +468,20 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
    }
   }
   
-  if (errorHandling == "OFF" ) {
-    AliCDBMetaData metaData;
-    metaData.SetBeamPeriod(0);
-    metaData.SetResponsible("Haavard Helstrup");
-    metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
-    metaData.SetComment("Preprocessor AliTPC status.");
-    Store("Calib", "PreprocStatus", resultArray, &metaData, 0, kFALSE);
-    resultArray->Delete();
-    delete resultArray;
-    return 0;
-  } else { 
-    delete resultArray;
-    return result;
-  }
+// Store component status to OCDB
+
+  AliCDBMetaData metaData;
+  metaData.SetBeamPeriod(0);
+  metaData.SetResponsible("Haavard Helstrup");
+  metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
+  metaData.SetComment("Preprocessor AliTPC status.");
+  Store("Calib", "PreprocStatus", resultArray, &metaData, 0, kFALSE);
+  resultArray->Delete();
+  delete resultArray;
+
+  if (errorHandling == "OFF" ) return 0;
+  return result;
+  
 }
 //______________________________________________________________________________________________
 UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
@@ -524,7 +534,7 @@ UInt_t AliTPCPreprocessor::MapPressure(TMap* dcsAliasMap)
     fPressure->MakeSplineFit(map);
     Double_t fitFraction = 1.0*fPressure->NumFits()/fPressure->NumSensors(); 
     if (fitFraction > kFitFraction ) {
-      AliInfo(Form("Temperature values extracted, fits performed.\n"));
+      AliInfo(Form("Pressure values extracted, fits performed.\n"));
     } else { 
       Log ("Too few pressure maps fitted. \n");
       result = 9;
@@ -546,14 +556,8 @@ UInt_t AliTPCPreprocessor::MapHighVoltage(TMap* dcsAliasMap)
   UInt_t result=0;
   TMap *map = fHighVoltage->ExtractDCS(dcsAliasMap);
   if (map) {
-    fHighVoltage->MakeSplineFit(map, kTRUE);   // keep both spline fits and original maps
-    Double_t fitFraction = 1.0*fHighVoltage->NumFits()/fHighVoltage->NumSensors(); 
-    if (fitFraction > kFitFraction ) {
-      AliInfo(Form("High voltage recordings extracted, fits performed.\n"));
-    } else { 
-      Log ("Too few high voltage recordings fitted. \n");
-      result = 9;
-    }
+    fHighVoltage->ClearFit();
+    fHighVoltage->SetGraph(map);
   } else {
     Log("No high voltage recordings extracted. \n");
     result=9;
@@ -935,18 +939,22 @@ UInt_t AliTPCPreprocessor::ExtractCE(Int_t sourceFXS)
 // Temperature maps 
 
  if (fTemp) {
-    fTemp->SetNameTitle("TempMap","TempMap");
-    ceObjects->Add(fTemp);
+    AliTPCSensorTempArray *tempMap = new AliTPCSensorTempArray(*fTemp);
+    tempMap->SetNameTitle("TempMap","TempMap");
+    ceObjects->Add(tempMap);
  }
 
 // Pressure maps
 
  if (fPressure) {
-   AliDCSSensor *sensor=0;
+   AliDCSSensor *sensor=0, *sensorCopy=0;
    for (Int_t isensor=0; isensor<kNumPressureSensors; ++isensor ) {
       sensor = fPressure->GetSensor(kPressureSensorNames[isensor]);
-      sensor->SetNameTitle(kPressureSensorNames[isensor],kPressureSensorNames[isensor]);       
-      ceObjects->Add(sensor);
+      if (sensor) {
+       sensorCopy = new AliDCSSensor(*sensor);
+       sensorCopy->SetNameTitle(kPressureSensorNames[isensor],kPressureSensorNames[isensor]);       
+       ceObjects->Add(sensorCopy);
+      }
    }
  }   
 
@@ -1087,10 +1095,10 @@ UInt_t AliTPCPreprocessor::ExtractQA(Int_t sourceFXS)
 //______________________________________________________________________________________________
 
 
-UInt_t AliTPCPreprocessor::ExtractAltro(Int_t sourceFXS)
+UInt_t AliTPCPreprocessor::ExtractAltro(Int_t sourceFXS, TMap* dcsMap)
 {
  //
- //  Read pulser calibration file from file exchage server
+ //  Read Altro configuration file from file exchage server
  //  Keep original entry from OCDB in case no new pulser calibration is available
  //
  TObjArray    *altroObjects=0;
@@ -1178,11 +1186,46 @@ UInt_t AliTPCPreprocessor::ExtractAltro(Int_t sourceFXS)
 
  Int_t nSectors = fROC->GetNSectors();
  Bool_t changed=false;
+ if (altroObjects == 0 ) altroObjects = new TObjArray;
+
+// extract list of active DDLs
+
+  Bool_t found; 
+  TString arrDDL(kNumDDL);
+  arrDDL.Append('0',kNumDDL);
+  for ( Int_t iDDL = 0; iDDL<kNumDDL; iDDL++ ) {
+    TString stringID = Form (kAmandaDDL.Data(),iDDL+kFirstDDL);
+    TPair *pair = (TPair*)dcsMap->FindObject(stringID.Data());
+    found = false;
+    if ( pair ) {
+        TObjArray *valueSet=(TObjArray*)pair->Value();
+        if ( valueSet) { 
+         AliDCSValue *val = (AliDCSValue*)valueSet->At(0);
+         if (val) found = val->GetBool();
+       }
+    } 
+    if (found){
+      arrDDL[iDDL] = '1';
+    } else { 
+      arrDDL[iDDL] = '0';
+    }    
+  }
+  TObjString *ddlArray = new TObjString;
+  ddlArray->SetString(arrDDL);
+  TMap *activeDDL = new TMap;
+  activeDDL->SetName("DDLArray");
+  TObjString *key = new TObjString("DDLArray");
+  activeDDL->Add(key,ddlArray);
+  altroObjects->Add(activeDDL);
+  changed=true;
+  
+
+// extract Altro configuration files
+
  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