Updated TPC preprocessor to include gas composition entries
authorhaavard <haavard.helstrup@cern.ch>
Fri, 14 Nov 2014 12:58:09 +0000 (13:58 +0100)
committerhaavard <haavard.helstrup@cern.ch>
Fri, 14 Nov 2014 13:16:03 +0000 (14:16 +0100)
TPC/Base/AliTPCPreprocessor.cxx
TPC/Base/AliTPCPreprocessor.h

index 9e87390..9c2cf03 100644 (file)
@@ -43,6 +43,9 @@ const Int_t kDiffCutTemp = 5;              // discard temperature differences >
 const Double_t kHighVoltageDifference = 1e-4; // don't record High Voltage points 
                                              // differing by less than 1e-4 from
                                             // previous point.
+const Double_t kGasCompositionDifference = 1e-3; // don't record Gas Composition points 
+                                             // differing by less than 1e-3 from
+                                            // previous point
 const TString kPedestalRunType = "PEDESTAL";  // pedestal run identifier
 const TString kPulserRunType = "PULSER";     // pulser run identifier
 const TString kPhysicsRunType = "PHYSICS";   // physics run identifier
@@ -74,7 +77,7 @@ ClassImp(AliTPCPreprocessor)
 AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
   AliPreprocessor("TPC",shuttle),
   fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0),
-  fPressure(0), fConfigOK(kTRUE), fROC(0)
+  fPressure(0), fGasComposition(0), fConfigOK(kTRUE), fROC(0)
 {
   // constructor
   fROC = AliTPCROC::Instance();
@@ -93,7 +96,7 @@ AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
  AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor&  ) :
    AliPreprocessor("TPC",0),
    fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0),
-   fPressure(0), fConfigOK(kTRUE), fROC(0)
+   fPressure(0), fGasComposition(0), fConfigOK(kTRUE), fROC(0)
  {
 
    Fatal("AliTPCPreprocessor", "copy constructor not implemented");
@@ -214,6 +217,26 @@ void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
         fGoofie = new AliDCSSensorArray(startTime, endTime, confTree);
       }
 
+
+  // Gas composition measurements
+
+      TString gasConf = fConfEnv->GetValue("GasComposition","OFF");
+      gasConf.ToUpper();
+      if (gasConf != "OFF" ) { 
+        confTree=0;
+        entry=0;
+        entry = GetFromOCDB("Config", "GasComposition");
+        if (entry) confTree = (TTree*) entry->GetObject();
+        if ( confTree==0 ) {
+           Log("AliTPCPreprocsessor: Gas Composition Config OCDB entry missing.\n");
+           fConfigOK = kFALSE;
+           return;
+        }
+        time_t timeStart = (time_t)(((TString)GetRunParameter("DAQ_time_start")).Atoi());
+       time_t timeEnd = (time_t)(((TString)GetRunParameter("DAQ_time_end")).Atoi());
+        fGasComposition = new AliDCSSensorArray (UInt_t(timeStart), 
+                                           UInt_t(timeEnd), confTree);
+      }
    // Pressure values
      
        TString runType = GetRunType();
@@ -297,6 +320,19 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
      resultArray->Add(status);
     }
 
+
+    // Gas composition recordings
+
+
+    TString gasConf = fConfEnv->GetValue("GasComposition","ON");
+    gasConf.ToUpper();
+    if (gasConf != "OFF" ) { 
+     UInt_t gasResult = MapGasComposition(dcsAliasMap);
+     if (gasConf != "TRY") result+=gasResult;
+     status = new TParameter<int>("gasResult",gasResult);
+     resultArray->Add(status);
+    }
+
     // Pressure values
 
     if( runType == kPhysicsRunType || 
@@ -647,6 +683,43 @@ UInt_t AliTPCPreprocessor::MapGoofie(TMap* dcsAliasMap)
 
 }
 
+//______________________________________________________________________________________________
+UInt_t AliTPCPreprocessor::MapGasComposition(TMap* dcsAliasMap)
+{
+
+   // extract DCS HV maps. Perform fits to save space
+
+  UInt_t result=0;
+  TMap *map = fGasComposition->ExtractDCS(dcsAliasMap);
+  if (map) {
+    fHighVoltage->ClearFit();
+    fHighVoltage->RemoveGraphDuplicates(kGasCompositionDifference);
+               // don't keep new point if too similar to previous one
+    fHighVoltage->SetGraph(map);
+  } else {
+    Log("No gas composition 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.SetAliRootVersion(ALIROOT_BRANCH);
+       metaData.SetComment("Preprocessor AliTPC data base entries.");
+
+       Bool_t storeOK = Store("Calib", "GasComposition", fGasComposition, &metaData, 0, kFALSE);
+        if ( !storeOK )  result=1;
+
+   }
+
+   return result;
+
+}
+
 
 //______________________________________________________________________________________________
 
index 12ea857..0df9c03 100644 (file)
@@ -25,6 +25,7 @@ class AliTPCPreprocessor : public AliPreprocessor
     virtual UInt_t Process(TMap* dcsAliasMap);
     UInt_t  MapTemperature(TMap* dcsAliasMap);
     UInt_t  MapHighVoltage(TMap* dcsAliasMap);
+    UInt_t  MapGasComposition(TMap* dcsAliasMap);
     UInt_t  MapGoofie(TMap* dcsAliasMap);
     UInt_t  MapPressure(TMap* dcsAliasMap);
     UInt_t  ExtractPedestals(Int_t sourceFXS);
@@ -42,6 +43,7 @@ class AliTPCPreprocessor : public AliPreprocessor
     AliDCSSensorArray      *fHighVoltageStat; // DCS high voltage status
     AliDCSSensorArray      *fGoofie;   // Goofie values from DCS
     AliDCSSensorArray      *fPressure;   // Pressure values from DCS
+    AliDCSSensorArray      *fGasComposition;   // Gas composition values from DCS
     Bool_t                 fConfigOK;  // Identify succesful reading of OCDB Config
     AliTPCROC              *fROC;      // TPC Read-Out configuration