#include <TFile.h>
#include <TString.h>
#include <TBits.h>
-#include <TList.h>
#include "AliRunLoader.h"
fDirectory(0x0),
fFileOption(),
fCompressionLevel(2),
+ fNEventsPerFile(0),
fBaseLoaders(0x0),
fHasTask(kFALSE),
fTaskName(),
fDirectory(0x0),
fFileOption(0),
fCompressionLevel(2),
+ fNEventsPerFile(0),
fBaseLoaders(new TObjArray(4)),
fHasTask(kFALSE),
fTaskName(),
}
/*****************************************************************************/
+AliDataLoader::AliDataLoader(const AliDataLoader& source):TNamed(source) {
+ // copy constructor
+ Fatal("AliDataLoader","Copy constructor not implemented");
+}
+/*****************************************************************************/
+AliDataLoader& AliDataLoader::operator=(const AliDataLoader& /*source*/) {
+ // Assignment operator
+ Fatal("AliDataLoader","Assignment operator not implemented");
+ return *this;
+}
+/*****************************************************************************/
AliDataLoader::~AliDataLoader()
{
void AliDataLoader::UnloadAll()
{
//Unloads all data and tasks
+ if ( fFile == 0x0 ) return; //nothing loaded
+
TIter next(fBaseLoaders);
AliBaseLoader* bl;
while ((bl = (AliBaseLoader*)next()))
Int_t AliDataLoader::SetFolder(TFolder* folder)
{
-
+ // Sets the folder and the data loaders
if (folder == 0x0)
{
Error("SetFolder","Stupid joke. Argument is NULL");
Error("GetRunLoader","Can not get event folder.");
return 0;
}
- rg = dynamic_cast<AliRunLoader*>(ef->FindObject(AliRunLoader::fgkRunLoaderName));
+ rg = dynamic_cast<AliRunLoader*>(ef->FindObject(AliRunLoader::GetRunLoaderName()));
return rg;
}
//return fname;
Long_t offset = (Long_t)GetRunLoader()->GetFileOffset();
+ if (fNEventsPerFile > 0) {
+ offset = GetRunLoader()->GetEventNumber()/fNEventsPerFile;
+ }
if (offset < 1) return fname;
TString soffset;
void AliDataLoader::MakeTree()
{
+ // Makes tree for the current data loader
AliTreeLoader* tl = dynamic_cast<AliTreeLoader*>(fBaseLoaders->At(0));
if (tl == 0x0)
{
AliBaseLoader* AliDataLoader::GetBaseLoader(Int_t n) const
{
+ // Gets the n-th base loader (what is n?)
return dynamic_cast<AliBaseLoader*>(fBaseLoaders->At(n));
}
/*****************************************************************************/
void AliDataLoader::SetDirName(TString& dirname)
{
+ // Sets the directory name where the files will be stored
if (GetDebug()>9) Info("SetDirName","FileName before %s",fFileName.Data());
Int_t n = fFileName.Last('/');
/*****************************************************************************/
AliObjectLoader* AliDataLoader::GetBaseDataLoader()
{
+ // Gets the base data loader
return dynamic_cast<AliObjectLoader*>(GetBaseLoader(kData));
}
/*****************************************************************************/
AliTaskLoader* AliDataLoader::GetBaseTaskLoader()
{
+ // Gets the base task loader
return dynamic_cast<AliTaskLoader*>(GetBaseLoader(kTask));
}
/*****************************************************************************/
AliBaseLoader* AliDataLoader::GetBaseQALoader()
{
+ // Gets the base QA loader
return GetBaseLoader(kQA);
}
/*****************************************************************************/
void AliDataLoader::Synchronize()
{
//synchrinizes all writtable files
- if ( fFile == 0x0 ) return;
- if ( fFile->IsWritable() == kFALSE ) return;
- fFile->Write(0,TObject::kOverwrite);
+ if ( fFile ) fFile->Flush();
}
/*****************************************************************************/
fDoNotReload(kFALSE),
fDataLoader(0x0)
{
+ //default constructor
}
/*****************************************************************************/
fDoNotReload(storeontop),//if stored on top of file - this object is loaded ones pe
fDataLoader(dl)
{
+ //constructor
}
+/*****************************************************************************/
+AliBaseLoader::AliBaseLoader(const AliBaseLoader& source):TNamed(source) {
+ // copy constructor
+ Fatal("AliBaseLoader","Copy constructor not implemented");
+}
+/*****************************************************************************/
+AliBaseLoader& AliBaseLoader::operator=(const AliBaseLoader& /*source*/) {
+ // Assignment operator
+ Fatal("AliBaseLoader","Assignment operator not implemented");
+ return *this;
+}
/*****************************************************************************/
Int_t AliBaseLoader::Load(Option_t* opt)
{
+ // Loads and posts the data
if (GetDebug())
Info("Load","data type = %s, option = %s",GetName(),opt);
if (Get())
{
- Warning("Load","Data <<%s>> are already loaded. Use ReloadData to force reload. Nothing done",GetName());
- return 0;
+ if (GetDebug())
+ Warning("Load","Data <<%s>> are already loaded. Use ReloadData to force reload. Nothing done",GetName());
+ return 0;
}
Int_t retval;
}
else
{
- Warning("Post","Can not find %s in file %s", GetName(),GetDataLoader()->GetFile()->GetName());
+ Error("Post","Can not find %s in file %s", GetName(),GetDataLoader()->GetFile()->GetName());
+ return 5;
}
}
return 0;
Error("Post","Pointer to object is NULL");
return 1;
}
+
+ if ( fName.CompareTo(data->GetName()) != 0)
+ {
+ Fatal("Post(TObject*)","Object name is <<%s>> while <<%s>> expected",data->GetName(),GetName());
+ return -1;//pro forma
+ }
+
TObject* obj = Get();
if (data == obj)
{
void AliBaseLoader::Unload()
{
+ // Unloads data and closes the files
Clean();
fIsLoaded = kFALSE;
GetDataLoader()->CloseFile();
/*****************************************************************************/
AliDataLoader* AliBaseLoader::GetDataLoader() const
{
+ // Returns pointer to the data loader
if (fDataLoader == 0x0)
{
Fatal("GetDataLoader","Pointer to Data Loader is NULL");
Int_t AliBaseLoader::GetDebug() const
{
- return (Int_t)AliLoader::fgDebug;
+ // Returns debug level
+ return (Int_t)AliLoader::GetDebug();
}
-TDirectory* AliBaseLoader::GetDirectory()
+TDirectory* AliBaseLoader::GetDirectory() const
{
// returnd TDirectory where data are to be saved
//if fStoreInTopOfFile flag is true - returns pointer to file
TFolder* AliObjectLoader::GetFolder() const
{
+ // Returns pointer to the object folder
TFolder* df = GetDataLoader()->GetFolder();
if (df == 0x0)
{
return df;
}
/*****************************************************************************/
+AliObjectLoader::AliObjectLoader(const AliObjectLoader& source):
+ AliBaseLoader(source) {
+ // copy constructor
+ Fatal("AliObjectLoader","Copy constructor not implemented");
+}
+/*****************************************************************************/
+AliObjectLoader& AliObjectLoader::operator=(const AliObjectLoader& /*source*/) {
+ // Assignment operator
+ Fatal("AliObjectLoader","Assignment operator not implemented");
+ return *this;
+}
+/*****************************************************************************/
void AliObjectLoader::RemoveFromBoard(TObject* obj)
{
+ // Removes "obj" from the board
GetFolder()->Remove(obj);
}
/*****************************************************************************/
Int_t AliObjectLoader::AddToBoard(TObject* obj)
{
+ // Adds "obj" to the board
GetFolder()->Add(obj);
return 0;
}
TObject* AliObjectLoader::Get() const
{
+ // Returns pointer to the object loader
return (GetFolder()) ? GetFolder()->FindObject(GetName()) : 0x0;
}
{
//constructor
}
+/*****************************************************************************/
+AliTreeLoader::AliTreeLoader(const AliTreeLoader& source):
+ AliObjectLoader(source) {
+ // copy constructor
+ Fatal("AliTreeLoader","Copy constructor not implemented");
+}
+/*****************************************************************************/
+AliTreeLoader& AliTreeLoader::operator=(const AliTreeLoader& /*source*/) {
+ // Assignment operator
+ Fatal("AliTreeLoader","Assignment operator not implemented");
+ return *this;
+}
/*****************************************************************************/
//constructor
}
+/*****************************************************************************/
+AliTaskLoader::AliTaskLoader(const AliTaskLoader& source):
+ AliBaseLoader(source) {
+ // copy constructor
+ Fatal("AliTaskLoader","Copy constructor not implemented");
+}
+/*****************************************************************************/
+AliTaskLoader& AliTaskLoader::operator=(const AliTaskLoader& /*source*/) {
+ // Assignment operator
+ Fatal("AliTaskLoader","Assignment operator not implemented");
+ return *this;
+}
+/*****************************************************************************/
+void AliTaskLoader::Clean()
+{
+//removes tasl from parental task
+// DO NOT DELETE OBJECT contrary to BaseLoader
+//
+ if (GetDebug()) Info("Clean","%s %s",GetName(),GetDataLoader()->GetName());
+ TObject* obj = Get();
+ if(obj)
+ {
+ if (GetDebug())
+ Info("Clean","cleaning %s.",GetName());
+ RemoveFromBoard(obj);
+ }
+}
/*****************************************************************************/
void AliTaskLoader::RemoveFromBoard(TObject* obj)
{
+ // Removes the task "obj" from the board
GetParentalTask()->GetListOfTasks()->Remove(obj);
}
/*****************************************************************************/
Int_t AliTaskLoader::AddToBoard(TObject* obj)
{
+ // Adds task "obj" to the board
TTask* task = dynamic_cast<TTask*>(obj);
if (task == 0x0)
{
TObject* AliTaskLoader::Get() const
{
+ // Returns pointer to the current task
return (GetParentalTask()) ? GetParentalTask()->GetListOfTasks()->FindObject(GetName()) : 0x0;
}
/*****************************************************************************/