]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/TestShuttle/AliTestPreprocessor.cxx
Function Bool_t GetHLTStatus added to preprocessor. It returns the status of HLT
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / AliTestPreprocessor.cxx
index 66d43390789f85d22264f146965be14d2b5a18eb..5ae4ef1b30d192b10dad8ae23e3b731e4ff90e90 100644 (file)
@@ -72,7 +72,7 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
        Log("ERROR: No DCS map provided by SHUTTLE!");
        return 1;
   }
-  
+
   // The processing of the DCS input data is forwarded to AliTestDataDCS
   fData->ProcessData(*dcsAliasMap);
 
@@ -84,17 +84,29 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
 
   // Example of how to retrieve the list of sources that produced the file with id DRIFTVELOCITY
   TList* sourceList = GetFileSources(kDAQ, "DRIFTVELOCITY");
+  sourceList = GetFileSources(kHLT, "HLTData");
   if (!sourceList)
   {
-       Log("Error: No sources found for id DRIFTVELOCITY!");
-       return 1;
+       Log("Error retrieving list of sources from FXS!");
+       return 1;
   }
-  
-  // TODO We have the list of sources that produced the files with Id DRIFTVELOCITY. 
+
+  if (sourceList->GetEntries() == 0)
+  {
+       Log("No sources found for id HLTData!");
+       // TODO What to do now depends on the expected behaviour of the
+       // online DA: if it expected to produce data for the FXS every run, then
+       // if no sources are found it means a problem happened and you should return error;
+       // if DA may or may not send files to FXS, then you shouldn't return error
+       // and go on with the analysis!
+       return 1;
+  }
+
+  // TODO We have the list of sources that produced the files with Id DRIFTVELOCITY.
   // Now we will loop on the list and we'll query the files one by one. 
   Log("The following sources produced files with the id DRIFTVELOCITY");
   sourceList->Print();
-  
+
   TIter iter(sourceList);
   TObjString *source = 0;
   while((source=dynamic_cast<TObjString*> (iter.Next()))){
@@ -105,6 +117,72 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
 
   delete sourceList;
 
+  // Example of retrieving files from HLT, including how to query HLT status
+
+  Bool_t hltStatus = GetHLTStatus(); // 1 = HLT ON (=> Query HLT), 0 = HLT OFF (=> skip HLT query)
+
+  if (hltStatus)
+  {
+       Log("HLT is ON, let's query our files");
+       sourceList = GetFileSources(kHLT, "HLTData");
+       if (!sourceList)
+       {
+               Log("Error retrieving list of sources from FXS!");
+               return 1;
+       }
+
+       if (sourceList->GetEntries() == 0)
+       {
+               Log("No sources found for id HLTData!");
+               // TODO What to do now depends on the expected behaviour of the
+               // online DA: if it expected to produce data for the FXS every run, then
+               // if no sources are found it means a problem happened and you should return error;
+               // if DA may or may not send files to FXS, then you shouldn't return error
+               // and go on with the analysis!
+               return 1;
+       }
+       Log("The following sources produced files with the id HLTData");
+
+       sourceList->Print();
+
+       TIter iter(sourceList);
+       TObjString *source = 0;
+       while((source=dynamic_cast<TObjString*> (iter.Next()))){
+               TString fileName = GetFile(kHLT, "HLTData", source->GetName());
+               if (fileName.Length() > 0)
+                       Log(Form("Got the file %s from HLT, now we can extract some values.", fileName.Data()));
+       }
+
+       delete sourceList;
+
+  } else {
+       Log("HLT is OFF, skipping query...");
+  }
+
+  // Example of how to retrieve the list of sources that produced files
+  sourceList = GetFileSources(kDAQ);
+  if (!sourceList)
+  {
+       Log("Error: No sources found!");
+       return 1;
+  }
+  
+  Log("The following sources produced files");
+  sourceList->Print();
+  delete sourceList;
+  
+  // Example of how to retrieve the list of ids from a given source
+  TList* idList = GetFileIDs(kDAQ, "LDC0");
+  if (!idList)
+  {
+       Log("Error: No IDs found!");
+       return 1;
+  }
+  
+  Log("The following ids are available");
+  idList->Print();
+  delete idList;
+  
   // Example to store a file directly to the reference storage
   // Suppose we have queried the file from the FXS. Now the file is available locally and is called "file1.root".
   const char* refFileName="file1.root";
@@ -131,8 +209,8 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
   {
        Log("No object found in OCDB!");
   } else {
-       TObjString *obj = dynamic_cast<TObjString*> (entry->GetObject());
-       Log(Form("Got TPC/Calib/Data object from OCDB. The object says: %s",obj->GetName()));
+       Log("Got TPC/Calib/Data object from OCDB. The object's metadata is: ");
+       entry->PrintMetaData();
   }