}
-//_____________________________________________________________________________
-Int_t AliCDBGrid::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 = 0;
- // look for file matching query requests (path, runRange, version)
- if(run == fRun && fPathFilter.Comprises(aCDBPath) && fVersion < 0){
- // look into list of valid files previously loaded with AliCDBStorage::FillValidFileIds()
- AliDebug(2, Form("List of files valid for run %d and for path %s was loaded. Looking there!",
- run, path));
- dataId = GetId(fValidFileIds, query);
- if (!dataId) return -1;
- Int_t version = dataId->GetVersion();
- delete dataId;
- return version;
-
- }
- // List of files valid for reqested run was not loaded. Looking directly into CDB
- AliDebug(2, Form("List of files valid for run %d and for path %s was not loaded. Looking directly into CDB!",
- run, path));
-
- TObjArray validFileIds;
- validFileIds.SetOwner(1);
-
- TString filter;
- MakeQueryFilter(run, run, 0, filter);
-
- TString pattern = ".root";
-
- TString folderCopy(Form("%s%s/Run",fDBFolder.Data(),path));
-
- AliDebug(2,Form("** fDBFolder = %s, pattern = %s, filter = %s",folderCopy.Data(), pattern.Data(), filter.Data()));
- TGridResult *res = gGrid->Query(folderCopy, pattern, filter, "-y -m");
-
- AliCDBId validFileId;
- if (res->GetEntries()>1){
- AliWarning("Number of found entries >1, even if option -y was used");
- for(int i=0; i<res->GetEntries(); i++){
- TString filename = res->GetKey(i, "lfn");
- if(filename == "") continue;
- if(FilenameToId(filename, validFileId))
- validFileIds.AddLast(validFileId.Clone());
- }
- dataId = GetId(validFileIds, query);
- if (!dataId) return -1;
-
- Int_t version = dataId->GetVersion();
- delete dataId;
- return version;
- }
- else if (res->GetEntries()==1){
- TString filename = res->GetKey(0, "lfn");
- if(filename == "") {
- AliError("The only entry found has filename empty");
- return -1;
- }
- if(FilenameToId(filename, validFileId)) return validFileId.GetVersion();
- else{
- AliError("Impossible to get FileId from filename");
- return -1;
- }
- }
- else {
- AliError("No entries found");
- return -1;
- }
-
- delete res;
-
-
-}
-
-//_____________________________________________________________________________
-Int_t AliCDBGrid::GetLatestSubVersion(const char* /*path*/, Int_t /*run*/, Int_t /*version*/){
-// get last subversion found in the database valid for run and path
- AliError("Objects in GRID storage have no sub version!");
- return -1;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////////////
// //