]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/TestShuttle/AliTestShuttle.cxx
Shuttle getters and setters of main/local OCDB/Reference storages, temp and log
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / AliTestShuttle.cxx
index 486bbbedc17414f70b8f34b7d6141602bc766286..a9c87d0893922aee99e5860a53056d2beae3efdf 100644 (file)
 
 /*
 $Log$
+Revision 1.6  2006/11/06 14:22:47  jgrosseo
+major update (Alberto)
+o) reading of run parameters from the logbook
+o) online offline naming conversion
+o) standalone DCSclient package
+
+Revision 1.5  2006/10/02 12:58:52  jgrosseo
+Small interface change in StoreReferenceData
+
 Revision 1.4  2006/08/08 14:19:07  jgrosseo
 Update to shuttle classes (Alberto)
 
@@ -73,8 +82,8 @@ some docs added
 
 #include <TMap.h>
 #include <TList.h>
-#include <TString.h>
 #include <TObjString.h>
+#include <TSystem.h>
 
 ClassImp(AliTestShuttle)
 
@@ -84,12 +93,14 @@ AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) :
   fStartTime(startTime),
   fEndTime(endTime),
   fInputFiles(0),
+  fRunParameters(0),
   fPreprocessors(0),
   fDcsAliasMap(0)
 {
   // constructor
 
   fInputFiles = new TMap;
+  fRunParameters = new TMap;
   fPreprocessors = new TObjArray;
 }
 
@@ -101,6 +112,9 @@ AliTestShuttle::~AliTestShuttle()
   delete fInputFiles;
   fInputFiles = 0;
 
+  delete fRunParameters;
+  fRunParameters = 0;
+
   delete fPreprocessors;
   fPreprocessors = 0;
 
@@ -133,7 +147,7 @@ UInt_t AliTestShuttle::Store(const AliCDBPath& path, TObject* object, AliCDBMeta
 
   AliCDBId id(path, startRun, endRun);
 
-  return AliCDBManager::Instance()->Put(object, id, metaData);
+  return AliCDBManager::Instance()->GetStorage(fgkMainCDB)->Put(object, id, metaData);
 }
 
 //______________________________________________________________________________________________
@@ -147,7 +161,7 @@ UInt_t AliTestShuttle::StoreReferenceData(const AliCDBPath& path, TObject* objec
 
   AliCDBId id(path, fRun, fRun);
 
-  return AliCDBManager::Instance()->GetStorage("local://ReferenceStorage")->Put(object, id, metaData);
+  return AliCDBManager::Instance()->GetStorage(fgkMainRefStorage)->Put(object, id, metaData);
 }
 
 //______________________________________________________________________________________________
@@ -270,5 +284,39 @@ void AliTestShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor)
 {
   // registers a preprocessor
 
-  fPreprocessors->Add(preprocessor);
+       const char* detName = preprocessor->GetName();
+       if(strcmp("DET", detName) != 0) {
+               if(GetDetPos(detName) < 0)
+                       AliFatal(Form("********** !!!!! Invalid detector name: %s !!!!! **********", detName));
+               }
+
+       fPreprocessors->Add(preprocessor);
 }
+
+//______________________________________________________________________________________________
+void AliTestShuttle::AddInputRunParameter(const char* key, const char* value){
+// set a run parameter (in reality it will be read from the DAQ logbook)
+
+       TObjString* keyObj = new TObjString(key);
+       if (fRunParameters->Contains(key)) {
+               AliWarning(Form("Parameter %s already existing and it will be replaced.", key));
+               delete fRunParameters->Remove(keyObj);
+
+       }
+       fRunParameters->Add(keyObj, new TObjString(value));
+       AliDebug(2, Form("Number of parameters: %d", fRunParameters->
+       GetEntries()));
+}
+
+//______________________________________________________________________________________________
+const char* AliTestShuttle::GetRunParameter(const char* key){
+// get a run parameter
+
+       TObjString* value = dynamic_cast<TObjString*> (fRunParameters->GetValue(key));
+       if(!value) {
+               AliError(Form("No such parameter: %s", key));
+               return 0;
+       }
+       return value->GetName();
+}
+