]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDataLoader.cxx
Det and SMN converted from float to int
[u/mrichter/AliRoot.git] / STEER / AliDataLoader.cxx
index 2ec209cd7683ccf7c6527022b1e0c05599164564..cf59dd8b91c33febf66e0013814a044bceed42bd 100644 (file)
@@ -86,6 +86,17 @@ AliDataLoader::AliDataLoader(const char* filename, const char* contname, const c
   
 }
 /*****************************************************************************/ 
+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()
 {
@@ -245,6 +256,8 @@ void AliDataLoader::Unload()
 void AliDataLoader::UnloadAll()
 {
 //Unloads all data and tasks
+ if ( fFile == 0x0 ) return; //nothing loaded
  TIter next(fBaseLoaders);
  AliBaseLoader* bl;
  while ((bl = (AliBaseLoader*)next()))
@@ -329,7 +342,7 @@ Int_t  AliDataLoader::SetEventFolder(TFolder* eventfolder)
 
 Int_t  AliDataLoader::SetFolder(TFolder* folder)
 {
-
+  // Sets the folder and the data loaders
  if (folder == 0x0)
   {
     Error("SetFolder","Stupid joke. Argument is NULL");
@@ -488,6 +501,7 @@ Int_t AliDataLoader::GetDebug() const
 
 void AliDataLoader::MakeTree()
 {
+  // Makes tree for the current data loader
   AliTreeLoader* tl = dynamic_cast<AliTreeLoader*>(fBaseLoaders->At(0));
   if (tl == 0x0)
    {
@@ -564,6 +578,7 @@ AliBaseLoader* AliDataLoader::GetBaseLoader(const TString& name) const
 
 AliBaseLoader* AliDataLoader::GetBaseLoader(Int_t n) const
 {
+  // Gets the n-th base loader (what is n?)
  return dynamic_cast<AliBaseLoader*>(fBaseLoaders->At(n));
 }
 /*****************************************************************************/ 
@@ -582,6 +597,7 @@ TTree* AliDataLoader::Tree() const
 
 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('/');
@@ -599,16 +615,19 @@ void  AliDataLoader::SetDirName(TString& dirname)
 /*****************************************************************************/ 
 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);
 }
 /*****************************************************************************/ 
@@ -665,6 +684,11 @@ void AliDataLoader::SetBaseQATaskLoader(AliTaskLoader* bl)
   if (GetBaseQATaskLoader()) delete GetBaseQATaskLoader();
   fBaseLoaders->AddAt(bl,kQATask);
 }
+void AliDataLoader::Synchronize()
+{
+  //synchrinizes all writtable files 
+  if ( fFile ) fFile->Flush();
+}
 
 /*****************************************************************************/ 
 /*****************************************************************************/ 
@@ -684,6 +708,7 @@ AliBaseLoader::AliBaseLoader():
  fDoNotReload(kFALSE),
  fDataLoader(0x0)
 {
+  //default constructor
 }
 /*****************************************************************************/ 
 
@@ -694,12 +719,25 @@ AliBaseLoader::AliBaseLoader(const TString& name,  AliDataLoader* dl, Bool_t sto
  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);
 
@@ -782,7 +820,8 @@ Int_t AliBaseLoader::Post()
      }
     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;
@@ -797,6 +836,13 @@ Int_t AliBaseLoader::Post(TObject* data)
     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)
   {
@@ -905,6 +951,7 @@ void AliBaseLoader::Clean()
 
 void AliBaseLoader::Unload()
 {
+  // Unloads data and closes the files
   Clean();
   fIsLoaded = kFALSE;
   GetDataLoader()->CloseFile();
@@ -912,6 +959,7 @@ void AliBaseLoader::Unload()
 /*****************************************************************************/ 
 AliDataLoader* AliBaseLoader::GetDataLoader() const
 {
+  // Returns pointer to the data loader
  if (fDataLoader == 0x0) 
   {
     Fatal("GetDataLoader","Pointer to Data Loader is NULL");
@@ -922,10 +970,11 @@ AliDataLoader* AliBaseLoader::GetDataLoader() const
 
 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
@@ -953,6 +1002,7 @@ AliObjectLoader::AliObjectLoader(const TString& name, AliDataLoader* dl, Bool_t
 
 TFolder* AliObjectLoader::GetFolder() const
 {
+  // Returns pointer to the object folder
   TFolder* df = GetDataLoader()->GetFolder();
   if (df == 0x0)
    {
@@ -961,14 +1011,28 @@ TFolder* AliObjectLoader::GetFolder() const
   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;
 }
@@ -976,6 +1040,7 @@ Int_t AliObjectLoader::AddToBoard(TObject* obj)
 
 TObject* AliObjectLoader::Get() const
 {
+  // Returns pointer to the object loader
   return (GetFolder()) ? GetFolder()->FindObject(GetName()) : 0x0;
 }
 
@@ -997,6 +1062,18 @@ AliTreeLoader::AliTreeLoader(const TString& name, AliDataLoader* dl,Bool_t store
 {
 //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;
+}
 
 /*****************************************************************************/ 
 
@@ -1115,16 +1192,45 @@ AliTaskLoader::AliTaskLoader(const TString& name, AliDataLoader* dl, TTask* pare
 //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)
    {
@@ -1138,6 +1244,7 @@ Int_t AliTaskLoader::AddToBoard(TObject* obj)
 
 TObject* AliTaskLoader::Get() const
 {
+  // Returns pointer to the current task
   return (GetParentalTask()) ? GetParentalTask()->GetListOfTasks()->FindObject(GetName()) : 0x0;
 }
 /*****************************************************************************/