TTree and TNtuple are loaded from OCDB file before closing the file.
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Jun 2007 07:07:16 +0000 (07:07 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Jun 2007 07:07:16 +0000 (07:07 +0000)
STEER/AliCDBGrid.cxx
STEER/AliCDBLocal.cxx
STEER/AliCDBStorage.cxx
STEER/AliCDBStorage.h

index 3725967..1fcd771 100644 (file)
@@ -542,7 +542,7 @@ Bool_t AliCDBGrid::PutEntry(AliCDBEntry* entry) {
 
        file->cd();
 
-       SetTreeToFile(entry, file);
+       //SetTreeToFile(entry, file);
 
        entry->SetVersion(id.GetVersion());
 
index 5a489b0..f79da4a 100644 (file)
@@ -404,7 +404,7 @@ AliCDBEntry* AliCDBLocal::GetEntry(const AliCDBId& queryId) {
        }
 
        AliCDBId entryId = anEntry->GetId();
+
        // The object's Id are not reset during storage
        // If object's Id runRange or version do not match with filename,
        // it means that someone renamed file by hand. In this case a warning msg is issued.
@@ -550,7 +550,7 @@ Bool_t AliCDBLocal::PutEntry(AliCDBEntry* entry) {
                return kFALSE;
        }
        
-       SetTreeToFile(entry, &file);
+       //SetTreeToFile(entry, &file);
 
        entry->SetVersion(id.GetVersion());
        entry->SetSubVersion(id.GetSubVersion());
index 7fcebf0..a69e7e5 100644 (file)
@@ -16,6 +16,7 @@
 #include <TKey.h>
 #include <TH1.h>
 #include <TTree.h>
+#include <TNtuple.h>
 #include <TFile.h>
 #include "AliCDBStorage.h"
 #include "AliCDBGrid.h"
@@ -447,37 +448,50 @@ AliCDBManager::DataType AliCDBStorage::GetDataType() const {
 void AliCDBStorage::LoadTreeFromFile(AliCDBEntry *entry) const {
 // Checks whether entry contains a TTree and in case loads it into memory
 
-       AliCDBMetaData *md = dynamic_cast<AliCDBMetaData*> (entry->GetMetaData());
-       if(!md) return;
-       TString objStr = md->GetObjectClassName();
-       if(objStr != "TTree") return;
-       AliWarning("Entry contains a TTree! Loading baskets...");
+       TObject *obj = (TObject*) entry->GetObject();
 
-       TTree* tree = dynamic_cast<TTree*> (entry->GetObject());
+       if (!strcmp(obj->ClassName(),TTree::Class_Name())) {
 
-       if(!tree) return;
+               AliWarning("Entry contains a TTree! Loading baskets...");
 
-       tree->LoadBaskets();
-       tree->SetDirectory(0);
+               TTree* tree = dynamic_cast<TTree*> (obj);
 
-       return;
-}
+               if(!tree) return;
 
-//_____________________________________________________________________________
-void AliCDBStorage::SetTreeToFile(AliCDBEntry *entry, TFile* file) const {
-// Checks whether entry contains a TTree and in case assigns it to memory
+               tree->LoadBaskets();
+               tree->SetDirectory(0);
+       }
+       else if (!strcmp(obj->ClassName(),TNtuple::Class_Name())){
 
-       AliCDBMetaData *md = dynamic_cast<AliCDBMetaData*> (entry->GetMetaData());
-       if(!md) return;
-       TString objStr = md->GetObjectClassName();
-       if(objStr != "TTree") return;
-       AliWarning("Entry contains a TTree! Setting file...");
+               AliWarning("Entry contains a TNtuple! Loading baskets...");
 
-       TTree* tree = dynamic_cast<TTree*> (entry->GetObject());
+               TNtuple* ntu = dynamic_cast<TNtuple*> (obj);
 
-       if(!tree) return;
+               if(!ntu) return;
 
-       tree->SetDirectory(file);
+               ntu->LoadBaskets();
+               ntu->SetDirectory(0);
+       }
 
        return;
 }
+
+// //_____________________________________________________________________________
+// void AliCDBStorage::SetTreeToFile(AliCDBEntry *entry, TFile* file) const {
+// // Checks whether entry contains a TTree and in case assigns it to memory
+// 
+//     AliCDBMetaData *md = dynamic_cast<AliCDBMetaData*> (entry->GetMetaData());
+//     if(!md) return;
+//     TString objStr = md->GetObjectClassName();
+//     if(objStr != "TTree") return;
+//     AliWarning("Entry contains a TTree! Setting file...");
+// 
+//     TTree* tree = dynamic_cast<TTree*> (entry->GetObject());
+// 
+//     if(!tree) return;
+// 
+// //  tree->SetDirectory(file);
+//     tree->SetDirectory(0);
+// 
+//     return;
+// }
index 7a7f3fb..312a5f7 100644 (file)
@@ -105,7 +105,7 @@ protected:
        virtual TList *GetIdListFromFile(const char* fileName)=0;
        virtual void   QueryValidFiles() = 0;
        void    LoadTreeFromFile(AliCDBEntry* entry) const;
-       void    SetTreeToFile(AliCDBEntry* entry, TFile* file) const;
+       //void  SetTreeToFile(AliCDBEntry* entry, TFile* file) const;
 
        TObjArray fValidFileIds;        // list of Id's of the files valid for a given run (cached as fRun)
        Int_t fRun;             // run number, used to manage list of valid files