adding parameters for extended validity range of data produced by preprocessor
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Jul 2006 12:44:36 +0000 (12:44 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Jul 2006 12:44:36 +0000 (12:44 +0000)
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/TestShuttle/AliTestShuttle.cxx
SHUTTLE/TestShuttle/AliTestShuttle.h
SHUTTLE/TestShuttle/TestPreprocessor.C
STEER/AliPreprocessor.cxx
STEER/AliPreprocessor.h
STEER/AliShuttleInterface.h

index 8ba2b6f5315878c6eca2b29616b0e6dcafd65066..101d7441dc8c5f5e4ef54d80788cbca99e4cc6cf 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.7  2006/07/10 14:37:09  jgrosseo
+small fix + todo comment
+
 Revision 1.6  2006/07/10 13:01:41  jgrosseo
 enhanced storing of last sucessfully processed run (alberto)
 
@@ -153,14 +156,20 @@ void AliShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor)
 
 //______________________________________________________________________________________________
 UInt_t AliShuttle::Store(const char* detector,
-               TObject* object, AliCDBMetaData* metaData)
+               TObject* object, AliCDBMetaData* metaData, Int_t /*validityStart*/, Bool_t /*validityInfinite*/)
 {
        // store data into CDB
+  //
+  // validityStart is the start validity of the data, if not 0 GetCurrentRun() - validityStart is taken
+  // validityInfinite defines if the data is valid until new data arrives (e.g. for calibration runs)
+  //
        // returns 0 if fail
        //         1 if stored in main (Grid) storage
        //         2 if stored in backup (Local) storage
 
+  // TODO implement use of two parameters
 
+  // TODO shouldn't the path be given by the preprocessor???
        AliCDBId id(AliCDBPath(detector, "DCS", "Data"),
                GetCurrentRun(), GetCurrentRun());
 
index 17885f2ff6626b95c21ce767f74edcafef8067fe..2fb01ceb9ffc14ba9911d42a6fc9f8c1b9664dab 100644 (file)
@@ -39,7 +39,7 @@ public:
        UInt_t GetCurrentStartTime() const {return fCurrentStartTime;};
        UInt_t GetCurrentEndTime() const {return fCurrentEndTime;};
 
-       virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData);
+       virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
        virtual const char* GetFile(Int_t system, const char* detector,
                const char* id, const char* source);
        virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
