/*
$Log$
+Revision 1.11 2006/07/21 07:37:20 jgrosseo
+last run is stored after each run
+
Revision 1.10 2006/07/20 09:54:40 jgrosseo
introducing status management: The processing per subdetector is divided into several steps,
after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
#include "AliCDBManager.h"
#include "AliCDBStorage.h"
#include "AliCDBId.h"
+#include "AliCDBRunRange.h"
+#include "AliCDBPath.h"
#include "AliCDBEntry.h"
#include "AliShuttleConfig.h"
#include "AliDCSClient.h"
#include "AliLog.h"
#include "AliPreprocessor.h"
-#include "AliDefaultPreprocessor.h"
#include "AliShuttleStatus.h"
#include <TSystem.h>
ClassImp(AliShuttle)
-TString AliShuttle::fgkLocalUri("local://$ALICE_ROOT/SHUTTLE/ShuttleCDB");
-const char* AliShuttle::fgkShuttleTempDir = "$ALICE_ROOT/SHUTTLE/temp";
-const char* AliShuttle::fgkShuttleLogDir = "$ALICE_ROOT/SHUTTLE/log";
+TString AliShuttle::fgkLocalCDB("local://LocalShuttleCDB");
+TString AliShuttle::fgkMainRefStorage("alien://DBFolder=ShuttleReference");
+TString AliShuttle::fgkLocalRefStorage("local://LocalReferenceStorage");
+
+const char* AliShuttle::fgkShuttleTempDir = gSystem->ExpandPathName("$ALICE_ROOT/SHUTTLE/temp");
+const char* AliShuttle::fgkShuttleLogDir = gSystem->ExpandPathName("$ALICE_ROOT/SHUTTLE/log");
const char* AliShuttle::fgkDetectorName[AliShuttle::fgkNDetectors] = {"SPD", "SDD", "SSD", "TPC", "TRD", "TOF",
"PHOS", "CPV", "RICH", "EMCAL", "MUON_TRK", "MUON_TRG", "FMD", "ZDC", "PMD", "START", "VZERO"};
fConfig(config),
fTimeout(timeout),
fRetries(retries), fCurrentRun(-1), fCurrentStartTime(0),
- fCurrentEndTime(0),
- fStatusEntry(0)
+ fCurrentEndTime(0), fStatusEntry(0)
{
//
// config: AliShuttleConfig used
}
//______________________________________________________________________________________________
-UInt_t AliShuttle::Store(const char* detector,
- TObject* object, AliCDBMetaData* metaData, Int_t /*validityStart*/, Bool_t /*validityInfinite*/)
+UInt_t AliShuttle::Store(const AliCDBPath& path, TObject* object,
+ AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
{
- // store data into CDB
+ // Stores a CDB object in the storage for offline reconstruction. Objects that are not needed for
+ // offline reconstruction, but should be stored anyway (e.g. for debugging) should NOT be stored
+ // using this function. Use StoreReferenceData instead!
+ //
+
+ // The parameters are
+ // 1) the object's path.
+ // 2) the object to be stored
+ // 3) the metaData to be associated with the object
+ // 4) the validity start run number w.r.t. the current run,
+ // if the data is valid only for this run leave the default 0
+ // 5) specifies if the calibration data is valid for infinity (this means until updated),
+ // typical for calibration runs, the default is kFALSE
//
- // 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
+ // returns 0 if fail
+ // 1 if stored in main (Grid) CDB storage
+ // 2 if stored in backup (Local) CDB 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());
+ Int_t firstRun = GetCurrentRun() - validityStart;
+ if(firstRun < 0) {
+ AliError("First valid run happens to be less than 0! Setting it to 0...");
+ firstRun=0;
+ }
+
+ Int_t lastRun = -1;
+ if(validityInfinite) {
+ lastRun = AliCDBRunRange::Infinity();
+ } else {
+ lastRun = GetCurrentRun();
+ }
+
+ AliCDBId id(path, firstRun, lastRun);
UInt_t result = 0;
+
if (!(AliCDBManager::Instance()->IsDefaultStorageSet())) {
- Log(detector, "No CDB storage set!");
+ Log(fCurrentDetector, "No CDB storage set!");
} else {
result = (UInt_t) AliCDBManager::Instance()->Put(object, id, metaData);
}
if(!result) {
- Log(detector, "Error while storing object in main storage!");
- AliError("local storage will be used!");
+ Log(fCurrentDetector,
+ "Error while storing object in main storage: it will go to local storage!");
- result = AliCDBManager::Instance()->GetStorage(fgkLocalUri)
+ result = AliCDBManager::Instance()->GetStorage(fgkLocalCDB)
->Put(object, id, metaData);
if(result) {
result = 2;
}else{
- Log(detector, "Can't store data!");
+ Log(fCurrentDetector, "Can't store data!");
+ }
+ }
+ return result;
+
+}
+
+//______________________________________________________________________________________________
+UInt_t AliShuttle::StoreReferenceData(const AliCDBPath& path, TObject* object,
+ AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
+{
+ // Stores a CDB object in the storage for reference data. This objects will not be available during
+ // offline reconstrunction. Use this function for reference data only!
+ //
+
+ // The parameters are
+ // 1) the object's path.
+ // 2) the object to be stored
+ // 3) the metaData to be associated with the object
+ // 4) the validity start run number w.r.t. the current run,
+ // if the data is valid only for this run leave the default 0
+ // 5) specifies if the calibration data is valid for infinity (this means until updated),
+ // typical for calibration runs, the default is kFALSE
+ //
+ //
+ // returns 0 if fail
+ // 1 if stored in main (Grid) reference storage
+ // 2 if stored in backup (Local) reference storage
+
+ Int_t firstRun = GetCurrentRun() - validityStart;
+ if(firstRun < 0) {
+ AliError("First valid run happens to be less than 0! Setting it to 0...");
+ firstRun=0;
+ }
+
+ Int_t lastRun = -1;
+ if(validityInfinite) {
+ lastRun = AliCDBRunRange::Infinity();
+ } else {
+ lastRun = GetCurrentRun();
+ }
+
+ AliCDBId id(path, firstRun, lastRun);
+
+ UInt_t result = 0;
+
+ if (!(AliCDBManager::Instance()->GetStorage(fgkMainRefStorage))) {
+ Log(fCurrentDetector, "Cannot activate main reference storage!");
+ } else {
+ result = (UInt_t) AliCDBManager::Instance()->GetStorage(fgkMainRefStorage)
+ ->Put(object, id, metaData);
+ }
+
+ if(!result) {
+
+ Log(fCurrentDetector,
+ "Error while storing object in main reference storage: it will go to local ref storage!");
+
+ result = AliCDBManager::Instance()->GetStorage(fgkLocalRefStorage)
+ ->Put(object, id, metaData);
+
+ if(result) {
+ result = 2;
+ }else{
+ Log(fCurrentDetector, "Can't store reference data!");
}
}
return result;
fStatusEntry = 0;
}
- fStatusEntry = AliCDBManager::Instance()->GetStorage(AliShuttle::GetLocalURI())
+ fStatusEntry = AliCDBManager::Instance()->GetStorage(AliShuttle::GetLocalCDB())
->Get(Form("/SHUTTLE/STATUS/%s", fCurrentDetector.Data()), fCurrentRun);
if (!fStatusEntry)
fStatusEntry = new AliCDBEntry(status, id, new AliCDBMetaData);
- UInt_t result = AliCDBManager::Instance()->GetStorage(fgkLocalUri)->Put(fStatusEntry);
+ UInt_t result = AliCDBManager::Instance()->GetStorage(fgkLocalCDB)->Put(fStatusEntry);
if (!result)
{
if (increaseCount)
status->IncreaseCount();
- AliCDBManager::Instance()->GetStorage(fgkLocalUri)->Put(fStatusEntry);
+ AliCDBManager::Instance()->GetStorage(fgkLocalCDB)->Put(fStatusEntry);
}
//______________________________________________________________________________________________
while ((anAlias = (TObjString*) iter.Next())) {
TObjArray valueSet;
- result = GetValueSet(host, port, anAlias->String(), valueSet);
- //AliInfo(Form("Port = %d",port));
- //result = kTRUE;
+ //result = GetValueSet(host, port, anAlias->String(), valueSet);
+ AliInfo(Form("Port = %d",port));
+ result = kTRUE;
if(result) {
aliasMap.Add(anAlias->Clone(), valueSet.Clone());
}else{
anAlias->GetName());
Log(fCurrentDetector, message.Data());
hasError = kTRUE;
+ break;
}
}
metaData.SetResponsible(Form("Duck, Donald"));
metaData.SetProperty("StartEndTime", &dcsValue);
metaData.SetComment("Automatically stored by Shuttle!");
- hasError = (Store(fCurrentDetector, &aliasMap, &metaData) == 0);
+ AliCDBPath path(fCurrentDetector,"DCS","Data");
+ hasError = (Store(path, &aliasMap, &metaData) == 0);
}
if (hasError)
fCurrentRun, GetDetCode(detector), id, source);
TString sqlQuery = Form("%s %s", sqlQueryStart.Data(), whereClause.Data());
- AliInfo(Form("SQL query: \n%s",sqlQuery.Data()));
+ AliDebug(2, Form("SQL query: \n%s",sqlQuery.Data()));
// Query execution
TSQLResult* aResult;
delete aResult;
- AliInfo(Form("filePath = %s",filePath.Data()));
+ AliDebug(2, Form("filePath = %s",filePath.Data()));
// retrieved file is renamed to make it unique
TString localFileName = Form("%s_%d_%s_%s.shuttle",
Bool_t AliShuttle::RetrieveDAQFile(const char* daqFileName, const char* localFileName){
// check temp directory: trying to cd to temp; if it does not exist, create it
- AliInfo(Form("Copy file %s from DAQ FES into folder %s and rename it as %s",
+ AliDebug(2, Form("Copy file %s from DAQ FES into folder %s and rename it as %s",
daqFileName,fgkShuttleTempDir, localFileName));
void* dir = gSystem->OpenDirectory(fgkShuttleTempDir);
fgkShuttleTempDir,
localFileName);
- AliInfo(Form("%s",command.Data()));
+ AliDebug(2, Form("%s",command.Data()));
UInt_t nRetries = 0;
UInt_t maxRetries = 3;
// copy!! if successful TSystem::Exec returns 0
while(nRetries++ < maxRetries) {
- AliInfo(Form("Trying to copy file. Retry # %d", nRetries));
+ AliDebug(2, Form("Trying to copy file. Retry # %d", nRetries));
if(gSystem->Exec(command.Data()) == 0) return kTRUE;
}
fCurrentRun, GetDetCode(detector), id);
TString sqlQuery = Form("%s %s", sqlQueryStart.Data(), whereClause.Data());
- AliInfo(Form("SQL query: \n%s",sqlQuery.Data()));
+ AliDebug(2, Form("SQL query: \n%s",sqlQuery.Data()));
// Query execution
TSQLResult* aResult;
while((aRow = aResult->Next())){
TString daqSource(aRow->GetField(0), aRow->GetFieldLength(0));
- AliInfo(Form("daqSource = %s", daqSource.Data()));
+ AliDebug(2, Form("daqSource = %s", daqSource.Data()));
list->Add(new TObjString(daqSource));
}
delete aResult;
TString sqlQuery = Form("update logbook_fs set time_processed=%d %s", now.GetSec(), whereClause.Data());
- AliInfo(Form("SQL query: \n%s",sqlQuery.Data()));
+ AliDebug(2, Form("SQL query: \n%s",sqlQuery.Data()));
// Query execution
TSQLResult* aResult;
// check result - TODO Is it necessary?
sqlQuery = Form("select time_processed from logbook_fs %s", whereClause.Data());
- AliInfo(Form(" CHECK - SQL query: \n%s",sqlQuery.Data()));
+ AliDebug(2, Form(" CHECK - SQL query: \n%s",sqlQuery.Data()));
aResult = dynamic_cast<TSQLResult*> (fServer[kDAQ]->Query(sqlQuery));
if (!aResult) {
{
// Fill log string with a message
- TString toLog = Form("%s: %s, run %d - %s", TTimeStamp(time(0)).AsString(),
- detector, GetCurrentRun(), message);
- AliInfo(toLog.Data());
+ void* dir = gSystem->OpenDirectory(fgkShuttleLogDir);
+ if (dir == NULL) {
+ if (gSystem->mkdir(fgkShuttleLogDir, kTRUE)) {
+ AliError(Form("Can't open directory <%s>!", fgkShuttleTempDir));
+ return;
+ }
- TString fileName;
- fileName.Form("%s/%s.log", fgkShuttleLogDir, detector);
- gSystem->ExpandPathName(fileName);
+ } else {
+ gSystem->FreeDirectory(dir);
+ }
- ofstream logFile;
- logFile.open(fileName, ofstream::out | ofstream::app);
+ TString toLog = Form("%s: %s, run %d - %s", TTimeStamp(time(0)).AsString(),
+ detector, GetCurrentRun(), message);
+ AliInfo(toLog.Data());
- if (!logFile.is_open())
- {
- AliError(Form("Could not open file %s", fileName.Data()));
- return;
- }
+ TString fileName;
+ fileName.Form("%s/%s.log", fgkShuttleLogDir, detector);
+ gSystem->ExpandPathName(fileName);
+
+ ofstream logFile;
+ logFile.open(fileName, ofstream::out | ofstream::app);
+
+ if (!logFile.is_open()) {
+ AliError(Form("Could not open file %s", fileName.Data()));
+ return;
+ }
- logFile << toLog.Data() << "\n";
+ logFile << toLog.Data() << "\n";
- logFile.close();
+ logFile.close();
}
class AliCDBMetaData;
class TSQLServer;
class AliCDBEntry;
+class AliCDBPath;
class AliShuttle: public AliShuttleInterface {
public:
UInt_t GetCurrentStartTime() const {return fCurrentStartTime;};
UInt_t GetCurrentEndTime() const {return fCurrentEndTime;};
- virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
+ virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
+ Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
+ virtual UInt_t StoreReferenceData(const AliCDBPath& path, 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);
- static TString GetLocalURI () {return fgkLocalUri;}
- static void SetLocalURI (TString localUri) {fgkLocalUri = localUri;}
+ static TString GetLocalCDB () {return fgkLocalCDB;}
+ static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;}
+
+ static TString GetMainRefStorage() {return fgkMainRefStorage;}
+ static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;}
+
+ static TString GetLocalRefStorage() {return fgkLocalRefStorage;}
+ static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;}
// TODO Test only, remove later!
void SetCurrentRun(int run) {fCurrentRun=run;}
static const Int_t fgkNDetectors = 17; //! number of detectors
static const char* fgkDetectorName[fgkNDetectors]; //! names of detectors
static const char* fgkDetectorCode[fgkNDetectors]; //! codes of detectors
- static TString fgkLocalUri; //! URI of the local backup storage location
+ static TString fgkLocalCDB; //! URI of the local backup storage
+ static TString fgkMainRefStorage; //! URI of the main (Grid) REFERENCE storage
+ static TString fgkLocalRefStorage; //! URI of the local REFERENCE storage
static const char* fgkShuttleTempDir; //! base path of SHUTTLE temp folder
static const char* fgkShuttleLogDir; //! path of SHUTTLE log folder
/*
$Log$
+ Revision 1.8 2006/07/21 07:37:20 jgrosseo
+ last run is stored after each run
+
Revision 1.7 2006/07/20 09:54:40 jgrosseo
introducing status management: The processing per subdetector is divided into several steps,
after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
{
// reads the last processed run from local CDB
- AliCDBEntry* cdbEntry = AliCDBManager::Instance()->GetStorage(AliShuttle::GetLocalURI())
+ AliCDBEntry* cdbEntry = AliCDBManager::Instance()->GetStorage(AliShuttle::GetLocalCDB())
->Get("/SHUTTLE/SYSTEM/LASTRUN", 0);
if (cdbEntry)
AliCDBMetaData metaData;
AliCDBId cdbID(AliCDBPath("SHUTTLE", "SYSTEM", "LASTRUN"), 0, 0);
- UInt_t result = AliCDBManager::Instance()->GetStorage(AliShuttle::GetLocalURI())
+ UInt_t result = AliCDBManager::Instance()->GetStorage(AliShuttle::GetLocalCDB())
->Put(&lastRunObj, cdbID, &metaData);
if (!result) {
metaData.SetResponsible("Alberto Colla");
metaData.SetComment("This preprocessor fills an AliTestDataDCS object.");
- UInt_t result = Store(fData, &metaData);
+ UInt_t result = Store("SHUTTLE", "Data", fData, &metaData, 0, 0);
delete fData;
fData = 0;
/*
$Log$
+Revision 1.3 2006/07/11 12:44:32 jgrosseo
+adding parameters for extended validity range of data produced by preprocessor
+
Revision 1.2 2006/06/06 14:20:05 jgrosseo
o) updated test preprocessor (alberto)
o) added comments to example macro
#include "AliLog.h"
#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
#include "AliCDBMetaData.h"
+#include "AliCDBPath.h"
#include "AliCDBId.h"
#include "AliPreprocessor.h"
}
//______________________________________________________________________________________________
-UInt_t AliTestShuttle::Store(const char* detector, TObject* object, AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
+UInt_t AliTestShuttle::Store(const AliCDBPath& path, 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
// This implementation just stores it on the local disk, the full AliShuttle
// puts it to the Grid FileCatalog
+ Int_t startRun = fRun - validityStart;
+ if(startRun < 0) {
+ AliError("First valid run happens to be less than 0! Setting it to 0...");
+ startRun=0;
+ }
- Int_t startRun = fRun;
- Int_t endRun = fRun;
+ Int_t endRun = -1;
+ if(validityInfinite) {
+ endRun = AliCDBRunRange::Infinity();
+ } else {
+ endRun = fRun;
+ }
- if (validityStart > 0)
- startRun -= validityStart;
+ AliCDBId id(path, startRun, endRun);
- // TODO put define for infinite
- if (validityInfinite != kFALSE)
- endRun = 999999999;
+ return AliCDBManager::Instance()->Put(object, id, metaData);
+}
- AliCDBId id(Form("%s/SHUTTLE/Data", detector), startRun, endRun);
+//______________________________________________________________________________________________
+UInt_t AliTestShuttle::StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
+ Int_t validityStart, Bool_t validityInfinite)
- return AliCDBManager::Instance()->Put(object, id, metaData);
+{
+ // Stores the object as reference data
+ // This function should be called at the end of the preprocessor cycle
+ //
+ // This implementation just stores it on the local disk, the full AliShuttle
+ // puts it to the Grid FileCatalog
+
+ Int_t startRun = fRun - validityStart;
+ if(startRun < 0) {
+ AliError("First valid run happens to be less than 0! Setting it to 0...");
+ startRun=0;
+ }
+
+ Int_t endRun = -1;
+ if(validityInfinite) {
+ endRun = AliCDBRunRange::Infinity();
+ } else {
+ endRun = fRun;
+ }
+
+ AliCDBId id(path, startRun, endRun);
+
+ return AliCDBManager::Instance()->GetStorage("local://ReferenceStorage")->Put(object, id, metaData);
}
//______________________________________________________________________________________________
class TMap;
class TList;
class AliCDBMetaData;
+class AliCDBPath;
class AliTestShuttle : public AliShuttleInterface
{
void Process();
// AliShuttleInterface functions
- virtual UInt_t Store(const char* detector, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
+ virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
+ Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
+ virtual UInt_t StoreReferenceData(const AliCDBPath& path, 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);
// $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()->Get("DET/SHUTTLE/Data", 7);
if (!entry)
{
printf("The file is not there. Something went wrong.\n");
AliCDBMetaData metaData;
metaData.SetComment("This is a test!");
- return Store(valueMap, &metaData);
+ return Store("Calib", "ITSData", valueMap, &metaData);
}
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//
+// Prototype of RICH Preprocessor
+//
+
+#include "TestRICHPreprocessor.h"
+
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+#include "AliShuttleInterface.h"
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TSystem.h>
+
+ClassImp(TestRICHPreprocessor)
+
+//________________________________________________________________________________________
+TestRICHPreprocessor::TestRICHPreprocessor():
+ AliPreprocessor("RICH",0)
+{
+// default constructor - Don't use this!
+
+}
+
+//________________________________________________________________________________________
+TestRICHPreprocessor::TestRICHPreprocessor(const char* detector, AliShuttleInterface* shuttle):
+ AliPreprocessor(detector,shuttle)
+{
+// constructor - shuttle must be instantiated!
+
+}
+
+//________________________________________________________________________________________
+void TestRICHPreprocessor::Initialize(Int_t run, UInt_t startTime,
+ UInt_t endTime)
+{
+// Initialize preprocessor
+
+ AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
+ TTimeStamp(startTime).AsString(),
+ TTimeStamp(endTime).AsString()));
+
+ fRun = run;
+ fStartTime = startTime;
+ fEndTime = endTime;
+}
+
+//________________________________________________________________________________________
+UInt_t TestRICHPreprocessor::Process(TMap* /*valueMap*/)
+{
+// process data retrieved by the Shuttle
+
+ //TIter iter(valueMap);
+ //TPair* aPair;
+ //while ((aPair = (TPair*) iter.Next())) {
+ //aPair->Print();
+ //}
+ //AliCDBMetaData metaData;
+ //metaData.SetComment("This is a test!");
+
+ // return Store(valueMap, &metaData);
+
+ TList* filesources = GetFileSources(AliShuttleInterface::kDAQ, "thresholds.txt");
+
+ if(!filesources) {
+ AliError(Form("No sources found for thresholds.txt for run %d !", fRun));
+ return 0;
+ }
+
+ AliInfo("Here's the list of sources for thresholds.txt");
+ filesources->Print();
+
+ TIter iter(filesources);
+ TObjString* source;
+ int i=0;
+ UInt_t result = 0;
+ while((source=dynamic_cast<TObjString*> (iter.Next()))){
+ printf("\n\n Getting file #%d\n",++i);
+ //if(i==1) continue;
+ const char* filename = GetFile(AliShuttleInterface::kDAQ, "thresholds.txt", source->GetName());
+ if(!filename) {
+ AliError(Form("Error retrieving file from source %d failed!", source->GetName()));
+ delete filesources;
+ return 0;
+ }
+ TString command = Form("more $ALICE_ROOT/SHUTTLE/temp/%s",filename);
+ gSystem->Exec(command.Data());
+
+ // STORAGE! The First file name will be stored into CDB, the second into reference storage
+ TObjString filenameObj(filename);
+ AliCDBMetaData metaData;
+ if(i==1) result = Store("Calib", "Data", &filenameObj, &metaData);
+ if(i==2) result = StoreReferenceData("Calib", "RefData", &filenameObj, &metaData);
+
+ }
+ delete filesources;
+
+ return result;
+}
+
--- /dev/null
+#ifndef TEST_RICH_PRE_PROCESSOR_H
+#define TEST_RICH_PRE_PRECESSOR_H
+
+#include "AliPreprocessor.h"
+
+//
+// Prototype of RICH Preprocessor
+//
+
+class TestRICHPreprocessor: public AliPreprocessor {
+public:
+ TestRICHPreprocessor();
+ TestRICHPreprocessor(const char* detector, AliShuttleInterface* shuttle);
+
+protected:
+
+ virtual void Initialize(Int_t run, UInt_t startTime,
+ UInt_t endTime);
+
+ virtual UInt_t Process(TMap* valueSet);
+
+ ClassDef(TestRICHPreprocessor, 0);
+};
+
+#endif
metaData.SetResponsible("Alberto Colla");
metaData.SetComment("This preprocessor fills an AliTPCDataDCS object.");
- return Store(fData, &metaData);
+ return Store("Calib", "TPCData", fData, &metaData);
delete fData;
fData = 0;
}
if(lastStorage.Contains(TString("new"), TString::kIgnoreCase) &&
id.GetSubVersion() > 0 ){
- AliWarning(Form("A NEW object is being stored with version v%d_s%d",
+ AliDebug(2, Form("A NEW object is being stored with version v%d_s%d",
id.GetVersion(),id.GetSubVersion()));
- AliWarning(Form("and it will hide previously stored object with v%d_s%d!",
+ AliDebug(2, Form("and it will hide previously stored object with v%d_s%d!",
id.GetVersion(),id.GetSubVersion()-1));
}
TString lastStorage = id.GetLastStorage();
if(lastStorage.Contains(TString("new"), TString::kIgnoreCase) && id.GetVersion() > 1 ){
- AliWarning(Form("A NEW object is being stored with version %d",
+ AliDebug(2, Form("A NEW object is being stored with version %d",
id.GetVersion()));
- AliWarning(Form("and it will hide previously stored object with version %d!",
+ AliDebug(2, Form("and it will hide previously stored object with version %d!",
id.GetVersion()-1));
}
if(lastStorage.Contains(TString("new"), TString::kIgnoreCase) &&
id.GetSubVersion() > 0 ){
- AliWarning(Form("A NEW object is being stored with version v%d_s%d",
+ AliDebug(2, Form("A NEW object is being stored with version v%d_s%d",
id.GetVersion(),id.GetSubVersion()));
- AliWarning(Form("and it will hide previously stored object with v%d_s%d!",
+ AliDebug(2, Form("and it will hide previously stored object with v%d_s%d!",
id.GetVersion(),id.GetSubVersion()-1));
}
public:
AliCDBRunRange();
AliCDBRunRange(Int_t firstRun, Int_t lastRun);
-
+
virtual ~AliCDBRunRange();
Bool_t Comprises(const AliCDBRunRange& other) const;
virtual Bool_t IsEqual(const TObject *obj) const;
+
+ static const UInt_t Infinity() {return fgkInfinity;}
private:
Int_t fFirstRun; // first valid run
Int_t fLastRun; // last valid run
+ static const UInt_t fgkInfinity = 999999999; //! Flag for "infinity"
ClassDef(AliCDBRunRange, 1);
};
+++ /dev/null
-#include <AliDefaultPreprocessor.h>
-
-#include <TMap.h>
-
-#include "AliCDBMetaData.h"
-#include "AliDCSValue.h"
-
-//
-// This class is used for all subdectectors that dont have an own
-// preprocessor.
-// The DCS data is written into CDB, no files are processed.
-//
-
-ClassImp(AliDefaultPreprocessor)
-
-//______________________________________________________________________________________________
-AliDefaultPreprocessor::AliDefaultPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
-AliPreprocessor(detector, shuttle)
-{
-}
-
-//______________________________________________________________________________________________
-AliDefaultPreprocessor::~AliDefaultPreprocessor()
-{
-}
-
-//______________________________________________________________________________________________
-UInt_t AliDefaultPreprocessor::Process(TMap* dcsAliasMap)
-{
- // store to default CDB object
-
- AliCDBMetaData metaData;
- metaData.SetProperty("StartEndTime",
- new AliDCSValue(fStartTime, fEndTime));
- metaData.SetComment("Automatically stored by AliDefaultPreprocessor!");
-
- return Store(dcsAliasMap, &metaData);
-}
+++ /dev/null
-#ifndef ALI_DEFAULT_PREPROCESSOR_H
-#define ALI_DEFAULT_PREPROCESSOR_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//
-// Default preprocessor that writes the retrieved DCS values to CDB
-//
-
-#include <AliPreprocessor.h>
-
-class AliDefaultPreprocessor: public AliPreprocessor {
-
-public:
- AliDefaultPreprocessor(const char* detector, AliShuttleInterface* shuttle);
- virtual ~AliDefaultPreprocessor();
-
- virtual UInt_t Process(TMap* dcsAliasMap);
-
-private:
- ClassDef(AliDefaultPreprocessor, 0);
-};
-
-#endif
/*
$Log$
+Revision 1.3 2006/07/11 12:42:43 jgrosseo
+adding parameters for extended validity range of data produced by preprocessor
+
Revision 1.2 2006/06/06 16:36:49 jgrosseo
minor changes in AliShuttleInterface and AliPreprocessor
ClassImp(AliPreprocessor)
+//______________________________________________________________________________________________
AliPreprocessor::AliPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
TNamed(detector, ""),
fShuttle(shuttle)
fShuttle->RegisterPreprocessor(this);
}
+//______________________________________________________________________________________________
AliPreprocessor::~AliPreprocessor()
{
}
+//______________________________________________________________________________________________
void AliPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
{
// Sets the information of the run which is currently processed
fEndTime = endTime;
}
-UInt_t AliPreprocessor::Store(TObject* object, AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
+//______________________________________________________________________________________________
+UInt_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
+ AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
+{
+ // Stores a CDB object in the storage for offline reconstruction. Objects that are not needed for
+ // offline reconstruction, but should be stored anyway (e.g. for debugging) should NOT be stored
+ // using this function. Use StoreReferenceData instead!
+ //
+ // This function should be called at the end of the preprocessor cycle
+ //
+ // The parameters are
+ // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
+ // by the Preprocessor. Thus the object's path is "DET/level2/level3"
+ // 3) the object to be stored
+ // 4) the metaData to be associated with the object
+ // 5) the validity start run number w.r.t. the current run,
+ // if the data is valid only for this run leave the default 0
+ // 6) 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(AliCDBPath(GetName(), pathLevel2, pathLevel3), object,
+ metaData, validityStart, validityInfinite);
+}
+
+//______________________________________________________________________________________________
+UInt_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
+ AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
{
- // Stores the CDB object
+ // Stores a CDB object in the storage for reference data. This objects will not be available during
+ // offline reconstrunction. Use this function for reference data only!
+ //
// 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
+ // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
+ // by the Preprocessor. Thus the object's path is "DET/level2/level3"
+ // 3) the object to be stored
+ // 4) the metaData to be associated with the object
+ // 5) the validity start run number w.r.t. the current run,
+ // if the data is valid only for this run leave the default 0
+ // 6) 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, validityStart, validityInfinite);
+ return fShuttle->StoreReferenceData(AliCDBPath(GetName(), pathLevel2, pathLevel3), object,
+ metaData, validityStart, validityInfinite);
}
+//______________________________________________________________________________________________
const char* AliPreprocessor::GetFile(Int_t system, const char* id, const char* source)
{
// This function retrieves a file from the given system (kDAQ, kDCS, kHLT) with the given file id
return fShuttle->GetFile(system, GetName(), id, source);
}
+//______________________________________________________________________________________________
TList* AliPreprocessor::GetFileSources(Int_t system, const char* id)
{
// Returns a list of sources in a given system that saved a file with the given id
return fShuttle->GetFileSources(system, GetName(), id);
}
+//______________________________________________________________________________________________
void AliPreprocessor::Log(const char* message)
{
// Adds a log message to the Shuttle log of this preprocessor
AliPreprocessor(const char* detector, AliShuttleInterface* shuttle);
virtual ~AliPreprocessor();
- virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
virtual UInt_t Process(TMap* dcsAliasMap) = 0;
protected:
- UInt_t Store(TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
+ UInt_t Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
+ AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
+ UInt_t StoreReferenceData(const char* pathLevel2, const char* pathLevel3, 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);
class TList;
class AliCDBMetaData;
class AliPreprocessor;
+class AliCDBPath;
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, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE) = 0;
+ virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
+ Int_t validityStart = 0, Bool_t validityInfinite = kFALSE) = 0;
+ virtual UInt_t StoreReferenceData(const AliCDBPath& path, 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;
#pragma link C++ class AliDCSValue;
#pragma link C++ class AliPreprocessor;
-#pragma link C++ class AliDefaultPreprocessor;
#pragma link C++ class AliShuttleInterface;
SRCS = AliCDBEntry.cxx AliCDBId.cxx AliCDBMetaData.cxx \
AliCDBPath.cxx AliCDBRunRange.cxx AliCDBManager.cxx \
AliCDBStorage.cxx AliCDBLocal.cxx AliCDBDump.cxx AliCDBGrid.cxx \
-AliDCSValue.cxx \
-AliPreprocessor.cxx AliDefaultPreprocessor.cxx \
-AliShuttleInterface.cxx
+AliDCSValue.cxx AliPreprocessor.cxx AliShuttleInterface.cxx
HDRS:= $(SRCS:.cxx=.h)
EXPORT:= AliCDBEntry.h AliCDBId.h AliCDBMetaData.h \
AliCDBPath.h AliCDBRunRange.h AliCDBManager.h \
AliCDBStorage.h AliCDBLocal.h AliCDBDump.h AliCDBGrid.h \
-AliDCSValue.h \
-AliPreprocessor.h AliDefaultPreprocessor.h \
-AliShuttleInterface.h
+AliDCSValue.h AliPreprocessor.h AliShuttleInterface.h