#include <TKey.h>
#include <TH1.h>
+#include <TTree.h>
+#include <TNtuple.h>
+#include <TFile.h>
#include "AliCDBStorage.h"
#include "AliCDBGrid.h"
//_____________________________________________________________________________
AliCDBEntry* AliCDBStorage::Get(const AliCDBId& query) {
// get an AliCDBEntry object from the database
-
+
// check if query's path and runRange are valid
// query is invalid also if version is not specified and subversion is!
if (!query.IsValid()) {
return NULL;
}
- // query is not specified if path contains wildcard or runrange = [-1,-1]
+ // query is not specified if path contains wildcard or runrange = [-1,-1]
if (!query.IsSpecified()) {
- AliError(Form("Unspecified query: %s",
+ AliError(Form("Unspecified query: %s",
query.ToString().Data()));
return NULL;
}
}
//_____________________________________________________________________________
-AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path, Int_t runNumber,
+AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path, Int_t runNumber,
Int_t version, Int_t subVersion) {
// get an AliCDBEntry object from the database
}
//_____________________________________________________________________________
-AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path,
+AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path,
const AliCDBRunRange& runRange, Int_t version,
Int_t subVersion) {
// get an AliCDBEntry object from the database
return GetAll(AliCDBId(path, runRange, version, subVersion));
}
+//_____________________________________________________________________________
+AliCDBId* AliCDBStorage::GetId(const AliCDBId& query) {
+// get the Id of the valid object from the database (does not open the file)
+
+ // check if query's path and runRange are valid
+ // query is invalid also if version is not specified and subversion is!
+ if (!query.IsValid()) {
+ AliError(Form("Invalid query: %s", query.ToString().Data()));
+ return NULL;
+ }
+
+ // query is not specified if path contains wildcard or runrange = [-1,-1]
+ if (!query.IsSpecified()) {
+ AliError(Form("Unspecified query: %s",
+ query.ToString().Data()));
+ return NULL;
+ }
+
+ AliCDBId* id = GetEntryId(query);
+
+ return id;
+}
+
+//_____________________________________________________________________________
+AliCDBId* AliCDBStorage::GetId(const AliCDBPath& path, Int_t runNumber,
+ Int_t version, Int_t subVersion) {
+// get the Id of the valid object from the database (does not open the file)
+
+ return GetId(AliCDBId(path, runNumber, runNumber, version, subVersion));
+}
+
+//_____________________________________________________________________________
+AliCDBId* AliCDBStorage::GetId(const AliCDBPath& path,
+ const AliCDBRunRange& runRange, Int_t version,
+ Int_t subVersion) {
+// get the Id of the valid object from the database (does not open the file)
+
+ return GetId(AliCDBId(path, runRange, version, subVersion));
+}
//_____________________________________________________________________________
Bool_t AliCDBStorage::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData, AliCDBManager::DataType type) {
return AliCDBManager::kPrivate;
}
+
+//_____________________________________________________________________________
+void AliCDBStorage::LoadTreeFromFile(AliCDBEntry *entry) const {
+// Checks whether entry contains a TTree and in case loads it into memory
+
+ TObject *obj = (TObject*) entry->GetObject();
+
+ if (!strcmp(obj->ClassName(),TTree::Class_Name())) {
+
+ AliWarning("Entry contains a TTree! Loading baskets...");
+
+ TTree* tree = dynamic_cast<TTree*> (obj);
+
+ if(!tree) return;
+
+ tree->LoadBaskets();
+ tree->SetDirectory(0);
+ }
+ else if (!strcmp(obj->ClassName(),TNtuple::Class_Name())){
+
+ AliWarning("Entry contains a TNtuple! Loading baskets...");
+
+ TNtuple* ntu = dynamic_cast<TNtuple*> (obj);
+
+ if(!ntu) return;
+
+ 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;
+// }