index 3baa641eb8a3f949359efa3415a8768714e5dfa1..b99d6d254b801853a81b72393d648b9570bee29d 100644 (file)
 
 /*
 $Log$
+Revision 1.2  2006/06/06 14:20:05  jgrosseo
+o) updated test preprocessor (alberto)
+o) added comments to example macro
+o) test shuttle implements new interface
+
 Revision 1.2  2006/03/07 07:52:34  hristov
 New version (B.Yordanov)
 
@@ -59,7 +64,10 @@ some docs added
 ClassImp(AliTestShuttle)
 
 //______________________________________________________________________________________________
-AliTestShuttle::AliTestShuttle() :
+AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) :
+  fRun(run),
+  fStartTime(startTime),
+  fEndTime(endTime),
   fInputFiles(0),
   fPreprocessors(0),
   fDcsAliasMap(0)
@@ -86,7 +94,7 @@ AliTestShuttle::~AliTestShuttle()
 }
 
 //______________________________________________________________________________________________
-UInt_t AliTestShuttle::Store(const char* detector, TObject* object, AliCDBMetaData* metaData)
+UInt_t AliTestShuttle::Store(const char* detector, TObject* object, AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
 {
   // Stores the CDB object
   // This function should be called at the end of the preprocessor cycle
@@ -94,7 +102,18 @@ UInt_t AliTestShuttle::Store(const char* detector, TObject* object, AliCDBMetaDa
   // This implementation just stores it on the local disk, the full AliShuttle
   // puts it to the Grid FileCatalog
 
-  AliCDBId id(Form("%s/SHUTTLE/Data", detector), 0, 0);
+
+  Int_t startRun = fRun;
+  Int_t endRun = fRun;
+
+  if (validityStart > 0)
+    startRun -= validityStart;
+
+  // TODO put define for infinite
+  if (validityInfinite != kFALSE)
+    endRun = 999999999;
+
+  AliCDBId id(Form("%s/SHUTTLE/Data", detector), startRun, endRun);
 
   return AliCDBManager::Instance()->Put(object, id, metaData);
 }
@@ -208,7 +227,7 @@ void AliTestShuttle::Process()
     AliPreprocessor* preprocessor = dynamic_cast<AliPreprocessor*> (fPreprocessors->At(i));
     if (preprocessor)
     {
-      preprocessor->Initialize(0, 1, 0);
+      preprocessor->Initialize(fRun, fStartTime, fEndTime);
       preprocessor->Process(fDcsAliasMap);
     }
   }
index c9e163db54e031beba2e1950aabd872da11334d8..5a7ab2af502de139ff021147dc78f0723670d0b4 100644 (file)
@@ -19,7 +19,7 @@ class AliCDBMetaData;
 class AliTestShuttle : public AliShuttleInterface
 {
   public:
-    AliTestShuttle();
+    AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime);
     virtual ~AliTestShuttle();
 
     void AddInputFile(Int_t system, const char* detector, const char* id, const char* source, const char* fileName);
@@ -28,7 +28,7 @@ class AliTestShuttle : public AliShuttleInterface
     void Process();
 
     // AliShuttleInterface functions
-    virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData);
+    virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
     virtual const char* GetFile(Int_t system, const char* detector, const char* id, const char* source);
     virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
     virtual void Log(const char* detector, const char* message);
@@ -36,6 +36,10 @@ class AliTestShuttle : public AliShuttleInterface
     virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
 
   protected:
+    Int_t fRun;         // run that is simulated with the AliTestShuttle
+    UInt_t fStartTime;  // starttime that is simulated with the AliTestShuttle
+    UInt_t fEndTime;    // endtime that is simulated with the AliTestShuttle
+
     TMap* fInputFiles;   // files for GetFile, GetFileSources
     TObjArray* fPreprocessors; // list of preprocessors that are to be tested
     TMap* fDcsAliasMap; // DCS data for testing
index d1213cef45ff7f87cd1f554a1dcfdac10cd1dcdb..9b0b039fc9a8a6924067ae1c89794a8b7a434207 100644 (file)
@@ -17,7 +17,8 @@ void TestPreprocessor()
   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
 
   // create AliTestShuttle instance
-  AliTestShuttle* shuttle = new AliTestShuttle();
+  // The parameters are run, startTime, endTime
+  AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
 
   // TODO(1)
   //
index a4e9506a715655f73e1232c86c816dee2d06cc20..e265f59b52bffd4aa07324daee9684294d9db13b 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.2  2006/06/06 16:36:49  jgrosseo
+minor changes in AliShuttleInterface and AliPreprocessor
+
 Revision 1.1  2006/06/02 14:14:36  hristov
 Separate library for CDB (Jan)
 
@@ -104,14 +107,20 @@ void AliPreprocessor::Initialize(Int_t run, UInt_t startTime,     UInt_t endTime)
   fEndTime = endTime;
 }
 
-UInt_t AliPreprocessor::Store(TObject* object, AliCDBMetaData* metaData)
+UInt_t AliPreprocessor::Store(TObject* object, AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
 {
   // Stores the CDB object
   // This function should be called at the end of the preprocessor cycle
   //
+  // The parameters are
+  //   1) the object to be stored
+  //   2) the metaData to be associated with the object
+  //   3) the validity start run number w.r.t. the current run, if the data is valid only for this run leave the default 0
+  //   4) specifies if the calibration data is valid for infinity (this means until updated), typical for calibration runs, the default is kFALSE
+  //
   // The call is delegated to AliShuttleInterface
 
-  return fShuttle->Store(GetName(), object, metaData);
+  return fShuttle->Store(GetName(), object, metaData, validityStart, validityInfinite);
 }
 
 const char* AliPreprocessor::GetFile(Int_t system, const char* id, const char* source)
index 6207c59202cd6c51a1f8a0a23e2eb486df4078f3..3910b0a443ca899e16d175c4e348926d56d9fcb3 100644 (file)
@@ -33,7 +33,7 @@ class AliPreprocessor : public TNamed
     virtual UInt_t Process(TMap* dcsAliasMap) = 0;
 
   protected:
-    UInt_t Store(TObject* object, AliCDBMetaData* metaData);
+    UInt_t Store(TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
     const char* GetFile(Int_t system, const char* id, const char* source);
     TList* GetFileSources(Int_t system, const char* id);
     void Log(const char* message);
index ed0dbf0fb1978d95649495ba88029ba6e308c6eb..9c5d26bc61e9f60c5553bd1916983099bdf3ae36 100644 (file)
@@ -22,7 +22,7 @@ class AliShuttleInterface : public TObject
     enum { kDAQ = 0, kDCS, kHLT };
     static const char* fkSystemNames[3];  // names of the systems providing data to the shuttle
 
-    virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData) = 0;
+    virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE) = 0;
     virtual const char* GetFile(Int_t system, const char* detector, const char* id, const char* source) = 0;
     virtual TList* GetFileSources(Int_t system, const char* detector, const char* id) = 0;
     virtual void Log(const char* detector, const char* message) = 0;