#include "AliGRPDCS.h"
#include "AliDCSSensorArray.h"
+#include "AliTriggerConfiguration.h"
+#include "AliTriggerRunScalers.h"
+
#include "AliCDBMetaData.h"
#include "AliLog.h"
// DAQ FXS //
//=================//
UInt_t iDaqFxs = ProcessDaqFxs();
- if(iDaqFxs == 1) {
- Log(Form("Raw data tags merged successfully!"));
+ if(iDaqFxs == 0) {
+ Log(Form("ProcessDaqFxs successful!"));
} else {
Log(Form("Could not store run raw tag file!"));
return 1;
}
+ //=================//
+ // DCS FXS //
+ //=================//
+ UInt_t iDcsFxs = ProcessDcsFxs();
+ if(iDcsFxs == 0) {
+ Log(Form("ProcessDcsFxs successful!"));
+ } else {
+ Log(Form("Could not store CTP run configuration and scalers!"));
+ return 1;
+ }
//=================//
// DCS data points //
TList *dcsdplist = ProcessDcsDPs(valueMap, iStartTime, iStopTime);
if(!dcsdplist) {
Log(Form("Problem with the DCS data points!!!"));
- return 1;
+ return 1;
}
if(dcsdplist->GetEntries() != 10) {
Log(Form("Problem with the DCS data points!!!"));
- return 1;
+ // return 1; // TODO:COMMENTED FOR TESTING PURPOSES!
}
//NEEDS TO BE REVISED - BREAKS!!!
// AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap,fPressure);
//_______________________________________________________________
UInt_t AliGRPPreprocessor::ProcessDaqFxs() {
//======DAQ FXS======//
- TChain *fRawTagChain = new TChain("T");
TList* list = GetFileSources(kDAQ);
if (!list) {
- Log("No raw data tag list found!!!");
- return 0;
+ Log("No raw data tag list: connection problems with DAQ FXS logbook!");
+ return 1;
+ }
+
+ if (list->GetEntries() == 0)
+ {
+ Log("no raw data tags in this run: nothing to merge!");
+ delete list; list=0;
+ return 0;
}
+
+ TChain *fRawTagChain = new TChain("T");
+ Int_t nFiles=0;
TIterator* iter = list->MakeIterator();
TObject* obj = 0;
while ((obj = iter->Next())) {
Log(Form("Found source %s", objStr->String().Data()));
TList* list2 = GetFileIDs(kDAQ, objStr->String());
if (!list2) {
- Log("No list with ids from DAQ was found!!!");
- return 0;
+ Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
+ delete fRawTagChain; fRawTagChain=0;
+ return 1;
}
Log(Form("Number of ids: %d",list2->GetEntries()));
for(Int_t i = 0; i < list2->GetEntries(); i++) {
TObjString *idStr = (TObjString *)list2->At(i);
- //Log(Form("Filename1: %s",idStr->String().Data()));
- TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
- Log(Form("Adding file in the chain: %s",fileName.Data()));
- fRawTagChain->Add(fileName.Data());
- //fRawDataFileName = fileName(0,fileName.First("_"));
+ TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
+ if (fileName.Length() > 0)
+ {
+ Log(Form("Adding file in the chain: %s",fileName.Data()));
+ fRawTagChain->Add(fileName.Data());
+ nFiles++;
+ } else {
+ Log(Form("Could not retrieve file with id %s from source %s: "
+ "connection problems with DAQ FXS!",
+ idStr->String().Data(),objStr->String().Data()));
+ delete list; list=0;
+ delete list2; list2=0;
+ delete fRawTagChain; fRawTagChain=0;
+ return 2;
+ }
}
delete list2;
}
}
- delete iter;
- delete list;
+
TString fRawDataFileName = "GRP_Merged.tag.root";
- Log(Form("Merging raw data tags into file: %s",fRawDataFileName.Data()));
+ Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
fRawTagChain->Merge(fRawDataFileName);
TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
+
+ if (!result)
+ {
+ Log("Problem storing raw data tags in local file!!");
+ } else {
+ Log("Raw data tags merged successfully!!");
+ }
+
+ delete iter;
+ delete list;
+ delete fRawTagChain; fRawTagChain=0;
+
+ if (result == kFALSE)
+ {
+ return 3;
+ }
+
+ return 0;
+
+}
+
+//_______________________________________________________________
+UInt_t AliGRPPreprocessor::ProcessDcsFxs() {
+ //======DCS FXS======//
+ // Get the CTP run configuration
+ // and scalers from DCS FXS
+
+ {
+ // Get the CTP run configuration
+ TList* list = GetFileSources(kDCS,"CTP_runconfig");
+ if (!list) {
+ Log("No CTP runconfig file: connection problems with DAQ FXS logbook!");
+ return 1;
+ }
+
+ if (list->GetEntries() == 0) {
+ Log("No CTP runconfig file to be processed!");
+ }
+ else {
+ TIter iter(list);
+ TObjString *source;
+ while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
+ TString runcfgfile = GetFile(kDCS, "CTP_runconfig", source->GetName());
+ if (runcfgfile.IsNull()) {
+ Log("No CTP runconfig files has been found: empty source!");
+ }
+ else {
+ Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
+ AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
+ if (!runcfg) {
+ Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
+ }
+ else {
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Roman Lietava");
+ metaData.SetComment("CTP run configuration");
+ if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
+ Log("Unable to store the CTP run configuration object to OCDB!");
+ }
+ }
+ }
+ }
+ }
+ delete list;
+ }
+
+ {
+ // Get the CTP counters information
+ TList* list = GetFileSources(kDCS,"CTP_xcounters");
+ if (!list) {
+ Log("No CTP counters file: connection problems with DAQ FXS logbook!");
+ return 1;
+ }
+
+ if (list->GetEntries() == 0) {
+ Log("No CTP counters file to be processed!");
+ }
+ else {
+ TIter iter(list);
+ TObjString *source;
+ while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
+ TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
+ if (countersfile.IsNull()) {
+ Log("No CTP counters files has been found: empty source!");
+ }
+ else {
+ Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
+ AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
+ if (!scalers) {
+ Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
+ }
+ else {
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Roman Lietava");
+ metaData.SetComment("CTP scalers");
+ if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
+ Log("Unable to store the CTP scalers object to OCDB!");
+ }
+ }
+ }
+ }
+ }
+ delete list;
+ }
- return (UInt_t) result;
+ return 0;
}
//_______________________________________________________________