]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/TestShuttle/TestPreprocessor.C
Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / TestPreprocessor.C
index 53dcf03116c881329a82d269276970a12293498f..2025673fb464b7f16d8039dfb63e4c78c1885de6 100644 (file)
@@ -13,17 +13,18 @@ void TestPreprocessor()
   // load library
   gSystem->Load("libTestShuttle.so");
 
+   // create AliTestShuttle instance
+  // The parameters are run, startTime, endTime
+  AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
+
   // TODO if needed, change location of OCDB and Reference test folders
   // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
-  // AliTestShuttle::SetOCDBStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
-  // AliTestShuttle::SetReferenceStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB");
+  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestReference");
 
-  printf("Test OCDB storage Uri: %s\n", AliTestShuttle::GetOCDBStorage().Data());
-  printf("Test Reference storage Uri: %s\n", AliTestShuttle::GetReferenceStorage().Data());
+  printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
+  printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
 
-  // create AliTestShuttle instance
-  // The parameters are run, startTime, endTime
-  AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
 
   // TODO(1)
   //
@@ -57,44 +58,64 @@ void TestPreprocessor()
   // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>)
   // In this example we add a file originating from the GDC with the id PEDESTALS
   // Three files originating from different LDCs but with the same id are also added
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "PEDESTALS", "GDC", "file1.root");
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC0", "file2a.root");
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC1", "file2b.root");
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC2", "file2b.root");
+  // Note that the test preprocessor name is TPC. The name of the detector's preprocessor must follow
+  // the "online" naming convention ALICE-INT-2003-039.
+  shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "PEDESTALS", "GDC0", "file1.root");
+  shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY", "LDC0", "file2a.root");
+  shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY", "LDC1", "file2b.root");
+  shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY", "LDC2", "file2c.root");
+  shuttle->AddInputFile(AliShuttleInterface::kHLT, "TPC", "HLTData", "source1", "hlt_file1.root");
+  shuttle->AddInputFile(AliShuttleInterface::kHLT, "TPC", "HLTData", "source2", "hlt_file2.root");
 
   // TODO(3)
   //
+  // The shuttle can read run type stored in the DAQ logbook.
+  // To test it, we must provide the run type manually. They will be retrieved in the preprocessor
+  // using GetRunType function.
+  shuttle->SetInputRunType("PHYSICS");
+
+  // TODO(4)
+  //
   // The shuttle can read run parameters stored in the DAQ run logbook.
   // To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor
   // using GetRunParameter function.
-  // In real life the parameters will be retrieved automatically from the run logbook;
   shuttle->AddInputRunParameter("totalEvents", "30000");
   shuttle->AddInputRunParameter("NumberOfGDCs", "15");
 
-  // TODO(4)
+  // TODO(5)
+  //
+  // This is for preprocessor that require data from HLT.
+  // Since HLT may be switched off, the preprocessor should first query the Run logbook where
+  // the HLT status is stored. SHUTTLE implements a shortcut function (GetHLTStatus) that returns
+  // a bool directly. 1 = HLT ON, 0 = HLT OFF
+  //
+
+  Bool_t hltStatus=kTRUE;
+  shuttle->SetInputHLTStatus(hltStatus);
+
+
+  // TODO(6)
   // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
-//  AliPreprocessor* pp = new AliTestPreprocessor("DET", shuttle);
-//  AliPreprocessor* start = new AliSTARTPreprocessor("T00", shuttle);
-  AliPreprocessor* test = new AliTestPreprocessor("DET", shuttle);
+  AliPreprocessor* test = new AliTestPreprocessor(shuttle);
 
   // Test the preprocessor
   shuttle->Process();
 
-  // TODO(5)
+  // TODO(7)
   // In the preprocessor AliShuttleInterface::Store should be called to put the final
   // data to the CDB. To check if all went fine have a look at the files produced in
   // $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data
   //
   // Check the file which should have been created
-  AliCDBEntry* entry = AliCDBManager::Instance()->GetStorage(AliTestShuttle::GetOCDBStorage())
-                       ->Get("DET/SHUTTLE/Data", 7);
-  if (!entry)
+  AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Get("TPC/Calib/Data", 7);
+  if (!chkEntry)
   {
     printf("The file is not there. Something went wrong.\n");
     return;
   }
 
-  AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (entry->GetObject());
+  AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (chkEntry->GetObject());
   // If everything went fine, draw the result
   if (output)
     output->Draw();
@@ -147,7 +168,8 @@ TMap* ReadDCSAliasMap()
   // The file contains an AliCDBEntry that contains a TMap with the DCS structure.
   // An explanation of the structure can be found in CreateDCSAliasMap()
 
-  AliCDBEntry *entry = AliCDBManager::Instance()->Get("DET/DCS/Data", 0);
+  AliCDBEntry *entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Get("DET/DCS/Data", 0);
   return dynamic_cast<TMap*> (entry->GetObject());
 }
 
@@ -164,8 +186,8 @@ void WriteDCSAliasMap()
 
   AliCDBId id("DET/DCS/Data", 0, 0);
 
-  // initialize location of CDB
-  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  // look into AliTestShuttle's CDB main folder
 
-  AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
+  AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Put(dcsAliasMap, id, &metaData);
 }