#include <TArrayI.h>
#include <TFile.h>
#include <TList.h>
+#include "TBrowser.h"
ClassImp(AliOADBContainer);
//______________________________________________________________________________
AliOADBContainer::AliOADBContainer() :
TNamed(),
- fArray(new TObjArray(100)),
- fDefaultList(new TList()),
+ fArray(0),
+ fDefaultList(0),
fLowerLimits(),
fUpperLimits(),
fEntries(0)
Int_t index = HasOverlap(lower, upper);
if (index != -1) {
- AliFatal(Form("Ambiguos validity range (%5d) !\n", index));
+ AliFatal(Form("Ambiguos validity range (%5d, %5.5d-%5.5d) !\n", index,lower,upper));
return;
}
//
return;
}
//
+ // Remove the old object
+ RemoveObject(idx);
+
// Check that there is no overlap with existing run ranges
Int_t index = HasOverlap(lower, upper);
if (index != -1) {
- AliFatal(Form("Ambiguos validity range (%5d) !\n", index));
+ AliFatal(Form("Ambiguos validity range (%5d, %5.5d-%5.5d) !\n", index,lower,upper));
return;
}
//
}
-void AliOADBContainer::AddDefaultObject(TNamed* obj)
+void AliOADBContainer::AddDefaultObject(TObject* obj)
{
// Add a default object
fDefaultList->Add(obj);
return index;
}
-TObject* AliOADBContainer::GetObject(Int_t run, char* def) const
+TObject* AliOADBContainer::GetObject(Int_t run, const char* def) const
{
// Return object for given run or default if not found
TObject* obj = 0;
{
//
// Write object to file
- TFile* f = new TFile(fname, "recreate");
+ TFile* f = new TFile(fname, "update");
Write();
+ f->Purge();
f->Close();
}
AliError("Object not found in file \n");
return 1;
}
-
+
+ SetName(cont->GetName());
+ SetTitle(cont->GetTitle());
+
fEntries = cont->GetNumberOfEntries();
fLowerLimits.Set(fEntries);
fUpperLimits.Set(fEntries);
fUpperLimits[i] = cont->UpperLimit(i);
fArray->AddAt(cont->GetObjectByIndex(i), i);
}
-
+ if (!fDefaultList) fDefaultList = new TList();
TIter next(cont->GetDefaultList());
TObject* obj;
while((obj = next())) fDefaultList->Add(obj);
}
-Int_t AliOADBContainer::HasOverlap(Int_t lower, Int_t upper)
+Int_t AliOADBContainer::HasOverlap(Int_t lower, Int_t upper) const
{
//
// Checks for overlpapping validity regions
}
return (-1);
}
+
+void AliOADBContainer::Browse(TBrowser *b)
+{
+ // Browse this object.
+ // If b=0, there is no Browse call TObject::Browse(0) instead.
+ // This means TObject::Inspect() will be invoked indirectly
+
+
+ if (b) {
+ for (Int_t i = 0; i < fEntries; i++) {
+ b->Add(fArray->At(i),Form("%9.9d - %9.9d", fLowerLimits[i], fUpperLimits[i]));
+ }
+ TIter next(fDefaultList);
+ TObject* obj;
+ while((obj = next())) b->Add(obj);
+
+ }
+ else
+ TObject::Browse(b);
+}
+