]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/TestShuttle/TestPreprocessor.C
Shuttle getters and setters of main/local OCDB/Reference storages, temp and log
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / TestPreprocessor.C
index adba4ba9163898b47a9469322d8ec44a203b020e..15d987e9c6c57c68bf91213b15e103ea33a1fcf2 100644 (file)
@@ -13,11 +13,26 @@ void TestPreprocessor()
   // load library
   gSystem->Load("libTestShuttle.so");
 
-  // initialize location of CDB
-  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  // TODO if needed, change location of OCDB and Reference test folders
+  // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
+  AliShuttleInterface::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  AliShuttleInterface::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+
+  printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
+  printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
+
+  // TODO if needed, change location of temp and log folders (however they are not explicitly used here)
+  // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/temp and log
+  AliShuttleInterface::SetShuttleTempDir("$ALICE_ROOT/SHUTTLE/TestShuttle/temp");
+  AliShuttleInterface::SetShuttleLogDir("$ALICE_ROOT/SHUTTLE/TestShuttle/log");
+
+  printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir());
+  printf("Test Shuttle log dir: %s\n", AliShuttleInterface::GetShuttleLogDir());
+
 
   // create AliTestShuttle instance
-  AliTestShuttle* shuttle = new AliTestShuttle();
+  // The parameters are run, startTime, endTime
+  AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
 
   // TODO(1)
   //
@@ -51,25 +66,37 @@ 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", "GDC", "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", "file2b.root");
 
   // TODO(3)
+  //
+  // 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)
   // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
-  AliPreprocessor* pp = new AliTestPreprocessor("DET", shuttle);
+  AliPreprocessor* test = new AliTestPreprocessor(shuttle);
 
   // Test the preprocessor
   shuttle->Process();
 
-  // TODO(4)
+  // TODO(5)
   // 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()->Get("DET/SHUTTLE/Data", 0);
+  AliCDBEntry* entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Get("TPC/SHUTTLE/Data", 7);
   if (!entry)
   {
     printf("The file is not there. Something went wrong.\n");
@@ -111,8 +138,7 @@ TMap* CreateDCSAliasMap()
 
     for (int timeStamp=0;timeStamp<1000;timeStamp+=10)
     {
-      AliSimpleValue* simVal = new AliSimpleValue((Float_t) (random.Gaus()+5*nAlias));
-      AliDCSValue* dcsVal = new AliDCSValue(*simVal, timeStamp);
+      AliDCSValue* dcsVal = new AliDCSValue((Float_t) (random.Gaus()+5*nAlias), timeStamp);
       //printf("%s\n",dcsVal->ToString().Data());
       valueSet->Add(dcsVal);
     }
@@ -130,7 +156,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());
 }
 
@@ -147,8 +174,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);
 }