Bug corrected.
[u/mrichter/AliRoot.git] / STEER / AliBaseLoader.h
CommitLineData
a9bbb414 1#ifndef ALIBASELOADER_H
2#define ALIBASELOADER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8//__________________________________________
9////////////////////////////////////////////
10// //
11// class AliBaseLoader //
12// //
13// Loader responsible for one data type //
14// i.e. Hits, Kine, etc. //
15// many objects type can be assciated //
16// with one data type: storing object //
17// (usually tree), task producing it, //
18// Quality Assurance(QA), QA Task, and //
19// others. //
20// //
21// //
22////////////////////////////////////////////
23
24#include <TDirectory.h>
25#include <TNamed.h>
26#include <TString.h>
27#include <TTask.h>
28#include <TTree.h>
29class TFile;
30class TFolder;
31
32class AliLoader;
33class AliDataLoader;
34class AliObjectLoader;
35class AliRunLoader;
36class AliTaskLoader;
37class AliTreeLoader;
38
39class AliBaseLoader: public TNamed
40{
41 public:
42 AliBaseLoader();
43 AliBaseLoader(const TString& name, AliDataLoader* dl, Bool_t storeontop = kFALSE);
a9bbb414 44
45 virtual ~AliBaseLoader(){};
46
47 virtual Int_t Load(Option_t* opt="");
48 virtual void Unload();
49 virtual Int_t Reload();
50 virtual Int_t WriteData(Option_t* opt="");
51 virtual void Clean();
52 virtual Int_t Post();//Takes from file and sends to proper TFolder (Data Folder)
53 virtual Int_t Post(TObject* data);//Sends to proper TFolder (Data Folder)
54 virtual TObject* Get() const = 0;
55 Bool_t IsLoaded()const{return fIsLoaded;}
56 void SetDataLoader(AliDataLoader* dl){fDataLoader = dl;}
57 void SetEventFolder(TFolder* /*ef*/){;}
58 void SetDoNotReload(Bool_t flag){fDoNotReload = flag;}
59 Bool_t DoNotReload() const {return fDoNotReload;}
60 TDirectory* GetDirectory() const;//returns pointer to directory where data are stored.
61 TObject* GetFromDirectory(const char *name) const
62 {return (GetDirectory())?GetDirectory()->Get(name):0x0;}
63 protected:
64
65 virtual Int_t AddToBoard(TObject* obj) = 0;//add to white board - board can be TTask or TFolder
66 virtual void RemoveFromBoard(TObject* obj) = 0;
67
68 AliDataLoader* GetDataLoader() const;
69
70 Bool_t fIsLoaded; //! flag indicating if data are loaded
71 Bool_t fStoreInTopOfFile;// if true, data are stored in top of file ->Indicates fDoNotReload == kTRUE
72
73 private:
dc86eb51 74
75 AliBaseLoader(const AliBaseLoader&); //Not implemented
76 AliBaseLoader& operator=(const AliBaseLoader&); //Not implemented
77
a9bbb414 78 Bool_t fDoNotReload; // if this flag is on object is not reloaded while GetEvent is called.
79 //Specially important for tasks. Task loops over events while producing data,
80 //and has a base loader which writes it to file every processed event.
81 //If this flag is not on, while taking next event, loader deletes task
82 // and tries to get new one from file
83 AliDataLoader* fDataLoader; //! pointer to Data Loader this Base Loader belongs to
84
85 ClassDef(AliBaseLoader,1)
86};
87
88
89#endif
90
91