#include "AliTPCCalibPedestal.h"
#include "AliTPCCalibPulser.h"
#include "AliTPCCalibCE.h"
+#include "AliTPCdataQA.h"
#include "TFile.h"
#include "TTree.h"
#include "TGraph.h"
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 = "PULSER"; // pulser run identifier
+const TString kPulserRunType = "CALIBRATION_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 kDaqRunType = "DAQ"; // DAQ run identifier
//______________________________________________________________________________________________
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();
AddRunType(kPulserRunType);
AddRunType(kPhysicsRunType);
AddRunType(kStandAloneRunType);
+ AddRunType(kStandAlonePulserRunType);
AddRunType(kCosmicRunType);
AddRunType(kLaserRunType);
AddRunType(kDaqRunType);
//______________________________________________________________________________________________
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");
{
// Creates AliTestDataDCS object -- start maps half an hour beforre actual run start
- UInt_t startTimeLocal = startTime-1800;
+ UInt_t startTimeLocal = startTime-3600;
+ UInt_t endTimeLocal = endTime+1800;
- AliPreprocessor::Initialize(run, startTimeLocal, endTime);
+ AliPreprocessor::Initialize(run, startTimeLocal, endTimeLocal);
AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
TTimeStamp((time_t)startTime,0).AsString(),
fConfigOK = kFALSE;
return;
}
- fTemp = new AliTPCSensorTempArray(startTimeLocal, fEndTime, confTree, kAmandaTemp);
+ fTemp = new AliTPCSensorTempArray(startTimeLocal, endTimeLocal, confTree, kAmandaTemp);
fTemp->SetValCut(kValCutTemp);
fTemp->SetDiffCut(kDiffCutTemp);
}
fConfigOK = kFALSE;
return;
}
- fHighVoltage = new AliDCSSensorArray(startTimeLocal, fEndTime, confTree);
+ fHighVoltage = new AliDCSSensorArray(startTimeLocal, endTimeLocal, confTree);
+ }
// High voltage status values
+ TString hvStatConf = fConfEnv->GetValue("HighVoltageStat","ON");
+ hvStatConf.ToUpper();
+ if (hvStatConf != "OFF" ) {
confTree=0;
entry=0;
entry = GetFromOCDB("Config", "HighVoltageStat");
fConfigOK = kFALSE;
return;
}
- fHighVoltageStat = new AliDCSSensorArray(startTimeLocal, fEndTime, confTree);
+ 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);
+ }
+
+
}
//______________________________________________________________________________________________
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");
if (source == "DAQHLT" ) numSources=2;
UInt_t pedestalResult=0;
for (Int_t i=0; i<numSources; i++ ) {
- UInt_t pedestalResult = ExtractPedestals(pedestalSource[i]);
+ pedestalResult = ExtractPedestals(pedestalSource[i]);
if ( pedestalResult == 0 ) break;
}
result += pedestalResult;
result += ceResult;
status = new TParameter<int>("ceResult",ceResult);
resultArray->Add(status);
+
+ numSources = 1;
+ Int_t qaSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
+ source = fConfEnv->GetValue("QA","DAQ");
+ source.ToUpper();
+ if ( source != "OFF" ) {
+ if ( source == "HLT") qaSource[0] = AliShuttleInterface::kHLT;
+ if (!GetHLTStatus()) qaSource[0] = AliShuttleInterface::kDAQ;
+ if (source == "HLTDAQ" ) {
+ numSources=2;
+ qaSource[0] = AliShuttleInterface::kHLT;
+ qaSource[1] = AliShuttleInterface::kDAQ;
+ }
+ if (source == "DAQHLT" ) numSources=2;
+ UInt_t qaResult=0;
+ for (Int_t i=0; i<numSources; i++ ) {
+ qaResult = ExtractQA(qaSource[i]);
+ if ( qaResult == 0 ) break;
+ }
+// result += qaResult;
+ if ( qaResult !=0 ) Log ("ExtractQA failed, no QA entry available.");
+ status = new TParameter<int>("qaResult",qaResult);
+ resultArray->Add(status);
}
+ }
}
if (errorHandling == "OFF" ) {
}
delete map;
- TMap *map2 = fHighVoltageStat->ExtractDCS(dcsAliasMap);
- if (map2) {
- fHighVoltageStat->StoreGraph(map2);
+ TString hvStatConf = fConfEnv->GetValue("HighVoltageStat","ON");
+ hvStatConf.ToUpper();
+ if (hvStatConf != "OFF" ) {
+ TMap *map2 = fHighVoltageStat->ExtractDCS(dcsAliasMap);
+ if (map2) {
+ fHighVoltageStat->ClearFit();
+ fHighVoltageStat->SetGraph(map2);
+ } else {
+ Log("No high voltage status recordings extracted. \n");
+ result=9;
+ }
+ delete map2;
+
+ // add status maps to high voltage sensor array
+
+ fHighVoltage->AddSensors(fHighVoltageStat);
+ }
+ // 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", "HighVoltage", fHighVoltage, &metaData, 0, kFALSE);
+ if ( !storeOK ) result=1;
+
+ }
+
+ return result;
+
+}
+
+//______________________________________________________________________________________________
+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 high voltage status recordings extracted. \n");
+ Log("No Goofie recordings extracted. \n");
result=9;
}
- delete map2;
-
- // add status maps to high voltage sensor array
-
- fHighVoltage->AddSensors(fHighVoltageStat);
+ delete map;
// Now store the final CDB file
metaData.SetResponsible("Haavard Helstrup");
metaData.SetComment("Preprocessor AliTPC data base entries.");
- Bool_t storeOK = Store("Calib", "HighVoltage", fHighVoltage, &metaData, 0, kFALSE);
+ Bool_t storeOK = Store("Calib", "Goofie", fGoofie, &metaData, 0, kFALSE);
if ( !storeOK ) result=1;
}
AliTPCCalROC *rocRMS=calPed->GetCalRocRMS(sector, kFALSE);
if ( rocRMS ) calPadRMS->SetCalROC(rocRMS,sector);
}
-
- f->Close();
delete calPed;
+ f->Close();
}
++index;
} // while(list)
AliTPCCalROC *rocQmean=calPulser->GetCalRocQ(sector);
if ( rocQmean ) pulserQmean->SetCalROC(rocQmean,sector);
}
- f->Close();
delete calPulser;
+ f->Close();
}
++index;
} // while(list)
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++) {
TGraph *grQ=calCE->MakeGraphTimeCE(sector,0,3); // Q time graph
if ( grQ ) rocTtime->AddAt(grQ,sector);
}
- f->Close();
delete calCE;
+ f->Close();
}
++index;
} // while(list)
return result;
}
+//______________________________________________________________________________________________
+
+UInt_t AliTPCPreprocessor::ExtractQA(Int_t sourceFXS)
+{
+ //
+ // Read Quality Assurance file from file exchage server
+ //
+
+ UInt_t result=0;
+
+ TList* list = GetFileSources(sourceFXS,"QA");
+
+ if (list && list->GetEntries()>0) {
+
+// only one QA objetc should be available!
+
+ AliTPCdataQA *calQA;
+
+ UInt_t nentries = list->GetEntries();
+ UInt_t index=0;
+ if ( nentries > 1) Log ( "More than one QA entry. First one processed");
+ TObjString* fileNameEntry = (TObjString*) list->At(index);
+ if (fileNameEntry!=NULL) {
+ TString fileName = GetFile(sourceFXS, "QA",
+ fileNameEntry->GetString().Data());
+ TFile *f = TFile::Open(fileName);
+ if (!f) {
+ Log ("Error opening QA file.");
+ 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;
+ }
+ }
+ } else {
+ Log ("Error: no QA files on FXS!");
+ result = 2;
+ }
+ } else {
+ Log ("Error: no QA entries in FXS list!");
+ result = 1;
+ }
+ return result;
+}
+