]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliCDBDump.cxx
Container classes for the PHOS reconstruction parameters.
[u/mrichter/AliRoot.git] / STEER / AliCDBDump.cxx
index 18a5ba21614599b9590ff9c325b8e4b01fa4641e..d40bb51f981fb0db87d0236f44b085223e77c68a 100644 (file)
@@ -46,6 +46,9 @@ fFile(NULL), fReadOnly(readOnly) {
                AliDebug(2,Form("File <%s> opened",dbFile));
                if(fReadOnly) AliDebug(2,Form("in read-only mode"));
        }
+
+       fType="dump";
+       fBaseFolder = dbFile;
 }
 
 //_____________________________________________________________________________
@@ -233,9 +236,9 @@ Bool_t AliCDBDump::PrepareId(AliCDBId& id) {
 
        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));
        }
 
@@ -291,7 +294,7 @@ Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
                                        aRunRange.GetLastRun());
                        } else if (result.GetVersion() == aVersion
                                && result.GetSubVersion() == aSubVersion){
-                               AliError(Form("More than one object valid for run %d, version %d_%d!", 
+                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
                                return kFALSE; 
@@ -314,7 +317,7 @@ Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
                        // aVersion is requested version!
                        
                        if(result.GetSubVersion() == aSubVersion){
-                               AliError(Form("More than one object valid for run %d, version %d_%d!", 
+                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
                                return kFALSE; 
@@ -344,7 +347,7 @@ Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
                        // aVersion and aSubVersion are requested version and subVersion!
 
                        if(result.GetVersion() == aVersion && result.GetSubVersion() == aSubVersion){
-                               AliError(Form("More than one object valid for run %d, version %d_%d!", 
+                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
                                return kFALSE; 
@@ -395,7 +398,7 @@ AliCDBEntry* AliCDBDump::GetEntry(const AliCDBId& queryId) {
        TString keyname;
        if (!IdToKeyName(dataId.GetAliCDBRunRange(), dataId.GetVersion(), 
                dataId.GetSubVersion(), keyname)) {
-               AliError("Bad ID encountered! Subnormal error!");
+               AliDebug(2,Form("Bad ID encountered! Subnormal error!"));
                return NULL;
        }
 
@@ -405,12 +408,12 @@ AliCDBEntry* AliCDBDump::GetEntry(const AliCDBId& queryId) {
 
        TObject* anObject = gDirectory->Get(keyname);
        if (!anObject) {
-               AliError("Bad storage data: NULL entry object!");
+               AliDebug(2,Form("Bad storage data: NULL entry object!"));
                return NULL;
        } 
 
        if (AliCDBEntry::Class() != anObject->IsA()) {
-               AliError("Bad storage data: Invalid entry object!");
+               AliDebug(2,Form("Bad storage data: Invalid entry object!"));
                return NULL;
        }
 
@@ -542,7 +545,7 @@ Bool_t AliCDBDump::PutEntry(AliCDBEntry* entry) {
        // write object (key name: Run#firstRun_#lastRun_v#version_s#subVersion)
        Bool_t result = gDirectory->WriteTObject(entry, keyname);
        if (!result) {
-               AliError(Form("Can't write entry to file: %s", 
+               AliError(Form("Can't write entry to file: %s",
                                fFile->GetName()));
        }
 
@@ -600,6 +603,61 @@ Bool_t AliCDBDump::Contains(const char* path) const{
 
 }
 
+//_____________________________________________________________________________
+void AliCDBDump::QueryValidFiles()
+{
+// Query the CDB for files valid for AliCDBStorage::fRun
+// fills list fValidFileIds with AliCDBId objects created from file name
+
+       AliError("Not yet (and maybe never) implemented");
+}
+
+//_____________________________________________________________________________
+Bool_t AliCDBDump::IdToFilename(const AliCDBId& /*id*/, TString& /*filename*/) const {
+// build file name from AliCDBId (path, run range, version) and fDBFolder
+
+       AliError("Not implemented");
+        return kFALSE;
+}
+
+//_____________________________________________________________________________
+Int_t AliCDBDump::GetLatestVersion(const char* path, Int_t run){
+// get last version found in the database valid for run and path
+
+       AliCDBPath aCDBPath(path);
+       if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) {
+               AliError(Form("Invalid path in request: %s", path));
+               return -1;
+       }
+
+       AliCDBId query(path, run, run, -1, -1);
+       AliCDBId dataId;
+
+       GetId(query,dataId);
+
+       return dataId.GetVersion();
+}
+
+//_____________________________________________________________________________
+Int_t AliCDBDump::GetLatestSubVersion(const char* path, Int_t run, Int_t version){
+// get last version found in the database valid for run and path
+
+       AliCDBPath aCDBPath(path);
+       if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) {
+               AliError(Form("Invalid path in request: %s", path));
+               return -1;
+       }
+
+       AliCDBId query(path, run, run, version, -1);
+       AliCDBId dataId;
+
+       GetId(query,dataId);
+
+       return dataId.GetSubVersion();
+
+}
+
+
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //                                                                                             //
 // AliCDBDump factory                                                                                 //
@@ -670,7 +728,9 @@ AliCDBStorage* AliCDBDumpFactory::Create(const AliCDBParam* param) {
 ClassImp(AliCDBDumpParam)
 
 //_____________________________________________________________________________
-AliCDBDumpParam::AliCDBDumpParam() {
+AliCDBDumpParam::AliCDBDumpParam():
+fDBPath(), fReadOnly(kFALSE)
+{
 // default constructor
 
 }